/* Hegemon Game Styles - Dark theme matching landing page */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

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

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a25;
    --accent: #e63946;
    --accent-glow: rgba(230, 57, 70, 0.3);
    --gold: #d4a843;
    --gold-glow: rgba(212, 168, 67, 0.2);
    --text: #e8e8ec;
    --text-dim: #8a8a99;
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --green: #4ade80;
    --pink: #f472b6;
    --amber: #fbbf24;
    --blue: #60a5fa;
    --red: #ef4444;
}

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

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* Background */
.game-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(230, 57, 70, 0.03) 0%, transparent 70%),
        radial-gradient(circle at 30% 70%, rgba(212, 168, 67, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.game-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== TOP NAV ===== */
.game-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.game-nav .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
}

.game-nav .logo span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ===== SCREEN VISIBILITY ===== */
.screen { display: none; }
.screen.active { display: block; }

/* ===== COUNTRY SELECTION SCREEN ===== */
.select-header {
    text-align: center;
    margin-bottom: 2rem;
}

.select-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.select-header h1 .accent { color: var(--accent); }

.select-header p {
    color: var(--text-dim);
    font-size: 1rem;
}

/* Search & Filters */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-wrap {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 18px;
    height: 18px;
}

#search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--text-dim);
}

.continent-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.continent-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.continent-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.continent-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Country count */
.country-count {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.country-count span {
    color: var(--gold);
    font-weight: 600;
}

/* Countries Grid */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.country-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.country-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.country-card .flag {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.6rem;
    display: block;
}

.country-card .name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.4rem;
    line-height: 1.2;
    min-height: 2em;
}

.country-card .stats-preview {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    margin-top: 0.4rem;
}

.country-card .mini-stat {
    font-size: 0.65rem;
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* ===== DASHBOARD SCREEN ===== */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

/* Dashboard Header */
.dash-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-country {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-country .flag {
    font-size: 3rem;
    line-height: 1;
}

.dash-country .info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dash-country .info .subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.dash-meta {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.dash-meta-item {
    text-align: center;
}

.dash-meta-item .value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.dash-meta-item .value.score { color: var(--gold); }
.dash-meta-item .value.turn { color: var(--accent); }

.dash-meta-item .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Main panel */
.dash-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Meters */
.meters-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.meters-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 1.2rem;
}

.meter {
    margin-bottom: 1rem;
}

.meter:last-child { margin-bottom: 0; }

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

.meter-label {
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.meter-label .icon { font-size: 1rem; }

.meter-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
}

.meter-bar {
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
    position: relative;
}

.meter-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2));
    border-radius: 5px;
}

.meter.economy .meter-fill { background: var(--green); }
.meter.economy .meter-value { color: var(--green); }
.meter.health .meter-fill { background: var(--pink); }
.meter.health .meter-value { color: var(--pink); }
.meter.happiness .meter-fill { background: var(--amber); }
.meter.happiness .meter-value { color: var(--amber); }
.meter.military .meter-fill { background: var(--blue); }
.meter.military .meter-value { color: var(--blue); }

/* Change indicators */
.meter-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.meter-change.positive { color: var(--green); }
.meter-change.negative { color: var(--red); }

/* Event Log */
.events-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.events-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.event-log {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 200px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border-left: 3px solid var(--border-light);
    font-size: 0.85rem;
    line-height: 1.4;
}

.event-item.positive { border-left-color: var(--green); }
.event-item.negative { border-left-color: var(--red); }
.event-item.neutral { border-left-color: var(--blue); }

.event-turn {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.75rem;
    white-space: nowrap;
}

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

/* Sidebar */
.dash-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Policy Card */
.policy-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.policy-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 1.2rem;
}

/* Slider styles */
.slider-group {
    margin-bottom: 1rem;
}

.slider-group:last-of-type { margin-bottom: 0; }

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

.slider-label {
    font-size: 0.85rem;
    color: var(--text);
}

.slider-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gold);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-dark);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
}

/* Budget total */
.budget-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-top: 0.8rem;
    font-size: 0.85rem;
}

.budget-total .total-label { color: var(--text-dim); }
.budget-total .total-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--green);
}

.budget-total .total-value.over { color: var(--red); }

/* Government Type */
.gov-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.gov-option {
    padding: 0.8rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.gov-option:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
}

.gov-option.active {
    border-color: var(--accent);
    background: rgba(230, 57, 70, 0.1);
}

.gov-option .gov-icon {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    display: block;
}

.gov-option .gov-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
}

.gov-option .gov-desc {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
    line-height: 1.3;
}

/* End Turn Button */
.end-turn-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), #c62828);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.end-turn-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.end-turn-btn:active {
    transform: translateY(0);
}

.end-turn-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.end-turn-btn:hover::after {
    left: 100%;
}

/* Back button */
.back-btn {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* Population & GDP display */
.country-stats-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.country-stat-item {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.country-stat-item span {
    color: var(--text);
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .dash-header {
        flex-direction: column;
        text-align: center;
    }

    .dash-country {
        flex-direction: column;
    }

    .dash-meta {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .game-content {
        padding: 1rem;
    }

    .countries-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.5rem;
    }

    .country-card {
        padding: 0.8rem 0.6rem;
    }

    .country-card .flag {
        font-size: 2rem;
    }

    .country-card .name {
        font-size: 0.75rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-input-wrap {
        width: 100%;
    }

    .continent-filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .gov-types {
        grid-template-columns: 1fr;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.country-card {
    animation: fadeIn 0.3s ease forwards;
}

.event-item {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Turn transition overlay */
.turn-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.turn-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.turn-overlay-content {
    text-align: center;
}

.turn-overlay-content h2 {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.turn-overlay-content p {
    color: var(--text-dim);
    font-size: 1rem;
}
