/**
 * Poke Royale - HUD & UI Styles
 * Section 7: HUD & UI Styles
 * Contains: Timer, menu, elixir bar, card dock, damage numbers, announcements
 */

/* ===== HUD TOP ===== */
.hud-top {
    position: absolute;
    top: 5px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

/* Badge Score Display - Hidden (replaced with win/loss in deck builder) */
.dock-badge-score {
    display: none;
}

.dock-badge-team {
    display: flex;
    align-items: center;
    gap: 2px;
}

.dock-badge-team.enemy { flex-direction: row-reverse; }

.dock-badge-count {
    font-family: 'Bangers', cursive;
    font-size: 14px;
    min-width: 10px;
    text-align: center;
}

.dock-badge-team.player .dock-badge-count { color: #60a5fa; }
.dock-badge-team.enemy .dock-badge-count { color: #f87171; }

.dock-badge-icons {
    display: flex;
    gap: 1px;
}

.dock-badge-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    filter: grayscale(1) brightness(0.3);
    transition: all 0.3s;
}

.dock-badge-icon.boulder { background: linear-gradient(135deg, #a8a29e 0%, #78716c 100%); }
.dock-badge-icon.cascade { background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%); }
.dock-badge-icon.thunder { background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%); }

.dock-badge-icon.active {
    filter: none;
    animation: dock-badge-pop 0.5s ease-out;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.6);
}

@keyframes dock-badge-pop {
    0% { transform: scale(0.3) rotate(-180deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.dock-vs-text {
    font-family: 'Bangers', cursive;
    font-size: 9px;
    color: #ffd700;
}

/* ===== TIMER BOX ===== */
.timer-box {
    background: linear-gradient(180deg, rgba(40, 40, 60, 0.95) 0%, rgba(25, 25, 40, 0.98) 100%);
    border: 2px solid #4a4a6a;
    border-radius: 8px;
    padding: 4px 14px;
    font-family: 'Bangers', cursive;
    font-size: 18px;
    color: #fff;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.timer-box.overtime {
    background: linear-gradient(180deg, rgba(254,243,199,0.95) 0%, rgba(252,211,77,0.95) 100%);
    animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===== MENU BUTTON ===== */
.menu-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(180deg, rgba(60,60,80,0.95) 0%, rgba(40,40,60,0.95) 100%);
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.menu-btn:hover { transform: scale(1.1); background: linear-gradient(180deg, rgba(80,80,100,0.95) 0%, rgba(60,60,80,0.95) 100%); }
.menu-btn:active { transform: scale(0.95); }

.menu-btn span {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* ===== PAUSE MENU OVERLAY ===== */
.pause-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    backdrop-filter: blur(5px);
}

.pause-overlay.active {
    display: flex;
}

.pause-menu {
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 3px solid #4a4a6a;
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    min-width: 280px;
}

.pause-title {
    font-family: 'Bangers', cursive;
    font-size: 36px;
    color: #fff;
    letter-spacing: 3px;
    margin-bottom: 25px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.pause-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    margin: 10px 0;
    font-family: 'Bangers', cursive;
    font-size: 18px;
    letter-spacing: 2px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pause-btn.resume {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    color: #fff;
}

.pause-btn.audio {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    color: #fff;
}

.pause-btn.quit {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
    color: #fff;
}

.pause-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.pause-btn:active { transform: translateY(0); }

/* ===== AUDIO TOGGLE ===== */
.audio-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 12px 15px;
    margin: 15px 0;
}

.audio-label {
    color: #fff;
    font-family: 'Rubik', sans-serif;
    font-size: 14px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: #4a4a6a;
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #4ade80;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* ===== MUSIC VISUALIZER ===== */
.music-indicator {
    position: absolute;
    bottom: 190px;
    left: 10px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
    z-index: 50;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s;
}

.music-indicator:hover { opacity: 1; }

.music-indicator.muted {
    opacity: 0.3;
}

.music-bar {
    width: 3px;
    background: linear-gradient(180deg, #f472b6 0%, #c026d3 100%);
    border-radius: 1px;
    animation: music-bounce 0.5s ease-in-out infinite;
}

.music-indicator.muted .music-bar {
    animation: none;
    height: 4px !important;
}

.music-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.music-bar:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.music-bar:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.music-bar:nth-child(4) { height: 16px; animation-delay: 0.15s; }
.music-bar:nth-child(5) { height: 6px; animation-delay: 0.25s; }

@keyframes music-bounce {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.5); }
}

/* ===== ELIXIR BAR ===== */
.elixir-container {
    position: absolute;
    bottom: 142px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    z-index: 100;
}

.elixir-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.elixir-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(180deg, #ff6b35 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.6), inset 0 2px 0 rgba(255,255,255,0.3);
    animation: elixir-icon-pulse 2s ease-in-out infinite;
}

@keyframes elixir-icon-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 107, 53, 0.6); }
    50% { box-shadow: 0 0 25px rgba(255, 107, 53, 0.9); }
}

.elixir-bar {
    flex: 1;
    height: 22px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0a0a15 100%);
    padding: 3px;
    border-radius: 12px;
    border: 2px solid #3a3a5a;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 2px 5px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.elixir-fill {
    height: 100%;
    width: 50%;
    background: linear-gradient(180deg, #e879f9 0%, #c026d3 50%, #a21caf 100%);
    border-radius: 8px;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 0 12px rgba(192, 38, 211, 0.6);
    transition: width 0.1s ease-out;
    position: relative;
}

.elixir-fill::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5%;
    width: 90%;
    height: 5px;
    background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, transparent 100%);
    border-radius: 3px;
}

