/* WarGrid - Global Design System */

:root {
    --wg-style-version: 20260214;
    --bg-black: #000000;
    --bg-dark: #0d0d0d;
    --bg-card: #1a1a1a;
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --accent-red: #e74c3c;
    --accent-gold: #f1c40f;
    --border-dim: #333333;
    --font-main: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html, body { height: 100%; }
body {
    background-color: var(--bg-black);
    color: var(--text-main);
    font-family: var(--font-main), "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji";
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

/* Header & Navigation */
header {
    background-color: var(--bg-dark);
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-dim);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.nav-toggle {
    display: none;
    width: 40px;
    height: 36px;
    border: 1px solid #2d2d2d;
    background: #111;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #ddd;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#logo a {
    font-size: 1.25rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-red);
    text-decoration: none;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}
#logo .brand-name { white-space: nowrap; }
#logo .brand-version {
    white-space: nowrap;
    opacity: 0.72;
    font-size: 0.85em;
}
.logo-img {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin-right: 6px;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

nav ul li a:hover {
    color: var(--accent-gold);
}

.nav-player-count {
    color: #888;
    margin-left: 20px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding-top: 2px;
}

/* Footer */
.site-footer {
    background: #0b0b0b;
    color: #aaa;
    border-top: 1px solid #222;
    padding: 20px 0;
    margin-top: auto;
}
.site-footer a { color: #aaa; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.footer-brand {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
}

/* Auth Pages (Login, Signup, etc) */
.auth-wrapper {
    min-height: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
}

.card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-dim) !important;
    color: var(--text-main) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.form-control {
    background-color: #000 !important;
    border: 1px solid var(--border-dim) !important;
    color: var(--text-main) !important;
    padding: 12px !important;
}

.form-control:focus {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 0.25rem rgba(231, 76, 60, 0.25) !important;
}

.btn-primary {
    background-color: var(--accent-red) !important;
    border-color: var(--accent-red) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    padding: 12px !important;
}

.btn-primary:hover {
    background-color: #c0392b !important;
    border-color: #c0392b !important;
}

.btn-outline-light:hover {
    color: #000 !important;
}

/* Utility */
.text-accent { color: var(--accent-red); }
.text-gold { color: var(--accent-gold); }
.border-accent { border-color: var(--accent-red) !important; }

/* Dashboard Cards */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-left: 4px solid var(--border-dim);
    transition: transform 0.2s, border-color 0.2s;
}

.game-card:hover {
    transform: translateX(5px);
    border-color: #555;
}

.game-card.active { border-left-color: #27ae60; }
.game-card.open { border-left-color: var(--accent-gold); }
.game-card.pending { border-left-color: #3498db; }

/* Dashboard & Hero */
.hero-section {
    background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.8)), url('../images/hero_bg.jpg'); 
    background-size: cover;
    background-position: center;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-bottom: 1px solid var(--border-dim);
}

.hero-content h1 { 
    font-size: 4rem; 
    text-transform: uppercase; 
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.5); 
    font-weight: 300;
}

.feature-box { 
    background: var(--bg-card); 
    padding: 30px; 
    border-radius: 8px; 
    border: 1px solid var(--border-dim); 
    height: 100%; 
    transition: transform 0.2s, border-color 0.2s; 
}

.feature-box:hover { 
    transform: translateY(-5px); 
    border-color: #555; 
}

.dashboard-container { 
    padding: 40px 20px; 
    max-width: 1200px; 
    margin: 0 auto; 
}

/* Game Interface */
.game-wrapper { 
    display: flex; 
    flex: 1; 
    overflow: hidden; 
    position: relative; 
    min-height: 0;
}

#map-container { 
    flex-grow: 1; 
    position: relative; 
    background: #000; 
    overflow: hidden; 
    min-height: 0;
}

canvas { 
    background: #111; 
    display: block; 
    width: 100%;
    height: 100%;
    touch-action: none;
}

