body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f7f6ef;
    color: #111;
    text-align: center;
}

header img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    display: block;
    border-bottom: 3px solid #556b2f;
}

/* Navigation bar */
.top-nav {
    background-color: #2e4519;
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 10px 0;
    border-bottom: 2px solid #3a4b23;
}

.top-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.top-nav a:hover {
    background-color: #3e5c2f;
}

.top-nav .active {
    background-color: #6e7f3e;
}

.top-nav .disabled {
    color: #ccc;
    pointer-events: none;
}

/* Main container */
.container {
    padding: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Section header panel */
.panel-title {
    padding: 15px;
    border: 2px solid #556b2f;
    background-color: #eaf2db;
    margin-bottom: 25px;
    border-radius: 6px;
}

.panel-title h1 {
    color: #2e4519;
    margin-bottom: 10px;
}

/* Section box container (FIX: always show border including top!) */
.section-box {
    background-color: #eef0e2;
    border: 2px solid #556b2f !important;  /* Force all borders visible */
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    margin-top: 24px;  /* Added spacing from previous section */
    box-sizing: border-box;
}

/* To ensure the border is visible at all screen widths, add: */
.section-box:first-child {
    margin-top: 0 !important;
}

/* Section headers in boxes */
.section-box h2 {
    text-align: center;
    color: #2e4519;
    margin-top: 0;
}

/* Tactical Instructions Styling */
.tactical-instructions {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #495057;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.tactical-instructions h3 {
    color: #2e4519;
    font-size: 1.2em;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #6e7f3e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.tactical-instructions h3:first-child {
    margin-top: 0;
}

.tactical-instructions ul {
    margin: 10px 0 20px 0;
    padding-left: 20px;
}

.tactical-instructions li {
    margin: 8px 0;
    line-height: 1.4;
    color: #495057;
}

.tactical-instructions strong {
    color: #2e4519;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- TABS --- */
.tabbed-log {
    margin-bottom: 15px;
    margin-top: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.tab-btn {
    background-color: #1e1e1e;
    color: #c0ffb5;
    border: none;
    outline: none;
    padding: 10px 26px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
    position: relative;
    font-size: 1.1em;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    background-color: #d6e7c7;
    color: #2e4519;
    border-bottom: 3px solid #6e7f3e;
    z-index: 1;
}

.tab-badge, .tab-btn .badge {
    background: #39bb1d;
    color: #fff;
    border-radius: 16px;
    font-size: 0.85em;
    padding: 2px 8px;
    margin-left: 7px;
    vertical-align: middle;
    font-weight: bold;
}

.tab-btn.tab-error .badge, .tab-btn.tab-error .tab-badge {
    background: #c0392b;
}
.tab-btn.tab-warning .badge, .tab-btn.tab-warning .tab-badge {
    background: #e67e22;
}
.tab-btn.tab-all .badge, .tab-btn.tab-all .tab-badge {
    background: #168500;
}

/* --- Console/logs panel --- */
.logs-panel {
    background: #191e15;
    color: #eaf2db;
    border-radius: 8px;
    padding: 0;
    min-height: 340px;
    max-height: 480px;
    overflow-y: auto;
    border: 2px solid #3a4b23;
    margin-bottom: 20px;
    text-align: left;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
    font-size: 1.11em;
    line-height: 1.6;
    scroll-behavior: smooth;
}

.tab-all-active .log-line:nth-child(even) {
    background: #212b1b;
}
.tab-all-active .log-line:nth-child(odd) {
    background: #191e15;
}
.log-line {
    display: block;
    padding: 6px 18px;
    border-left: 4px solid transparent;
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    text-align: left;
}

/* All tab: highlight by log type */
.log-error {
    color: #ff5757;
    border-left: 4px solid #ff5757;
    font-weight: bold;
    background: #26191a !important;
}
.log-warning {
    color: #f5c84e;
    border-left: 4px solid #f5c84e;
    font-weight: bold;
    background: #282312 !important;
}
.log-other {
    color: #b8e39b;
    opacity: 0.92;
}

/* Error tab: alternating background for errors */
.log-error-alt0 {
    color: #ff3c3c;
    background: #2e161a;
    border-left: 4px solid #ff3c3c;
    font-weight: bold;
}
.log-error-alt1 {
    color: #ff6f6f;
    background: #471c22;
    border-left: 4px solid #ff6f6f;
    font-weight: bold;
}

/* Warning tab: alternating background for warnings */
.log-warning-alt0 {
    color: #e67e22;
    background: #3a260d;
    border-left: 4px solid #e67e22;
    font-weight: bold;
}
.log-warning-alt1 {
    color: #ffd780;
    background: #594014;
    border-left: 4px solid #ffd780;
    font-weight: bold;
}

/* Waiting state message */
.log-waiting {
    background: #f3f5e6;
    color: #205c15;
    border: 2px dashed #bcd695;
    padding: 32px 0 32px 0;
    border-radius: 10px;
    font-size: 1.2em;
    font-style: italic;
    margin: 32px 0 32px 0;
    line-height: 1.6;
}
.log-waiting::after {
    content: "\A\A🔔 When the server starts, the status below will turn green. If logs do not load, check your server process or log file path.";
    white-space: pre;
    display: block;
    color: #707e5c;
    font-size: 0.97em;
}

/* --- Server Commands section --- */
.command-section {
    margin-top: 32px;
    padding-top: 18px;
    border: 2px solid #556b2f !important;  /* Matches section-box border */
    border-radius: 6px;
    background-color: #f3f5e6;
    box-sizing: border-box;
    /* No border-top override, ensures all borders show */
}

/* Buttons for server control */
.server-button {
    background-color: #556b2f;
    color: white;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
    border: 2px solid #3a4b23;
    cursor: pointer;
    font-size: 1.1em;
}

/* Unified disabled button style for both class and attribute */
.server-button.disabled,
.server-button:disabled {
    background-color: #888 !important;
    cursor: not-allowed !important;
    border-color: #666 !important;
    color: #eee !important;
    opacity: 0.65;
    pointer-events: none;
}

.server-button:hover {
    background-color: #40531d;
}

.stop-button {
    background-color: #aa2f2f;
    border-color: #992020;
}

.stop-button:hover {
    background-color: #911c1c;
}

.command-grid {
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
}

/* Box header style (for command/status sections) */
.box-header {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2e4519;
    text-align: left;
}

/* Status section etc unchanged from previous */
.status-section {
    background-color: #e0e5d1;
    border: 3px solid #2e4519;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 2px 12px rgba(46,69,25,0.08);
}

.status-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: flex-start;
}

.status-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 0 5px black;
    margin-top: 5px;
}

.status-indicator.online {
    background-color: limegreen;
    box-shadow: 0 0 8px limegreen;
}

.status-indicator.offline {
    background-color: crimson;
    box-shadow: 0 0 8px crimson;
}

.status-info {
    text-align: left;
    width: 100%;
}

#player-list {
    margin-top: 5px;
    margin-left: 15px;
    padding-left: 0;
    list-style: disc;
}

