/* ===== STORM THEME - Fury of the Storm (Storm's End / Shipbreaker Bay) ===== */
/* Dark, tempestuous Westeros theme: wind-driven rain, lightning flashes, and moody storm clouds */

/* ===== THEME VARIABLES ===== */
body.storm {
    --accent: #38bdf8;
    --gold: #7dd3fc;
    --accent-rgb: 56, 189, 248;
    --accent-dark: #0284c7;
    --accent-light: #bae6fd;
    --accent-hover: #0ea5e9;
    --bg-primary: #070b14;
    --bg-card: #0f172a;
    --bg-panel: #131d31;
    --bg-surface: #0a111e;
    --bg-dark: #172338;
    --bg-border: #1e293b;
    --bg-input: #111a28;
    --bg-darker: #04070e;
    --bg-mid: #152236;
    --bg-muted: #23354e;
    --text-default: #cbd5e1;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-dim: #475569;
    --income-color: #38bdf8;
    --positive-color: #34d399;
    --danger-light: #f87171;
}

/* ===== RAIN LAYER 1 - Sleek Driving Rain Streaks (GPU Hardware Accelerated) ===== */
body.storm::before {
    content: '';
    position: fixed;
    top: -480px;
    left: -25vw;
    width: 150vw;
    height: calc(100vh + 960px);
    pointer-events: none;
    z-index: 9998;
    background-image:
        radial-gradient(0.9px 24px at 15% 12%, rgba(186, 230, 253, 0.4), transparent),
        radial-gradient(1px 32px at 42% 48%, rgba(224, 242, 254, 0.45), transparent),
        radial-gradient(0.8px 26px at 68% 22%, rgba(186, 230, 253, 0.35), transparent),
        radial-gradient(1.1px 36px at 88% 75%, rgba(224, 242, 254, 0.42), transparent),
        radial-gradient(0.9px 28px at 28% 85%, rgba(186, 230, 253, 0.38), transparent);
    background-size: 320px 480px;
    background-repeat: repeat;
    transform: translateZ(0);
    animation: storm-rain-heavy 0.65s linear infinite;
    opacity: 0.52;
    will-change: transform;
}

/* ===== RAIN LAYER 2 - Distant Subtle Mist & Sheet Rain (GPU Hardware Accelerated) ===== */
body.storm::after {
    content: '';
    position: fixed;
    top: -380px;
    left: -25vw;
    width: 150vw;
    height: calc(100vh + 760px);
    pointer-events: none;
    z-index: 9997;
    background-image:
        radial-gradient(0.7px 18px at 20% 25%, rgba(147, 197, 253, 0.25), transparent),
        radial-gradient(0.8px 22px at 58% 65%, rgba(186, 230, 253, 0.28), transparent),
        radial-gradient(0.7px 20px at 82% 15%, rgba(147, 197, 253, 0.22), transparent),
        radial-gradient(0.8px 24px at 35% 82%, rgba(186, 230, 253, 0.25), transparent);
    background-size: 260px 380px;
    background-repeat: repeat;
    transform: translateZ(0);
    animation: storm-rain-light 0.48s linear infinite;
    opacity: 0.35;
    will-change: transform;
}

/* Seamless infinite GPU compositor rain streams (Zero CPU repaints / 60+ FPS) */
@keyframes storm-rain-heavy {
    0% {
        transform: rotate(-13deg) translate3d(0, 0, 0);
    }
    100% {
        transform: rotate(-13deg) translate3d(0, 480px, 0);
    }
}

@keyframes storm-rain-light {
    0% {
        transform: rotate(-19deg) translate3d(0, 0, 0);
    }
    100% {
        transform: rotate(-19deg) translate3d(0, 380px, 0);
    }
}

/* Dynamic storm wind gusts (Atmospheric cloud & mist drift) */
@keyframes storm-wind-gust {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(-18px, 0, 0);
    }
    100% {
        transform: translate3d(12px, 0, 0);
    }
}

@keyframes storm-wind-gust-alt {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(14px, 0, 0);
    }
    100% {
        transform: translate3d(-10px, 0, 0);
    }
}

