/* ============================================================
   RUST SERVER MONITOR — Post-Apo Industrial Theme
   ============================================================ */

:root {
    --rust-orange:   #C84B11;
    --rust-light:    #E8671E;
    --rust-glow:     #FF7A2F;
    --rust-dark:     #8B3009;
    --metal-bg:      #0D0D0B;
    --metal-surface: #141410;
    --metal-panel:   #1A1A15;
    --metal-border:  #2A2A20;
    --metal-accent:  #333325;
    --text-primary:  #D4C5A0;
    --text-secondary:#8A7D65;
    --text-dim:      #4A4535;
    --danger-red:    #CC2222;
    --safe-green:    #4CAF50;
    --warning-amber: #FFA000;
    --panel-radius:  2px;
    --font-mono:     'Share Tech Mono', monospace;
    --font-display:  'Bebas Neue', sans-serif;
    --font-body:     'Oswald', sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--metal-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== Grain texture overlay ===== */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px;
}

/* ===== Scanlines ===== */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== Header ===== */
.header {
    border-bottom: 2px solid var(--rust-orange);
    background: var(--metal-surface);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 24px rgba(200,75,17,0.25);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--rust-orange);
    animation: pulse-glow 2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px var(--rust-glow));
    line-height: 1;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 6px var(--rust-glow)); }
    50%       { filter: drop-shadow(0 0 20px var(--rust-glow)); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--rust-orange);
    letter-spacing: 0.15em;
    text-shadow: 0 0 20px rgba(232,103,30,0.4);
}

.logo-sub {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-top: 2px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: all 0.4s ease;
}

.status-dot.online  { background: var(--safe-green); box-shadow: 0 0 8px var(--safe-green); animation: blink 2s ease-in-out infinite; }
.status-dot.offline { background: var(--danger-red); box-shadow: 0 0 8px var(--danger-red); }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ===== Search section ===== */
.search-section {
    background: var(--metal-panel);
    border-bottom: 1px solid var(--metal-border);
    padding: 1.2rem 0;
}

.search-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    min-width: 200px;
}

.search-field--small { flex: 0 0 140px; min-width: 120px; }

.field-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
}

.input-field {
    background: var(--metal-bg);
    border: 1px solid var(--metal-border);
    border-radius: var(--panel-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.input-field:focus {
    border-color: var(--rust-orange);
    box-shadow: 0 0 0 2px rgba(200,75,17,0.2);
}

.btn-query {
    background: var(--rust-orange);
    border: none;
    border-radius: var(--panel-radius);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    padding: 0.6rem 1.6rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    white-space: nowrap;
    align-self: flex-end;
}

.btn-query:hover {
    background: var(--rust-light);
    box-shadow: 0 0 16px rgba(232,103,30,0.5);
}

.btn-query:active { transform: scale(0.97); }

.btn-icon { margin-right: 0.3rem; }

.refresh-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-refresh-toggle {
    background: var(--metal-accent);
    border: 1px solid var(--metal-border);
    border-radius: 2px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh-toggle.active {
    background: rgba(76,175,80,0.15);
    border-color: var(--safe-green);
    color: var(--safe-green);
}

.next-refresh { color: var(--text-dim); }

/* ===== Main content ===== */
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* Loading */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 6rem 0;
}

.loading-spinner {
    font-size: 4rem;
    color: var(--rust-orange);
    animation: spin 2s linear infinite;
    filter: drop-shadow(0 0 12px var(--rust-glow));
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    40%       { opacity: 0.6; }
    60%       { opacity: 0.9; }
}

/* Error panel */
.error-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 4rem 2rem;
    text-align: center;
}

.error-icon { font-size: 3rem; color: var(--danger-red); }
.error-title { font-family: var(--font-display); font-size: 2rem; color: var(--danger-red); letter-spacing: 0.1em; }
.error-msg { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); }
.error-tip { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.5rem; }

/* ===== Panels grid ===== */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.2rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

.panel--wide { grid-column: 1 / -1; }

/* ===== Panel ===== */
.panel {
    background: var(--metal-panel);
    border: 1px solid var(--metal-border);
    border-radius: var(--panel-radius);
    overflow: hidden;
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--rust-dark), var(--rust-orange), var(--rust-dark));
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--metal-border);
    background: rgba(0,0,0,0.2);
}