/* Tag styling for badges */
.tag {
    font-size: 0.75em;
    background-color: #556b2f;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ======== BACKUP SECTION STYLE FIXES ======== */

/* Prevent backup table from shrinking/blinking on refresh */
#backup-list-tbody {
    min-height: 56px;
    transition: opacity 0.18s;
    opacity: 1;
}
#backup-list-tbody.fading {
    opacity: 0.25;
}

/* Backup progress popup window */
.backup-progress-popup {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translate(-50%, 0);
    background: #fffde0;
    color: #2a3413;
    font-size: 1.3em;
    border: 2px solid #c0a633;
    border-radius: 10px;
    z-index: 1004;
    padding: 38px 56px;
    box-shadow: 0 4px 22px rgba(40,40,0,0.10);
    display: none;
    text-align: center;
}

.backup-error, .backup-success {
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
}

/* ======== BACKUP TABLES (ADDED) ======== */
.backup-list-table {
    width: 100%;
    border-collapse: collapse;
    background: #f7f6ef;
    margin-top: 12px;
    margin-bottom: 12px;
    font-size: 1em;
    box-sizing: border-box;
}

.backup-list-table th, .backup-list-table td {
    border: 1px solid #556b2f;
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}

.backup-list-table th {
    background-color: #eaf2db;
    color: #2e4519;
    font-weight: bold;
}