/* ===== AMBIENT LIGHTNING FLASH OVERLAY ===== */
body.storm .app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9996;
    background: radial-gradient(circle at 68% 14%, rgba(215, 235, 255, 0.35) 0%, rgba(147, 197, 253, 0.18) 35%, rgba(56, 189, 248, 0.06) 70%, transparent 100%);
    opacity: 0;
    transform: translateZ(0);
    animation: storm-lightning-flash 16s ease-out infinite;
    will-change: opacity;
}

/* Realistic double-strike distant thunderstorm lightning flash */
@keyframes storm-lightning-flash {
    0%, 91.5% {
        opacity: 0;
    }
    92.0% {
        opacity: 0.75;
    }
    92.4% {
        opacity: 0.15;
    }
    92.9% {
        opacity: 0.95;
    }
    93.8% {
        opacity: 0.28;
    }
    94.8% {
        opacity: 0.08;
    }
    96.0%, 100% {
        opacity: 0;
    }
}

/* ===== TEMPEST MIST & STORM CLOUDS at bottom ===== */
body.storm .app-container::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: -20px;
    right: -20px;
    height: 28vh;
    pointer-events: none;
    z-index: 9995;
    background: linear-gradient(to top,
        rgba(10, 17, 30, 0.5) 0%,
        rgba(19, 29, 49, 0.2) 60%,
        transparent 100%
    );
    transform: translateZ(0);
    animation: storm-wind-gust 12s ease-in-out infinite alternate;
    will-change: transform;
}

/* ===== HEADER - Storm Arc & Lightning Line ===== */
body.storm .game-header {
    border-color: rgba(56, 189, 248, 0.22);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

body.storm .game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(56, 189, 248, 0.06),
        rgba(186, 230, 253, 0.18),
        rgba(56, 189, 248, 0.06),
        transparent
    );
    transform: translate3d(-150%, 0, 0);
    animation: storm-header-arc 7s ease-in-out infinite;
    will-change: transform;
}

@keyframes storm-header-arc {
    0% {
        transform: translate3d(-150%, 0, 0);
    }
    35% {
        transform: translate3d(250%, 0, 0);
    }
    100% {
        transform: translate3d(250%, 0, 0);
    }
}

/* Electric glow line at header bottom */
body.storm .game-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(56, 189, 248, 0.15) 20%,
        rgba(125, 211, 252, 0.6) 50%,
        rgba(56, 189, 248, 0.15) 80%,
        transparent 100%
    );
    z-index: 1;
}

body.storm .logo-icon {
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.35));
}

body.storm .header-year,
body.storm .header-season {
    border-color: rgba(56, 189, 248, 0.22);
    background: rgba(56, 189, 248, 0.06);
}

body.storm .header-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
}

/* ===== CARDS ===== */
body.storm .card {
    border-color: rgba(56, 189, 248, 0.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

body.storm .card:hover {
    border-color: rgba(56, 189, 248, 0.28);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45),
                0 0 16px rgba(56, 189, 248, 0.08);
}

body.storm .card-header {
    border-right-color: rgba(56, 189, 248, 0.4);
}

/* ===== STATUS BAR ===== */
body.storm .status-bar-new {
    border-color: rgba(56, 189, 248, 0.15);
}

body.storm .status-item:hover {
    background: rgba(56, 189, 248, 0.08);
}

/* ===== NAVIGATION ===== */
body.storm .bottom-nav {
    border-color: rgba(56, 189, 248, 0.14);
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.5);
}

body.storm .nav-btn.active {
    background: rgba(56, 189, 248, 0.16);
    color: var(--accent);
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

body.storm .nav-btn:hover:not(.active) {
    color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

/* ===== MODALS ===== */
body.storm .modal-container {
    border-color: rgba(56, 189, 248, 0.25);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7),
                0 0 25px rgba(56, 189, 248, 0.08);
}

body.storm .modal-container h3 {
    border-right-color: rgba(56, 189, 248, 0.4);
}

/* ===== BUTTONS & WEST BONDS OVERRIDES ===== */
body.storm .btn,
body.storm .btn-primary {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #080c14;
    border: 1px solid rgba(56, 189, 248, 0.55);
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.35);
    text-shadow: none;
    font-weight: 700;
}