.elixir-pip {
    flex: 1;
    height: 18px;
    background: #2a2a3a;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.elixir-pip.filled {
    background: linear-gradient(180deg, #e879f9 0%, #c026d3 50%, #a21caf 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 0 8px rgba(192, 38, 211, 0.5);
}

.elixir-pip.filled::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 10%;
    width: 80%;
    height: 4px;
    background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, transparent 100%);
    border-radius: 2px;
}

.elixir-pip.charging {
    background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
    animation: charge-pulse 0.5s ease-in-out infinite;
}

@keyframes charge-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.elixir-count {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Bangers', cursive;
    font-size: 28px;
    color: #e879f9;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 0 15px rgba(192, 38, 211, 0.5);
}

/* ===== CARD DOCK ===== */
.card-dock {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 140px;
    background: linear-gradient(180deg, #2a3a5a 0%, #1a2a4a 30%, #0a1a30 100%);
    border-top: 3px solid #4a5a7a;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0 60px;
    z-index: 100;
    box-shadow: inset 0 5px 20px rgba(0,0,0,0.3);
}

.card-dock::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
}

/* Cards Container */
.cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Card info panel on left side */
.card-info-panel {
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 85px;
    background: linear-gradient(180deg, rgba(40, 50, 70, 0.95) 0%, rgba(25, 35, 55, 0.98) 100%);
    border: 2px solid #4a5a7a;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    padding: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    overflow: hidden;
}

.card-info-panel.visible {
    opacity: 1;
}

.card-info-name {
    font-family: 'Bangers', cursive;
    font-size: 11px;
    color: #fff;
    text-align: center;
    letter-spacing: 1px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info-type {
    font-size: 9px;
    color: #888;
    text-align: center;
    text-transform: capitalize;
    margin-bottom: 4px;
}

.card-info-stats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 9px;
}

.card-info-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #aaa;
}

.card-info-stat-icon {
    width: 12px;
    text-align: center;
}

.card-info-stat-value {
    color: #ffd700;
    font-weight: 700;
}

.card-info-desc {
    font-size: 8px;
    color: #888;
    text-align: center;
    margin-top: auto;
    line-height: 1.2;
    max-height: 30px;
    overflow: hidden;
}

