/**
 * ============================================
 * GAME OVERLAYS - Standardisierte UI-Elemente
 * ============================================
 *
 * Wiederverwendbare Styles für alle Spiele:
 * - Score Panel
 * - Wave Transition Overlay
 * - Control Panel
 * - Instructions Banner
 * - Warning Banner
 *
 * Z-Index Scale (see common.css for full hierarchy):
 *   100  - UI overlay elements
 *   150  - Power-ups, warnings, instructions
 *   200  - Pause/Game-over/Wave transitions
 *   500  - Clap-to-start overlay
 *   1000 - Loading screen
 */

/* ============================================
   SCORE PANEL
   ============================================ */

.score-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 20px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 200px;
    text-align: center;
}

.wave-indicator {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-weight: 500;
}

.wave-indicator span {
    color: #4ecdc4;
    font-weight: bold;
    font-size: 1.1rem;
}

.stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    font-size: 2rem;
    line-height: 1;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 2px 2px 8px rgba(78, 205, 196, 0.5);
    min-width: 70px;
    text-align: left;
}

.stat-value.timer-value {
    color: #4ecdc4;
}

.stat-value.timer-value.warning {
    color: #ff6b6b;
    text-shadow: 2px 2px 8px rgba(255, 107, 107, 0.5);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.stat-value.score-value {
    color: #ffe66d;
    text-shadow: 2px 2px 8px rgba(255, 230, 109, 0.5);
}

.session-high {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 5px;
    text-align: center;
}

.session-high span {
    color: #ffe66d;
    font-weight: bold;
}

/* ============================================
   WAVE TRANSITION OVERLAY
   ============================================ */

.wave-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(15px);
}