body.storm .btn:hover,
body.storm .btn-primary:hover {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 100%);
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.55), 0 0 12px rgba(56, 189, 248, 0.3);
    border-color: #7dd3fc;
    color: #050811;
}

body.storm .btn-secondary {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

body.storm .btn-secondary:hover {
    border-color: #7dd3fc;
    background: rgba(56, 189, 248, 0.22);
    color: #ffffff;
    box-shadow: 0 2px 14px rgba(56, 189, 248, 0.35);
}

body.storm .btn-sm,
body.storm .btn-small {
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.38);
    color: #e0f2fe;
}

body.storm .btn-sm:hover,
body.storm .btn-small:hover {
    background: rgba(56, 189, 248, 0.28);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.4);
}

body.storm .btn-sm.btn-primary,
body.storm .btn-small.btn-primary {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%) !important;
    color: #080c14 !important;
    border: 1px solid rgba(56, 189, 248, 0.55) !important;
}

body.storm .btn-sm.btn-secondary,
body.storm .btn-small.btn-secondary,
body.storm .btn-sm-secondary {
    background: rgba(56, 189, 248, 0.12) !important;
    border: 1px solid rgba(56, 189, 248, 0.38) !important;
    color: #7dd3fc !important;
}

body.storm .preset-btn-sm {
    border-color: rgba(56, 189, 248, 0.32);
    color: #7dd3fc;
    background: rgba(8, 12, 20, 0.85);
}

body.storm .preset-btn-sm:hover {
    border-color: #38bdf8;
    color: #ffffff;
    background: rgba(56, 189, 248, 0.24);
}

/* West Bonds Card (اوراق قرضه طوفانی) */
body.storm #westBondsEconomyCard {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.14) 0%, rgba(8, 12, 20, 0.96) 100%);
    border-color: rgba(56, 189, 248, 0.42);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 14px rgba(56, 189, 248, 0.1);
}

body.storm #westBondsEconomyCard .card-title,
body.storm #westBondsEconomyCard .eco-bonds-card-title {
    color: #7dd3fc;
    border-right-color: #38bdf8;
}

body.storm #westBondsEconomyCard #ecoBondsTotal,
body.storm #westBondsEconomyCard .eco-bonds-total-badge {
    color: #e0f2fe;
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
}

body.storm #westBondsEconomyCard .eco-bonds-picker-btn {
    background: rgba(8, 12, 20, 0.9);
    border-color: rgba(56, 189, 248, 0.35);
    color: #e0f2fe;
}

body.storm #westBondsEconomyCard .eco-bonds-picker-btn:hover {
    border-color: #7dd3fc;
    background: rgba(56, 189, 248, 0.18);
}

body.storm #westBondsEconomyCard .eco-bonds-picker-btn i {
    color: #7dd3fc;
}

body.storm #westBondsEconomyCard .eco-bonds-input {
    background: rgba(5, 8, 14, 0.95);
    border-color: rgba(56, 189, 248, 0.35);
    color: #fff;
}

body.storm #westBondsEconomyCard .eco-bonds-redeem-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%) !important;
    color: #080c14 !important;
    box-shadow: 0 2px 14px rgba(56, 189, 248, 0.45);
}

body.storm #westBondsEconomyCard .eco-bonds-redeem-btn:hover {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 100%) !important;
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.6);
}

/* ===== INPUTS ===== */
body.storm input:focus,
body.storm select:focus,
body.storm textarea:focus {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

/* ===== TABLES ===== */
body.storm th {
    background: rgba(56, 189, 248, 0.08);
    color: var(--accent);
    border-bottom-color: rgba(56, 189, 248, 0.18);
}

body.storm tr:hover td {
    background: rgba(56, 189, 248, 0.04);
}

/* ===== TOGGLE ===== */
body.storm .toggle-switch span:first-child {
    background-color: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* ===== SCROLLBAR ===== */
body.storm ::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.25);
    border-radius: 4px;
}

body.storm ::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.45);
}

/* ===== STORM THEME - ECONOMY & TOME MODAL OVERRIDES ===== */
body.storm #customGenericAppModalCard.eco-tome-modal-card {
    background: linear-gradient(180deg, #0d1624 0%, #080d16 100%) !important;
    border: 2px solid #2a4365 !important;
    outline: 1px solid rgba(56, 189, 248, 0.25) !important;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.95), 0 0 32px rgba(56, 189, 248, 0.18) !important;
}

