/* ================================================================
   css/main.css — EcoBalance
   Негізгі орналасу: header, панельдер, метрика, оқиғалар, значоктар
   Base layout: header, panels, metrics, events, badges.
   ================================================================ */

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

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #1a3a2f 50%, #0d2137 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #e0f2f1;
}

/* Фон бөлшектері / Background floating particles */
.bg-animation {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
}
.floating-particle {
    position: absolute; border-radius: 50%; opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}
.leaf {
    width: 20px; height: 20px;
    background: radial-gradient(circle, #4ade80 0%, #22c55e 100%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.recycle {
    width: 15px; height: 15px;
    background: #3b82f6; border-radius: 50%;
    animation: float 15s infinite ease-in-out, pulse 2s infinite;
}

/* ============ HEADER ============ */
.header {
    background: rgba(13,33,55,0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-bottom: 2px solid #4ade80;
    box-shadow: 0 4px 20px rgba(74,222,128,0.3);
    position: sticky; top: 0; z-index: 100;
}
.header-content {
    max-width: 1400px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
}
.logo { display: flex; align-items: center; gap: 15px; }
.logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    animation: rotate 10s linear infinite;
    box-shadow: 0 0 20px rgba(74,222,128,0.5);
}
.logo-text h1 {
    font-family: 'Orbitron', sans-serif; font-size: 28px;
    background: linear-gradient(135deg, #4ade80, #3b82f6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-transform: uppercase; letter-spacing: 2px;
}
.logo-text p { color: #94a3b8; font-size: 14px; }

/* Статистика жолағы / Stats bar */
.stats-bar { display: flex; gap: 30px; }
.stat-item {
    text-align: center; padding: 10px 20px;
    background: rgba(74,222,128,0.1);
    border: 1px solid rgba(74,222,128,0.3);
    border-radius: 10px; transition: all 0.3s;
}
.stat-item:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(74,222,128,0.3); }
.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px; font-weight: 700; color: #4ade80;
}
.stat-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; }
.stat-pop { animation: statPop 0.38s ease !important; }

/* ============ LAYOUT ============ */
.container { max-width: 1400px; margin: 0 auto; padding: 30px 20px; }
.game-section {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 25px; margin-bottom: 40px;
}
@media (max-width: 1200px) { .game-section { grid-template-columns: 1fr; } }