.backup-list-table tr:nth-child(even) td {
    background: #f3f5e6;
}
.backup-list-table tr:nth-child(odd) td {
    background: #eef0e2;
}

.backup-list-table tr:hover td {
    background-color: #e0e5d1;
}

.backup-list-table td {
    color: #2e4519;
}

.backup-list-table td a {
    color: #b33;
    font-weight: bold;
    text-decoration: underline;
}

.backup-list-table td a:hover {
    color: #600;
}

.backup-list-table td span {
    color: #b33;
    font-weight: bold;
}

@media (max-width: 700px) {
    .backup-list-table, .backup-list-table th, .backup-list-table td {
        font-size: 0.98em;
        padding: 6px 5px;
    }
}

/* ======== LOGIN FORM STYLES ======== */
.login-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2e4519;
    font-weight: bold;
    font-size: 1.1em;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #556b2f;
    border-radius: 6px;
    font-size: 1.1em;
    background-color: #f7f6ef;
    color: #2e4519;
    box-sizing: border-box;
    transition: border-color 0.3s, background-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #6e7f3e;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(110, 127, 62, 0.3);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: #556b2f;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #6e7f3e;
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

/* Button group for server selection */
.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.action-button {
    background-color: #556b2f;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    border: 2px solid #3a4b23;
    cursor: pointer;
    font-size: 1.1em;
    min-width: 150px;
    text-align: center;
}

.action-button:hover {
    background-color: #6e7f3e;
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

/* Mobile responsiveness for login */
@media (max-width: 600px) {
    .login-form {
        padding: 15px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .action-button {
        width: 100%;
        max-width: 300px;
    }
}

/* Footer styles */
.footer {
    background-color: #2e4519;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
    border-top: 2px solid #3a4b23;
}

.footer p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

/* Add table styling for player and backup tables */
.player-table, .backup-list-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 10px;
}
.player-table th, .player-table td, .backup-list-table th, .backup-list-table td {
    border: 1px solid #556b2f;
    padding: 8px 12px;
    text-align: left;
}
.player-table th, .backup-list-table th {
    background-color: #dbe6c2;
    color: #2e4519;
    font-weight: bold;
}
.player-table tr:nth-child(even), .backup-list-table tr:nth-child(even) {
    background-color: #f4f8ee;
}

.console-section {
  margin-bottom: 24px;
}
.console-log-wrapper {
  width: 100%;
  height: 350px;
  background: #181c1f;
  border: 1.5px solid #444;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.live-console {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 12px;
  font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
  font-size: 1em;
  color: #e0e0e0;
  background: transparent;
  border: none;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  box-sizing: border-box;
}
.console-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.console-controls .server-button {
  padding: 8px 16px;
  font-size: 14px;
}
#console-popout-btn {
  background: #2d5a2d;
  border-color: #4a7c4a;
  color: #ffffff;
  font-weight: bold;
}
#console-popout-btn:hover {
  background: #3a6a3a;
  border-color: #5a8c5a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#console-status {
  margin-left: 18px;
  font-size: 1em;
}