body.storm #customGenericAppModalCard.eco-tome-modal-card > div:first-child {
    background: linear-gradient(180deg, #132034 0%, #0c1524 100%) !important;
    border-bottom: 2px solid #2a4365 !important;
    box-shadow: inset 0 1px 0 rgba(125, 211, 252, 0.2), 0 3px 10px rgba(0, 0, 0, 0.6) !important;
}

body.storm #customGenericAppModalCard.eco-tome-modal-card #customGenericAppModalTitle {
    color: #bae6fd !important;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5) !important;
}

body.storm .eco-tome-ribbon-bar,
body.storm .eco-modal-bookmarks {
    background: linear-gradient(180deg, #101c2d 0%, #09111c 100%);
    border-bottom: 2px solid #1e3a5f;
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.4);
}

body.storm .eco-bookmark-btn .ribbon-stitch {
    background: repeating-linear-gradient(90deg, #38bdf8 0px, #38bdf8 3px, transparent 3px, transparent 6px);
}

body.storm .eco-tome-page-content {
    background: radial-gradient(circle at 50% 0%, rgba(20, 35, 58, 0.45) 0%, rgba(7, 12, 20, 0.92) 100%);
}

body.storm .eco-tome-footer {
    background: linear-gradient(180deg, #101c2d 0%, #09111c 100%);
    border-top: 1.5px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.5);
}

body.storm .eco-tome-close-btn {
    background: linear-gradient(180deg, #19273c 0%, #0f1826 100%);
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    color: #bae6fd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.storm .eco-tome-close-btn:hover {
    background: linear-gradient(180deg, #223755 0%, #152336 100%);
    border-color: #38bdf8;
    color: #fff;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}

body.storm .btn-eco-modal-action {
    background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
    border: 1.5px solid #38bdf8;
    color: #f0f9ff;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

body.storm .btn-eco-modal-action:hover {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    border-color: #7dd3fc;
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    color: #fff;
}

body.storm .btn-eco-modal-action:active {
    box-shadow: 0 2px 6px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.storm .btn-eco-inline-info {
    color: #38bdf8;
}

body.storm .btn-eco-inline-info:hover {
    color: #bae6fd;
}

body.storm #eraEconomyBanner {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18) 0%, rgba(56, 189, 248, 0.05) 100%) !important;
    border: 1px solid rgba(56, 189, 248, 0.32) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

body.storm #eraEconomyBanner #ecoEraName {
    color: #bae6fd !important;
}

body.storm .buffs-summary-box {
    background: rgba(56, 189, 248, 0.07) !important;
    border-color: rgba(56, 189, 248, 0.25) !important;
}

body.storm .eco-building-summary-header {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(56, 189, 248, 0.04)) !important;
    border-color: rgba(56, 189, 248, 0.28) !important;
}

body.storm .buff-card {
    background: rgba(56, 189, 248, 0.06) !important;
    border-color: rgba(56, 189, 248, 0.22) !important;
}

body.storm .buff-kpi-chip {
    background: rgba(15, 23, 42, 0.7) !important;
    border-color: rgba(56, 189, 248, 0.22) !important;
}

body.storm .eco-building-item-card {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(56, 189, 248, 0.15);
}

body.storm .eco-building-item-card:hover {
    border-color: rgba(56, 189, 248, 0.38);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.1);
}

body.storm .eco-res-chip.wood {
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    border-color: rgba(56, 189, 248, 0.28);
}

body.storm .eco-fin-kpi-item {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(56, 189, 248, 0.16);
}

body.storm .eco-fin-kpi-item.income {
    border-color: rgba(52, 211, 153, 0.35);
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.12) 0%, rgba(52, 211, 153, 0.02) 100%);
}

body.storm .eco-fin-kpi-item.cost {
    border-color: rgba(248, 113, 113, 0.35);
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.12) 0%, rgba(248, 113, 113, 0.02) 100%);
}

/* ===== ACCESSIBILITY & REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    body.storm::before,
    body.storm::after,
    body.storm .app-container::before,
    body.storm .app-container::after,
    body.storm .game-header::before {
        animation: none !important;
    }
}
