/* ============================================ */
/* UI-BARS.CSS - Top Bar, Bottom Bar,          */
/* Pause Overlay                               */
/* Design 1: Clean Flat                        */
/* ============================================ */

/* ============================================ */
/* TOP BAR                                     */
/* ============================================ */
.topbar {
    width: 1280px;
    height: 75px;
    display: flex;
    align-items: center;
    background: #0c0c18;
    border-bottom: 1px solid #1a1a2e;
    padding: 0 20px;
    gap: 20px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 950;
    font-family: 'Segoe UI', Arial, sans-serif;
    pointer-events: auto;
}

/* --- Building Count Indicator --- */
.topbar-building-count {
    font-size: 17px;
    color: #8899aa;
    font-weight: normal;
    white-space: nowrap;
    margin-left: auto;
}
.topbar-building-count.limit-warning {
    color: #ff6644;
    font-weight: bold;
}

/* --- Coins Group --- */
.topbar-coins {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar-coin-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffd700 0%, #ffec80 30%, #ffd700 50%, #b8860b 100%);
    border: 2px solid #daa520;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.4), inset 0 -2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
    position: relative;
    transform-style: preserve-3d;
    animation: topbarCoinSpin 3s linear infinite;
}
@keyframes topbarCoinSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}
.topbar-coin-val {
    font-size: 26px;
    font-weight: 600;
    color: #ffd700;
    min-width: 50px;
}
.topbar-coin-rate {
    font-size: 17px;
    color: #44ff88;
}
.topbar-coin-rate.negative {
    color: #ff6644;
}

/* --- Divider --- */
.topbar-divider {
    width: 1px;
    height: 30px;
    background: #2a2a3a;
    flex-shrink: 0;
}

/* --- Bar Groups (Energy / Research) --- */
.topbar-bar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.topbar-bar-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.topbar-bar-container {
    width: 216px;
    height: 22px;
    background: #14142a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}
.topbar-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}
.topbar-bar-fill.energy {
    background: #44ff88;
}
.topbar-bar-fill.research {
    background: #aa55ff;
}
.topbar-bar-fill.research.paused {
    background: #ffaa00;
}
.topbar-bar-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 4px #000;
    z-index: 1;
}
.topbar-bar-text .rate {
    font-size: 13px;
}
.topbar-bar-text .rate.negative {
    color: #ff6644;
}

/* --- Research Group (clickable) --- */
.topbar-research-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    cursor: pointer;
    position: relative;
}
.topbar-research-group:hover .topbar-bar-container {
    border-color: rgba(170, 85, 255, 0.4);
}
.topbar-research-name {
    font-size: 17px;
    color: #cc88ff;
    font-weight: bold;
    white-space: nowrap;
}
.topbar-research-name.paused {
    color: #ffaa00;
}
.topbar-research-name.idle {
    color: #666;
    font-weight: normal;
}

/* Research idle glow pulse */
.topbar-research-group.idle-glow {
    animation: researchIdleGlow 0.5s ease-in-out 4;
}
.topbar-research-group.idle-glow .topbar-research-name {
    color: #cc88ff;
    font-weight: bold;
}
@keyframes researchIdleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 0px transparent);
    }
    50% {
        filter: drop-shadow(0 0 8px #aa55ff) drop-shadow(0 0 16px #cc88ff);
    }
}