/* Панель / Panel card */
.panel {
    background: rgba(13,33,55,0.8);
    border: 1px solid rgba(74,222,128,0.2);
    border-radius: 20px; padding: 25px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.panel-title {
    font-family: 'Orbitron', sans-serif; font-size: 18px; color: #4ade80;
    margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
    text-transform: uppercase;
}

/* ============ METRICS ============ */
.metric { margin-bottom: 20px; }
.metric-header {
    display: flex; justify-content: space-between;
    margin-bottom: 8px; font-weight: 600;
}
.metric-bar {
    height: 12px; background: rgba(255,255,255,0.1);
    border-radius: 6px; overflow: hidden; position: relative;
}
.metric-fill {
    height: 100%; border-radius: 6px;
    transition: width 0.5s ease; position: relative; overflow: hidden;
}
.metric-fill::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}
.eco-fill       { background: linear-gradient(90deg, #4ade80, #22c55e); }
.pollution-fill { background: linear-gradient(90deg, #f87171, #ef4444); }
.energy-fill    { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.happiness-fill { background: linear-gradient(90deg, #a855f7, #8b5cf6); }

/* ============ EVENTS LOG ============ */
.events-list { max-height: 300px; overflow-y: auto; }
.event-item {
    padding: 12px; margin-bottom: 10px;
    background: rgba(255,255,255,0.05);
    border-left: 4px solid #4ade80;
    border-radius: 8px; font-size: 14px;
    animation: slideIn 0.3s ease; transition: all 0.3s;
}
.event-item:hover { background: rgba(255,255,255,0.1); transform: translateX(5px); }
.event-item.negative { border-left-color: #ef4444; background: rgba(239,68,68,0.1); }
.event-time { font-size: 11px; color: #94a3b8; margin-top: 5px; }

/* ============ BADGE ============ */
.badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e293b; border-radius: 20px; font-weight: 700; font-size: 14px;
    margin: 5px; animation: badgePulse 2s infinite;
}

/* ============ TOOLTIP ============ */
.tooltip { position: relative; }
.tooltip::after {
    content: attr(data-tip);
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    padding: 8px 12px; background: #0d2137; color: #4ade80;
    border: 1px solid #4ade80; border-radius: 8px;
    font-size: 12px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 10;
}
.tooltip:hover::after { opacity: 1; }

/* ============ SAVE TOAST ============ */
#saveToast {
    opacity: 0; transition: opacity 0.4s;
    font-size: 12px; color: #4ade80;
    font-family: 'Orbitron', sans-serif;
    padding: 4px 12px;
    background: rgba(74,222,128,0.1);
    border: 1px solid rgba(74,222,128,0.3);
    border-radius: 8px; pointer-events: none; white-space: nowrap;
}

/* ============ LEVEL UP POPUP ============ */
.levelup-popup {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(0.8);
    background: linear-gradient(135deg, #0d2137, #1a3a2f);
    border: 3px solid #4ade80; border-radius: 20px;
    padding: 40px 60px; font-family: 'Orbitron', sans-serif;
    text-align: center; z-index: 2000;
    opacity: 0; transition: opacity 0.4s, transform 0.4s;
    box-shadow: 0 20px 60px rgba(74,222,128,0.4);
    pointer-events: none;
}
.levelup-popup.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }

/* ============ QUEST LEVEL INDICATOR ============ */
.quest-level-info {
    margin-top: 10px; padding: 8px 12px;
    background: rgba(74,222,128,0.08);
    border-radius: 8px; font-size: 12px; color: #94a3b8;
    text-align: center;
    border: 1px solid rgba(74,222,128,0.15);
}

/* ============ LANGUAGE TOGGLE ============ */
.lang-toggle { display: flex; gap: 4px; align-items: center; }
.lang-btn {
    padding: 5px 10px;
    border: 1px solid rgba(74,222,128,0.25);
    background: transparent; color: #64748b;
    border-radius: 6px; cursor: pointer;
    font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 700;
    transition: all 0.2s;
}
.lang-btn:hover { border-color: #4ade80; color: #4ade80; }
.lang-btn.active {
    background: rgba(74,222,128,0.15);
    border-color: #4ade80; color: #4ade80;
}

/* ============ LEVEL LOCKED BUTTONS ============ */
.btn-wind    { background: linear-gradient(135deg, #22d3ee, #0891b2); color: white; }
.btn-park    { background: linear-gradient(135deg, #86efac, #16a34a); color: #1e293b; }
.btn-locked  { opacity: 0.4; cursor: not-allowed !important; filter: grayscale(0.6); }
.level-badge {
    display: inline-block; font-size: 10px;
    padding: 2px 6px;
    background: rgba(251,191,36,0.2);
    border: 1px solid #fbbf24; border-radius: 8px;
    color: #fbbf24; margin-left: 4px; vertical-align: middle;
}

/* ============ MUTE BUTTON ============ */
#muteBtn {
    padding: 6px 12px;
    border: 1px solid rgba(74,222,128,0.3);
    background: rgba(74,222,128,0.08);
    color: #4ade80; border-radius: 8px; cursor: pointer;
    font-size: 18px; line-height: 1; transition: all 0.2s;
}
#muteBtn:hover { background: rgba(74,222,128,0.18); transform: scale(1.1); }
#muteBtn.muted {
    border-color: rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.08); color: #f87171;
}

/* ============ DIFFICULTY BADGE (header) ============ */
#diffBadge {
    padding: 4px 12px; border-radius: 7px;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px; font-weight: 700;
    letter-spacing: 1px; white-space: nowrap;
}

/* ============ FLOAT NUMBERS ============ */
.float-num {
    position: fixed; font-family: 'Orbitron', sans-serif;
    font-size: 15px; font-weight: 700; white-space: nowrap;
    pointer-events: none; z-index: 4000;
    animation: floatNumUp 1.25s cubic-bezier(0.22,1,0.36,1) forwards;
    text-shadow: 0 0 10px currentColor, 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header-content { flex-direction: column; gap: 20px; }
    .stats-bar { flex-wrap: wrap; justify-content: center; }
    .controls-grid { grid-template-columns: 1fr; }
}
