/* QControl - Adapted from Laser Empire Armageddon theme */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;600&display=swap');

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-input: #1a1a25;
    --neon-red: #ff2d55;
    --neon-green: #39ff14;
    --neon-blue: #00d4ff;
    --neon-yellow: #ffea00;
    --neon-orange: #ff9500;
    --neon-purple: #bf00ff;
    --text-primary: #ffffff;
    --text-secondary: #8888aa;
    --border-glow: rgba(0, 212, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 80%;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(191, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 45, 85, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Announcement Bar */
.announcement-bar {
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue));
    padding: 0.15rem;
    text-align: center;
}

/* Header */
.header {
    background: linear-gradient(180deg, rgba(18, 18, 26, 0.95) 0%, rgba(10, 10, 15, 0.9) 100%);
    border-bottom: 1px solid var(--border-glow);
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-red), var(--neon-purple), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

/* Right side of the header: status badge + logged-in operator + logout */
.header-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Exo 2', sans-serif;
    color: var(--neon-blue);
    padding-left: 0.75rem;
    border-left: 1px solid rgba(0, 212, 255, 0.2);   /* subtle divider from the status badge */
}

.header-user-icon { opacity: 0.85; flex: 0 0 auto; }

.header-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.45);     /* neon glow, like the rest of the site */
    max-width: 14ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Matches the site button language (.btn-danger): neon border, glow + scale on hover. */
.header-logout {
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    text-decoration: none;
    color: var(--neon-red);
    background: rgba(255, 45, 85, 0.15);
    border: 1px solid var(--neon-red);
    transition: all 0.3s ease;
}

.header-logout:hover {
    background: rgba(255, 45, 85, 0.3);
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.4);
    transform: scale(1.04);
    color: #fff;
}

/* Status Badge */
.status-badge {
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}

.status-online {
    background: rgba(57, 255, 20, 0.15);
    color: var(--neon-green);
    border: 1px solid rgba(57, 255, 20, 0.3);
}

.status-offline {
    background: rgba(255, 45, 85, 0.15);
    color: var(--neon-red);
    border: 1px solid rgba(255, 45, 85, 0.3);
}

.status-warning {
    background: rgba(255, 234, 0, 0.15);
    color: var(--neon-yellow);
    border: 1px solid rgba(255, 234, 0, 0.3);
}

/* Online but recently missed a check-in (network unit health) — orange, distinct
   from the yellow .status-warning used for the game-cleanup phase. */
.status-degraded {
    background: rgba(255, 149, 0, 0.15);
    color: var(--neon-orange);
    border: 1px solid rgba(255, 149, 0, 0.3);
}

/* Sortable column headers (opt-in per <th> via class="srt"). */
th.srt { cursor: pointer; user-select: none; white-space: nowrap; }
th.srt:hover { color: var(--neon-blue); }
.sort-ind { font-size: 0.7em; opacity: 0.7; margin-left: 2px; }

/* Navigation */
.nav-bar {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-bar::-webkit-scrollbar {
    display: none;
}

.nav-item {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.1);
}

.nav-item.active {
    color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--border-glow);
}



/* Main Content */
.main-content {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Title */
.page-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(136, 136, 170, 0.15);
}

.card-title {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-blue);
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    color: var(--neon-blue);
}

.stat-value.red { color: var(--neon-red); }
.stat-value.green { color: var(--neon-green); }
.stat-value.yellow { color: var(--neon-yellow); }
.stat-value.purple { color: var(--neon-purple); }

.stat-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-glow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: rgba(0, 212, 255, 0.1);
}

th {
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--neon-blue);
    padding: 0.75rem 1rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(136, 136, 170, 0.1);
    color: var(--text-primary);
}

/* Direct child only: hovering a row must not wash cells of tables NESTED
   inside it (e.g. an expanded tournament detail row). */
tr:hover > td {
    background: rgba(0, 212, 255, 0.05);
}

/* Buttons */
.btn {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.6rem 1.2rem;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 1px;
}

.btn-primary {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.btn-primary:hover {
    background: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    transform: scale(1.02);
}

.btn-success {
    background: rgba(57, 255, 20, 0.15);
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.btn-success:hover {
    background: rgba(57, 255, 20, 0.3);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
    transform: scale(1.02);
}

.btn-danger {
    background: rgba(255, 45, 85, 0.15);
    border-color: var(--neon-red);
    color: var(--neon-red);
}

.btn-danger:hover {
    background: rgba(255, 45, 85, 0.3);
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.3);
    transform: scale(1.02);
}

.btn-warning {
    background: rgba(255, 234, 0, 0.15);
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
}

.btn-sm {
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.8rem 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* Inline Form Row */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-info {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--neon-blue);
}

.alert-success {
    background: rgba(57, 255, 20, 0.1);
    border-color: rgba(57, 255, 20, 0.3);
    color: var(--neon-green);
}

.alert-error {
    background: rgba(255, 45, 85, 0.1);
    border-color: rgba(255, 45, 85, 0.3);
    color: var(--neon-red);
}

.alert-warning {
    background: rgba(255, 234, 0, 0.1);
    border-color: rgba(255, 234, 0, 0.3);
    color: var(--neon-yellow);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-glow);
    padding-bottom: 0;
}

.tab {
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    text-decoration: none;
}

.tab:hover {
    color: var(--neon-blue);
}

.tab.active {
    color: var(--neon-blue);
    border-bottom-color: var(--neon-blue);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 2px solid var(--neon-blue);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Game-specific: Score Display */
.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
}

.score-team {
    text-align: center;
}

.score-value {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
}

.score-value.team-red { color: var(--neon-red); }
.score-value.team-green { color: var(--neon-green); }

.score-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.score-vs {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Timer Display */
.timer-display {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    color: var(--neon-yellow);
    letter-spacing: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-glow);
    padding: 1rem 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

.footer-content {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-brand {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: var(--neon-blue);
}

.footer-sep {
    margin: 0 0.5rem;
    opacity: 0.3;
}

/* Utility */
.text-red { color: var(--neon-red); }
.text-green { color: var(--neon-green); }
.text-blue { color: var(--neon-blue); }
.text-yellow { color: var(--neon-yellow); }
.text-purple { color: var(--neon-purple); }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Animations */
@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pulse { animation: pulse-glow 2s ease-in-out infinite; }

/* Responsive */
@media (max-width: 768px) {
    .header { padding: 0.75rem 1rem; }
    .main-content { padding: 1rem; }
    .nav-item { font-size: 0.7rem; padding: 0.4rem 0.6rem; }
    .score-value { font-size: 2rem; }
    .timer-display { font-size: 1.8rem; }
    .form-row { flex-direction: column; }
    /* Save width: hide the operator name + status text, keep the logout button. */
    .header-user-name { display: none; }
}

/* Network-unit battery reading with no fresh report for >30s: keep the last
   value visible but dark grey (overrides the green/yellow/red SOC color). */
.nu-batt.batt-stale {
    color: #555 !important;
}