/* Energy low warning glow pulse */
.topbar-bar-group.energy-low-glow {
    animation: energyLowGlow 0.5s ease-in-out 4;
}
@keyframes energyLowGlow {
    0%, 100% {
        filter: drop-shadow(0 0 0px transparent);
    }
    50% {
        filter: drop-shadow(0 0 8px #ff4444) drop-shadow(0 0 16px #ff8844);
    }
}

/* --- Wave Group --- */
.topbar-wave-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}
.topbar-wave-block {
    text-align: center;
    min-width: 60px;
}
.topbar-wave-num {
    font-size: 32px;
    font-weight: bold;
    color: #ff0066;
    text-shadow: 0 0 4px rgba(255, 0, 102, 0.5);
    font-variant-numeric: tabular-nums;
}
.topbar-wave-timer {
    font-size: 14px;
    color: #ff6688;
    font-variant-numeric: tabular-nums;
}
.topbar-end-wave-btn {
    padding: 8px 20px;
    border: 2px solid #ff0066;
    background: transparent;
    color: #ff0066;
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.topbar-end-wave-btn:hover {
    background: rgba(255, 0, 102, 0.15);
    border-color: #ff4488;
    color: #ff4488;
    box-shadow: 0 0 6px rgba(255, 0, 102, 0.3);
}
.topbar-reward {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ffd700;
    font-size: 14px;
    font-weight: normal;
}
.topbar-end-wave-btn:hover .topbar-reward {
    color: #ffe066;
}
.topbar-mini-coin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffec80, #ffd700 50%, #b8860b);
    display: inline-block;
    flex-shrink: 0;
}

/* ============================================ */
/* BOTTOM BAR                                  */
/* ============================================ */
.bottombar {
    width: 1280px;
    height: 75px;
    display: flex;
    align-items: center;
    background: #0c0c18;
    border-top: 1px solid #1a1a2e;
    padding: 0 10px;
    gap: 10px;
    position: absolute;
    top: 645px;
    left: 0;
    z-index: 950;
    font-family: 'Segoe UI', Arial, sans-serif;
    pointer-events: auto;
}

/* --- Bottom Bar Buttons --- */
.bottombar-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    flex-shrink: 0;
    border-bottom: 2px solid transparent;
}
.bottombar-btn:hover {
    color: #fff;
    border-bottom-color: currentColor;
}
.bottombar-btn.research {
    color: #44ff88;
    border: 1px solid rgba(68, 255, 136, 0.3);
    border-radius: 4px;
}
.bottombar-btn.research:hover {
    text-shadow: 0 0 10px rgba(68, 255, 136, 0.6);
    border-color: rgba(68, 255, 136, 0.6);
}
.bottombar-btn.menu {
    color: #ff0066;
}
.bottombar-btn.menu:hover {
    text-shadow: 0 0 10px rgba(255, 0, 102, 0.6);
}
.bottombar-btn.pause {
    color: #ff0066;
    font-size: 18px;
    min-width: 50px;
    text-align: center;
}
.bottombar-btn.pause:hover {
    text-shadow: 0 0 10px rgba(255, 0, 102, 0.6);
}

/* --- Buildings Area --- */
.bottombar-buildings {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow: hidden;
    padding: 0 5px;
}

/* --- Building Slot --- */
.bottombar-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
    position: relative;
    flex-shrink: 0;
}
.bottombar-slot:hover {
    background: rgba(68, 170, 255, 0.08);
}
.bottombar-slot.cannot-afford {
    opacity: 0.35;
}
.bottombar-slot canvas {
    display: block;
    image-rendering: auto;
}
.bottombar-slot-cost {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
}
.bottombar-slot.cannot-afford .bottombar-slot-cost {
    color: #555;
}