.console-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.console-tab {
  background: #222;
  color: #eee;
  border: none;
  border-radius: 4px 4px 0 0;
  padding: 6px 16px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
  transition: background 0.2s, color 0.2s;
}
.console-tab.active {
  background: #4c5700;
  color: #fff;
}
.tab-badge {
  background: #888;
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 4px;
  font-size: 0.95em;
}
.tab-badge.error { background: #d3322f; }
.tab-badge.warn { background: #e6a700; color: #222; }
.console-status {
  margin-left: auto;
  font-weight: bold;
  font-size: 1em;
  padding-left: 18px;
}
.console-status.live { color: #4c5700; }
.console-status.paused { color: #e6a700; }
.console-status.offline { color: #d3322f; }
.log-error { color: #d3322f; font-weight: bold; }
.log-warn { color: #e6a700; font-weight: bold; }
.log-info { color: #e0e0e0; }

.log-row {
  border: 1px solid #333;
  border-radius: 6px;
  padding: 7px 12px;
  margin-bottom: 7px;
  background: #23272b;
  display: block;
  line-height: 1.5;
  font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
  font-size: 1em;
  word-break: break-all;
}
.console-status.offline {
  color: #ff2222;
  text-shadow: 1px 1px 2px #000, 0 0 2px #000;
}

/* Alternating row colors for all tables */
.row-dark td, .row-dark th { background-color: #e6e8e3 !important; }
.row-light td, .row-light th { background-color: #f7f8f3 !important; }

/* Section box and header styling for all major sections */
.section-box {
  border: 2px solid #3a4b23;
  border-radius: 10px;
  background: #f3f5e6;
  margin-bottom: 32px;
  box-shadow: 0 2px 10px rgba(60,80,40,0.07);
  padding: 18px 24px 24px 24px;
}
.box-header {
  font-size: 1.25em;
  font-weight: bold;
  color: #2e4519;
  background: #eaf2db;
  border-bottom: 2px solid #3a4b23;
  border-radius: 8px 8px 0 0;
  padding: 10px 18px;
  margin: -18px -24px 18px -24px;
  box-shadow: 0 2px 6px rgba(60,80,40,0.04);
  display: flex;
  align-items: center;
}

/* Console log color coding */
.log-timestamp {
  color: #bfcf8a !important; /* light olive/sage */
  font-weight: bold;
}
.log-thread {
  color: #ffe066 !important;
  font-weight: bold;
}
.log-plugin {
  color: #eaf2db !important; /* muted light green */
  font-weight: bold;
}
.log-plugin-message {
  color: #b0b0b0 !important;
  font-weight: bold;
}
.log-message {
  color: inherit;
}

/* Alternating row colors for console logs */
.log-row:nth-child(even) {
  background-color: #2e3a1a !important; /* muted olive */
}
.log-row:nth-child(odd) {
  background-color: #232b15 !important; /* dark olive/green */
}

/* Enhanced log type styling */
.log-error .log-message {
  color: #ff5757 !important;
}
.log-warn .log-message {
  color: #f5c84e !important;
}
.log-info .log-message {
  color: #b8e39b !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  background-color: #f7f6ef;
  margin: 5% auto;
  padding: 0;
  border: 3px solid #556b2f;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background-color: #2e4519;
  color: white;
  padding: 20px;
  border-radius: 7px 7px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: white;
  font-size: 1.4em;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: white;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  background-color: #eaf2db;
  padding: 20px;
  border-radius: 0 0 7px 7px;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  border-top: 1px solid #556b2f;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #2e4519;
  font-size: 1.1em;
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 2px solid #556b2f;
  border-radius: 6px;
  font-size: 1em;
  background-color: white;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #6e7f3e;
  box-shadow: 0 0 8px rgba(110, 127, 62, 0.3);
}

.form-control option {
  padding: 8px;
}

.modal-info {
  background-color: #eaf2db;
  border: 1px solid #556b2f;
  border-radius: 6px;
  padding: 15px;
  margin-top: 20px;
}

.modal-info p {
  margin: 0 0 10px 0;
  font-weight: bold;
  color: #2e4519;
}

.modal-info ul {
  margin: 0;
  padding-left: 20px;
  color: #2e4519;
}

.modal-info li {
  margin-bottom: 5px;
}

/* Responsive modal */
@media (max-width: 700px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .modal-footer {
    flex-direction: column;
    gap: 10px;
  }
  
  .modal-footer .server-button {
    width: 100%;
  }
}