.wave-transition-overlay.visible {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wave-transition-content {
    text-align: center;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wave-complete-title {
    font-size: 2.5rem;
    color: #4ecdc4;
    margin-bottom: 30px;
    text-shadow: 2px 2px 10px rgba(78, 205, 196, 0.6);
    font-weight: bold;
}

.wave-score-label {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.wave-score-value {
    font-size: 4rem;
    font-weight: bold;
    color: #ffe66d;
    margin-bottom: 20px;
    text-shadow: 3px 3px 15px rgba(255, 230, 109, 0.6);
}

.new-record-badge {
    display: none;
    font-size: 1.5rem;
    color: #ffd700;
    margin-bottom: 15px;
    animation: recordBadge 0.6s ease-out;
    text-shadow: 2px 2px 10px rgba(255, 215, 0, 0.8);
}

.new-record-badge.visible {
    display: block;
}

@keyframes recordBadge {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.session-record-display {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.session-record-display span {
    color: #ffe66d;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Time bonus display (for objective mode) */
.time-bonus-display {
    font-size: 1.3rem;
    color: #4ecdc4;
    font-weight: bold;
    margin-top: 10px;
    animation: timeBonusPop 0.5s ease-out;
}

@keyframes timeBonusPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    60% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   CONTROL PANEL
   ============================================ */

.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.control-panel .btn {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-panel .btn:hover {
    background: rgba(78, 205, 196, 0.3);
    border-color: rgba(78, 205, 196, 0.5);
    transform: scale(1.05);
}

.control-panel .btn:active {
    transform: scale(0.95);
}

/* ============================================
   INSTRUCTIONS BANNER
   ============================================ */

.instructions {
    position: fixed;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 25px 40px;
    border-radius: 20px;
    font-size: 1.5rem;
    color: #fff;
    text-align: center;
    z-index: 150;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(78, 205, 196, 0.3);
    max-width: 600px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.instructions.hidden {
    display: none;
}

/* ============================================
   WARNING BANNER
   ============================================ */

.no-body-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 107, 107, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 15px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 150;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: none;
    animation: warningPulse 1s ease-in-out infinite;
}

.no-body-warning.visible {
    display: block;
}

@keyframes warningPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.03);
        box-shadow: 0 6px 25px rgba(255, 107, 107, 0.7);
    }
}

/* ============================================
   GAME TITLE
   ============================================ */

.game-title {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.15);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 50;
    letter-spacing: 3px;
    pointer-events: none;
}

/* ============================================
   FULLSCREEN BUTTON
   ============================================ */

.fullscreen-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.fullscreen-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    border-color: rgba(78, 205, 196, 0.5);
    transform: scale(1.05);
}

.fullscreen-btn:active {
    transform: scale(0.95);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .score-panel {
        top: 10px;
        min-width: 240px;
        padding: 12px 20px;
    }

    .wave-indicator {
        font-size: 0.9rem;
    }

    .wave-indicator span {
        font-size: 1rem;
    }

    .stat-icon {
        font-size: 1.8rem;
    }

    .stat-value {
        font-size: 1.8rem;
        min-width: 60px;
    }

    .session-high {
        font-size: 0.8rem;
    }

    .wave-complete-title {
        font-size: 2rem;
    }

    .wave-score-value {
        font-size: 3rem;
    }

    .control-panel {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .control-panel .btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .instructions {
        font-size: 1.2rem;
        padding: 20px 30px;
        max-width: 80%;
    }

    .no-body-warning {
        bottom: 100px;
        font-size: 1rem;
        padding: 12px 25px;
    }

    .game-title {
        font-size: 1.5rem;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .score-panel {
        top: 5px;
        min-width: 200px;
        padding: 10px 15px;
    }

    .wave-indicator {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .wave-indicator span {
        font-size: 0.9rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
        min-width: 50px;
    }

    .session-high {
        font-size: 0.7rem;
    }

    .stats-row {
        gap: 12px;
    }

    .wave-complete-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .wave-score-label {
        font-size: 1rem;
    }

    .wave-score-value {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .new-record-badge {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .session-record-display {
        font-size: 0.9rem;
    }

    .control-panel {
        top: 5px;
        right: 5px;
        gap: 6px;
    }

    .control-panel .btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .instructions {
        font-size: 1rem;
        padding: 15px 20px;
        max-width: 85%;
    }

    .no-body-warning {
        bottom: 80px;
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .game-title {
        font-size: 1.2rem;
        bottom: 15px;
        letter-spacing: 2px;
    }

    .fullscreen-btn {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* ============================================
   BACK LINK (Game-specific override possible)
   ============================================ */

.back-link {
    position: fixed;
    bottom: 15px;
    left: 15px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 101;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
    .back-link {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .back-link {
        bottom: 10px;
        left: 10px;
        font-size: 0.7rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Smooth transitions for all dynamic elements */
.score-panel,
.wave-transition-overlay,
.instructions,
.no-body-warning {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================
   CLAP TO START OVERLAY
   ============================================ */

.clap-to-start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 500;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.clap-to-start-overlay.hiding {
    opacity: 0;
    pointer-events: none;
}

.clap-to-start-content {
    text-align: center;
    animation: clapBounce 2s ease-in-out infinite;
}

@keyframes clapBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.clap-emoji {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: clapPulse 1s ease-in-out infinite;
}

@keyframes clapPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.clap-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.clap-subtext {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 768px) {
    .clap-emoji {
        font-size: 4rem;
    }

    .clap-text {
        font-size: 1.8rem;
    }

    .clap-subtext {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .clap-emoji {
        font-size: 3rem;
    }

    .clap-text {
        font-size: 1.4rem;
    }

    .clap-subtext {
        font-size: 0.9rem;
    }
}

/* ============================================
   LANDSCAPE MODE ON MOBILE
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .score-panel {
        top: 5px;
        padding: 8px 15px;
        min-width: 180px;
    }

    .wave-indicator {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }

    .wave-indicator span {
        font-size: 0.9rem;
    }

    .stat-icon {
        font-size: 1.3rem;
    }

    .stat-value {
        font-size: 1.4rem;
        min-width: 45px;
    }

    .stats-row {
        gap: 10px;
        margin-bottom: 3px;
    }

    .stat-item {
        gap: 5px;
    }

    .session-high {
        font-size: 0.65rem;
        margin-top: 3px;
    }

    .control-panel {
        top: 5px;
        right: 5px;
        gap: 5px;
    }

    .control-panel .btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .wave-complete-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .wave-score-value {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .game-title {
        font-size: 1rem;
        bottom: 10px;
    }

    .fullscreen-btn {
        bottom: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
    }

    .back-link {
        bottom: 5px;
        left: 5px;
        font-size: 0.65rem;
        padding: 4px 10px;
    }

    .clap-emoji {
        font-size: 2.5rem;
    }

    .clap-text {
        font-size: 1.2rem;
    }

    .clap-subtext {
        font-size: 0.8rem;
    }
}