/* --- Right Buttons Group --- */
.bottombar-right-btns {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    flex-shrink: 0;
    border: 1px solid rgba(255, 0, 102, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
}

/* --- Bottom Bar Tooltip --- */
.bottombar-tooltip {
    position: absolute;
    transform: translateX(-50%);
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid #44aaff;
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(68, 170, 255, 0.3);
}
.bottombar-tooltip-title {
    color: #44aaff;
    font-weight: bold;
    margin-bottom: 2px;
}
.bottombar-tooltip-stats {
    color: #ffdd44;
    font-size: 11px;
}

/* --- Energy Tooltip --- */
.energy-tooltip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 78px;
    background: rgba(10, 15, 25, 0.96);
    border: 1px solid #44ff88;
    border-radius: 8px;
    padding: 10px 14px 8px;
    color: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(68, 255, 136, 0.25);
    min-width: 280px;
}
.energy-tooltip-columns {
    display: flex;
    gap: 16px;
}
.energy-tooltip-col {
    flex: 1;
    min-width: 100px;
}
.energy-tooltip-col-title {
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.energy-tooltip-col.producers .energy-tooltip-col-title {
    color: #44ff88;
}
.energy-tooltip-col.consumers .energy-tooltip-col-title {
    color: #ff6644;
}
.energy-tooltip-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    font-size: 11px;
    color: #ccd;
}
.energy-tooltip-row .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}
.energy-tooltip-row .value {
    font-weight: bold;
    white-space: nowrap;
    margin-left: 8px;
}
.energy-tooltip-col.producers .energy-tooltip-row .value {
    color: #44ff88;
}
.energy-tooltip-col.consumers .energy-tooltip-row .value {
    color: #ff6644;
}
.energy-tooltip-sum {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 3px;
    padding-top: 3px;
    font-weight: bold;
    font-size: 12px;
}
.energy-tooltip-col.producers .energy-tooltip-sum .value {
    color: #44ff88;
}
.energy-tooltip-col.consumers .energy-tooltip-sum .value {
    color: #ff6644;
}
.energy-tooltip-balance {
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.energy-tooltip-balance.surplus { color: #44ff88; }
.energy-tooltip-balance.deficit { color: #ff6644; }
.energy-tooltip-balance.neutral { color: #aabbcc; }

/* PAUSE OVERLAY */
.pause-overlay-container {
    display: flex;
    justify-content: center;
    align-items: center;
}
.pause-overlay-btn {
    background: rgba(15, 15, 25, 0.7);
    border: 2px solid rgba(255, 85, 85, 0.5);
    border-radius: 12px;
    padding: 30px 60px;
    color: #ff5555;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    pointer-events: auto;
}
.pause-overlay-btn span {
    display: block;
    font-size: 16px;
    font-weight: normal;
    color: #888;
    margin-top: 10px;
}
.pause-overlay-btn:hover {
    background: rgba(25, 25, 40, 0.85);
    border-color: #ff5555;
    box-shadow: 0 0 30px rgba(255, 85, 85, 0.3);
}

/* ============================================ */
/* MOBILE OVERRIDES                             */
/* ============================================ */
/* Top bar left of wave: 30% larger */
.mobile .topbar-coin-val { font-size: 34px; }
.mobile .topbar-coin-rate { font-size: 22px; }
.mobile .topbar-coin-icon { width: 31px; height: 31px; }
.mobile .topbar-bar-icon { font-size: 29px; }
.mobile .topbar-bar-text { font-size: 20px; }
.mobile .topbar-bar-text .rate { font-size: 17px; }
.mobile .topbar-research-name { font-size: 22px; }
.mobile .topbar-building-count { font-size: 24px; }
.mobile .topbar-wave-num { font-size: 40px; }
.mobile .topbar-wave-timer { font-size: 18px; }
.mobile .topbar-wave-block { min-width: 75px; }
.mobile .topbar-bar-group { padding: 10px 8px; margin: -10px -8px; }
.mobile .energy-tooltip { font-size: 16px; min-width: 360px; padding: 14px 18px 12px; top: 95px; }
.mobile .energy-tooltip-col-title { font-size: 15px; margin-bottom: 6px; padding-bottom: 4px; }
.mobile .energy-tooltip-row { font-size: 15px; padding: 2px 0; }
.mobile .energy-tooltip-row .name { max-width: 130px; }
.mobile .energy-tooltip-sum { font-size: 16px; margin-top: 5px; padding-top: 5px; }
.mobile .energy-tooltip-balance { font-size: 17px; margin-top: 8px; padding-top: 7px; }
/* Wave group: already large enough, keep desktop sizes */
/* Bottom bar: 30% larger */
.mobile .bottombar-btn { font-size: 20px; }
.mobile .bottombar-btn.pause { font-size: 23px; }
.mobile .bottombar-slot-cost { font-size: 18px; }
.mobile .bottombar-tooltip { font-size: 18px; padding: 8px 16px; top: 575px; }
.mobile .bottombar-tooltip-title { font-size: 18px; margin-bottom: 4px; }
.mobile .bottombar-tooltip-stats { font-size: 16px; }