.panel-icon { font-size: 1rem; }

.panel-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    color: var(--text-primary);
}

.panel-badge {
    margin-left: auto;
    background: rgba(76,175,80,0.15);
    border: 1px solid var(--safe-green);
    color: var(--safe-green);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
}

.panel-body { padding: 1.2rem; }

/* ===== Info grid ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.info-item { }

.info-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    margin-bottom: 0.3rem;
}

.info-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.info-value--large {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--rust-light);
}

/* ===== Tags ===== */
.tags-section { margin-top: 0.5rem; }

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.tag {
    background: var(--metal-accent);
    border: 1px solid var(--metal-border);
    border-radius: 2px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    letter-spacing: 0.05em;
}

/* ===== Player gauge ===== */
.player-gauge {
    text-align: center;
    margin-bottom: 1.5rem;
}

.gauge-numbers {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.2rem;
}

.gauge-current {
    font-family: var(--font-display);
    font-size: 4rem;
    color: var(--rust-orange);
    line-height: 1;
    text-shadow: 0 0 20px rgba(232,103,30,0.4);
}

.gauge-sep {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text-dim);
}

.gauge-max {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text-secondary);
}

.gauge-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    margin: 0.3rem 0 0.8rem;
}

.gauge-bar-wrap {
    background: var(--metal-accent);
    border-radius: 2px;
    height: 8px;
    overflow: hidden;
    margin: 0 1rem;
}

.gauge-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--rust-dark), var(--rust-orange));
    transition: width 0.8s ease;
    box-shadow: 2px 0 12px rgba(232,103,30,0.5);
}

.gauge-percent {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
}

/* ===== Player list ===== */
.player-list-header {
    display: grid;
    grid-template-columns: 1fr 80px 100px;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid var(--metal-border);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
}

.player-list {
    max-height: 240px;
    overflow-y: auto;
}

.player-list::-webkit-scrollbar { width: 4px; }
.player-list::-webkit-scrollbar-track { background: var(--metal-bg); }
.player-list::-webkit-scrollbar-thumb { background: var(--rust-dark); border-radius: 2px; }

.player-row {
    display: grid;
    grid-template-columns: 1fr 80px 100px;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid rgba(42,42,32,0.4);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: background 0.15s;
}

.player-row:hover { background: rgba(200,75,17,0.06); }

.player-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-score { color: var(--text-secondary); text-align: right; }
.player-duration { color: var(--text-dim); text-align: right; font-size: 0.72rem; }

.no-players {
    text-align: center;
    padding: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ===== World grid ===== */
.world-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.world-item {
    background: var(--metal-bg);
    border: 1px solid var(--metal-border);
    border-radius: var(--panel-radius);
    padding: 0.8rem;
    text-align: center;
    transition: border-color 0.2s;
}

.world-item:hover { border-color: var(--rust-dark); }

.world-icon { font-size: 1.2rem; margin-bottom: 0.4rem; }
.world-label { font-family: var(--font-mono); font-size: 0.55rem; color: var(--text-dim); letter-spacing: 0.15em; margin-bottom: 0.3rem; }
.world-value { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-primary); font-weight: 500; }

/* ===== Wipe section ===== */
.wipe-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    border-top: 1px solid var(--metal-border);
    padding-top: 1rem;
}

.wipe-item {
    background: rgba(200,75,17,0.06);
    border: 1px solid rgba(200,75,17,0.2);
    border-radius: var(--panel-radius);
    padding: 0.7rem 1rem;
}

.wipe-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--rust-dark); letter-spacing: 0.15em; margin-bottom: 0.3rem; }
.wipe-value { font-family: var(--font-mono); font-size: 0.85rem; color: var(--rust-light); }

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--metal-border);
    background: var(--metal-surface);
    padding: 1rem 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
}

.footer .container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.footer-sep { color: var(--rust-dark); }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .panels { grid-template-columns: 1fr; }
    .panel--wide { grid-column: 1; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .world-grid { grid-template-columns: repeat(2, 1fr); }
    .wipe-section { grid-template-columns: 1fr; }
    .logo-title { font-size: 1.6rem; }
    .search-bar { flex-direction: column; }
    .btn-query { width: 100%; }
}

@media (max-width: 480px) {
    .info-grid { grid-template-columns: 1fr; }
    .gauge-current { font-size: 3rem; }
}