#sidebar { 
    width: 280px; 
    background: var(--bg-dark); 
    border-left: 1px solid var(--border-dim); 
    display: flex; 
    flex-direction: column; 
    z-index: 10; 
    flex-shrink: 0; 
}

.sb-panel { 
    padding: 20px; 
    border-bottom: 1px solid var(--border-dim); 
}

.sb-panel h6 { 
    color: var(--text-muted); 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 1px; 
    margin-bottom: 15px; 
}

.hud-stat { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 8px; 
    font-size: 0.9rem; 
}

.hud-val { 
    font-weight: bold; 
    font-family: 'Courier New', Courier, monospace; 
}

#report-footer { 
    height: 200px; 
    max-height: 35vh;
    background: #0a0a0a; 
    border-top: 1px solid var(--border-dim); 
    overflow-y: auto; 
    padding: 15px; 
    flex-shrink: 0; 
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
}

#report-footer .report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

#report-toggle-mobile {
    display: none !important;
}

#report-footer.collapsed {
    height: 44px;
    max-height: 44px;
    overflow: hidden;
}

#report-footer.collapsed #finance-log {
    display: none;
}

.turn-card { 
    background: #151515; 
    border: 1px solid var(--border-dim); 
    border-left: 3px solid #444; 
    margin-bottom: 8px; 
    border-radius: 4px; 
}

.val-pos { color: #2ecc71; }
.val-neg { color: var(--accent-red); }

@media (max-width: 768px) {
    /* Mobile top spacing for pages using the fixed/sticky global header.
       Applies to war-bg pages only (game.php is excluded). */
    body.war-bg > #site-header + *:not(.war-effects) {
        margin-top: 10px;
    }
    body.war-bg > #site-header + .war-effects + * {
        margin-top: 10px;
    }

    .game-wrapper { flex-direction: column; }
    #sidebar { display: none; }
    header { padding: 10px 12px; gap: 8px; position: sticky; }
    #logo { min-width: 0; flex: 1; }
    #logo a { font-size: 1rem; letter-spacing: 1px; display: inline-flex; align-items: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .logo-img { height: 20px; }
    .nav-toggle { display: inline-flex; }
    nav#site-nav {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        max-height: 0;
        overflow: hidden;
        background: #0b0b0b;
        border-bottom: 1px solid #212121;
        transition: max-height 0.22s ease;
        z-index: 1001;
    }
    header.nav-open nav#site-nav { max-height: 70vh; overflow-y: auto; }
    nav#site-nav ul { display: block; padding: 6px 12px 12px; }
    nav#site-nav ul li { margin: 0; border-top: 1px solid #1f1f1f; }
    nav#site-nav ul li a { display: block; padding: 12px 4px; font-size: 0.9rem; }
    nav#site-nav ul .nav-player-count {
        margin-left: 0;
        padding: 12px 4px;
        font-size: 0.78rem;
    }
    #report-footer { height: 90px; max-height: 22vh; padding: 10px 12px; }
    #targeting-mode { top: 0; position: fixed; }
    #report-toggle { display: none; }
}

@media (max-width: 480px) {
    header { padding: 8px 10px; }
    #logo a { font-size: 0.92rem; letter-spacing: 0.6px; }
    #logo .brand-version { display: none; }
    .logo-img { height: 18px; margin-right: 5px; }
    nav#site-nav ul { padding: 4px 10px 10px; }
    nav#site-nav ul li a { padding: 10px 2px; font-size: 0.84rem; letter-spacing: 0.7px; }
    nav#site-nav ul .nav-player-count { padding: 10px 2px; font-size: 0.72rem; }
    .nav-toggle { width: 36px; height: 34px; border-radius: 7px; }
}

@media (max-width: 375px) {
    #logo a { font-size: 0.84rem; letter-spacing: 0.4px; }
    .logo-img { height: 16px; margin-right: 4px; }
}

/* Footer */
footer {
    background-color: var(--bg-dark);
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-dim);
    font-size: 0.8rem;
}