/* ===== NEXT CARD AREA ===== */
.next-card-area {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.next-label {
    font-size: 9px;
    color: #6a7a9a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.next-card {
    width: 48px;
    height: 64px;
    background: linear-gradient(180deg, #3a4a6a 0%, #2a3a5a 100%);
    border: 2px solid #5a6a8a;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    position: relative;
}

.next-card .next-label {
    position: absolute;
    top: -18px;
    font-size: 9px;
    color: #6a7a9a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.next-card .next-cost {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #c026d3 0%, #9333ea 100%);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bangers', cursive;
    font-size: 11px;
    color: #fff;
    z-index: 2;
}

.next-card .next-sprite,
.next-card img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: brightness(0.9);
}

/* ===== CARDS ===== */
.card {
    width: 64px;
    height: 85px;
    background: linear-gradient(180deg, #fff 0%, #e8e8f0 100%);
    border: 3px solid #888;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.8);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, transparent 100%);
    pointer-events: none;
}

/* Type-colored card borders */
.card.type-fire { border-color: #ff6b35; box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4); }
.card.type-water { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); }
.card.type-electric { border-color: #fbbf24; box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4); }
.card.type-grass { border-color: #22c55e; box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4); }
.card.type-psychic { border-color: #ec4899; box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4); }
.card.type-ghost { border-color: #a855f7; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4); }
.card.type-dragon { border-color: #7c3aed; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4); }
.card.type-fighting { border-color: #dc2626; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4); }
.card.type-normal { border-color: #a3a3a3; box-shadow: 0 4px 12px rgba(163, 163, 163, 0.4); }
.card.type-ground { border-color: #d97706; box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4); }
.card.type-rock { border-color: #a8a29e; box-shadow: 0 4px 12px rgba(168, 162, 158, 0.4); }
.card.type-ice { border-color: #67e8f9; box-shadow: 0 4px 12px rgba(103, 232, 249, 0.4); }
.card.type-poison { border-color: #9333ea; box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4); }
.card.type-flying { border-color: #93c5fd; box-shadow: 0 4px 12px rgba(147, 197, 253, 0.4); }

.card:hover:not(.disabled) {
    transform: translateY(-15px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.card.selected {
    transform: translateY(-28px) scale(1.1);
    border-color: var(--pokemon-yellow);
    box-shadow: 0 0 0 4px var(--pokemon-yellow), 0 20px 40px rgba(255, 222, 0, 0.5);
    z-index: 11;
}

.card.disabled {
    filter: grayscale(0.9) brightness(0.4);
    cursor: not-allowed;
}

.card-cost {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f472b6 0%, #c026d3 50%, #9333ea 100%);
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bangers', cursive;
    font-size: 15px;
    color: #fff;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.6);
}

.card-sprite {
    width: 46px;
    height: 46px;
    margin-top: 8px;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

.card-name {
    font-size: 7px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    margin-top: 3px;
    letter-spacing: 0.3px;
    text-align: center;
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== DEPLOY ZONE ===== */
.deploy-zone {
    position: absolute;
    left: 0;
    width: 100%;
    border: 4px dashed rgba(100, 255, 150, 0.5);
    background: rgba(100, 255, 150, 0.08);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 15;
}

.deploy-zone.visible {
    opacity: 1;
}

/* ===== DAMAGE NUMBERS ===== */
.damage-number {
    position: absolute;
    font-family: 'Bangers', cursive;
    font-size: 24px;
    color: #fff;
    text-shadow: 
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 0 10px rgba(255, 0, 0, 0.8);
    pointer-events: none;
    z-index: 50;
    animation: damage-float 1s ease-out forwards;
}

@keyframes damage-float {
    0% { transform: translateY(0) scale(1.3); opacity: 1; }
    100% { transform: translateY(-60px) scale(0.8); opacity: 0; }
}

/* ===== TYPE EFFECTIVENESS INDICATOR ===== */
.type-effectiveness {
    position: absolute;
    font-family: 'Bangers', cursive;
    font-size: 14px;
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    pointer-events: none;
    z-index: 51;
    animation: effectiveness-float 1.2s ease-out forwards;
    white-space: nowrap;
    transform: translateX(-50%);
}

@keyframes effectiveness-float {
    0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) translateY(-20px) scale(1.1); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-40px) scale(0.9); opacity: 0; }
}

/* ===== DOUBLE ELIXIR BADGE ===== */
.double-elixir {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #e879f9 0%, #c026d3 100%);
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 16px;
    letter-spacing: 2px;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(192, 38, 211, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.double-elixir.visible { opacity: 1; }

/* ===== ANNOUNCEMENT ===== */
.announcement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bangers', cursive;
    font-size: 48px;
    color: var(--pokemon-yellow);
    text-shadow: 0 4px 20px rgba(0,0,0,0.9), 0 0 60px rgba(255, 222, 0, 0.6);
    white-space: nowrap;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
}

/* ===== SPAWN EFFECTS ===== */
.spawn-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    pointer-events: none;
    animation: spawn-ring 0.5s ease-out forwards;
}

@keyframes spawn-ring {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; border-width: 8px; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; border-width: 1px; }
}

/* Pokemon materialize effect */
.pokemon.spawning {
    animation: pokemon-materialize 0.4s ease-out forwards;
}

.pokemon.spawning .pokemon-sprite {
    animation: sprite-materialize 0.4s ease-out forwards !important;
}

@keyframes pokemon-materialize {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes sprite-materialize {
    0% { filter: brightness(3) saturate(0); }
    50% { filter: brightness(2) saturate(0.5); }
    100% { filter: brightness(1) saturate(1); }
}

.death-effect {
    width: 60px;
    height: 60px;
    background: url('https://play.pokemonshowdown.com/sprites/misc/pokeball.png') center/contain no-repeat;
    animation: death 0.6s ease-out forwards;
}

@keyframes death {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}
