/**
 * Marker Music - Play Page Styles
 *
 * Spezifisch fuer play.php (die Haupt-App)
 */

/* ==========================================================================
   Play Page Body
   ========================================================================== */

body.play-page {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Kamera Video
   ========================================================================== */

#video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    filter: saturate(0.7) brightness(0.9);
    opacity: 0;
    transition: opacity var(--transition-slow);
}

/* Back-Kamera: keine Spiegelung */
#video.no-mirror {
    transform: scaleX(1);
}

/* Video sichtbar wenn Debug aktiv */
body.show-video #video {
    opacity: 1;
}

/* ==========================================================================
   Audio-Visualisierung (P = Toggle)
   ========================================================================== */

#visualizer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    display: none;
}

body.viz-active #visualizer {
    display: block;
}

/* ==========================================================================
   Bereitschafts-Anzeige - Minimaler pulsierender Ring
   ========================================================================== */

#heartbeat {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    pointer-events: none;
    z-index: var(--z-base);
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Aeusserer Ring - sanft pulsierend */
#heartbeat::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    opacity: 0.4;
    animation: pulse-ring 3s ease-in-out infinite;
}

/* Innerer Punkt - dezenter Akzent */
#heartbeat::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.6;
}

@keyframes pulse-ring {
    0%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.25;
    }
}

/* Wellen-Elemente nicht benoetigt */
.wave-2,
.wave-3 {
    display: none;
}

/* Sichtbar wenn App bereit */
body.ready #heartbeat {
    opacity: 1;
}

/* Verstecken wenn Marker aktiv */
body.ready.markers-active #heartbeat {
    opacity: 0;
}

/* ==========================================================================
   Ladeanimation - Musikalische Noten
   ========================================================================== */

#loading {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-toast);
}

.loading-content {
    text-align: center;
}

.loading-notes {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.loading-notes .note {
    font-size: 3rem;
    color: var(--color-primary);
    animation: bounce 0.6s ease-in-out infinite;
}

.loading-notes .note:nth-child(1) {
    animation-delay: 0s;
    color: var(--color-pad-1);
}

.loading-notes .note:nth-child(2) {
    animation-delay: 0.15s;
    color: var(--color-pad-2);
}

.loading-notes .note:nth-child(3) {
    animation-delay: 0.3s;
    color: var(--color-pad-3);
}

.loading-notes .note:nth-child(4) {
    animation-delay: 0.45s;
    color: var(--color-pad-4);
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
}

.loading-text {
    font-size: var(--text-lg);
    color: var(--color-text);
}

/* Progress-Bar */
.loading-progress-container {
    margin-top: var(--space-4);
    width: 200px;
    height: 6px;
    background: var(--color-surface-alt, rgba(0,0,0,0.1));
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary, var(--color-primary));
    border-radius: var(--radius-full);
    transition: width 0.15s ease-out;
}

/* ==========================================================================
   Status Bar (unten)
   ========================================================================== */

#status {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3) var(--space-5);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text);
    z-index: var(--z-overlay);
}

/* Status-Buttons (klickbar, zeigen Key + Wert) */
.status-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-alt, rgba(0,0,0,0.05));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.status-btn:hover {
    background: var(--color-surface-hover, rgba(0,0,0,0.1));
    border-color: var(--color-primary);
}

.status-btn:active {
    transform: scale(0.97);
}

.status-btn .key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4em;
    height: 1.4em;
    background: var(--color-primary);
    color: var(--color-on-primary, white);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
}

.status-btn .value {
    font-weight: var(--font-bold);
    min-width: 1.8em;
    text-align: center;
}

.status-btn .unit {
    opacity: 0.6;
    font-size: var(--text-xs);
}

#loop-indicator {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    color: var(--color-secondary);
    font-weight: var(--font-bold);
    background: var(--color-secondary-bg, rgba(255,100,100,0.1));
    border-radius: var(--radius-md);
}

/* ==========================================================================
   Start Overlay (Audio aktivieren)
   ========================================================================== */

#start-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-toast);
    cursor: pointer;
}

#start-overlay .start-content {
    text-align: center;
    padding: var(--space-5);
}

#start-overlay h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
    background: var(--gradient-title);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#start-overlay p {
    font-size: var(--text-lg);
    color: var(--color-text);
}

/* ==========================================================================
   Grid-Overlay (16-Step Visualizer)
   ========================================================================== */

#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-base);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Sichtbar wenn App bereit und Loop aktiv */
body.ready #grid-overlay {
    opacity: 1;
}

/* Grid-Linien */
.grid-line {
    position: absolute;
    top: 0;
    bottom: 60px; /* Platz fuer Status-Bar */
    width: 1px;
    background: var(--color-grid-line, rgba(255, 255, 255, 0.08));
    transform: translateX(-50%);
    transition: background 0.1s ease, width 0.1s ease;
}

/* Beat-Linien (1, 5, 9, 13) - prominenter */
.grid-line.beat {
    width: 2px;
    background: var(--color-grid-beat, rgba(255, 255, 255, 0.2));
}

/* Aktueller Step - pulsiert */
.grid-line.current {
    width: 3px;
    background: var(--color-primary, #FF6B6B);
    box-shadow: 0 0 8px var(--color-primary, #FF6B6B),
                0 0 16px var(--color-primary, #FF6B6B);
    animation: grid-pulse 0.125s ease-out;
}

@keyframes grid-pulse {
    0% {
        opacity: 1;
        transform: translateX(-50%) scaleX(2);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scaleX(1);
    }
}

/* Marker-Dots */
.marker-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-secondary, #4ECDC4);
    border: 2px solid var(--color-surface, white);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-dot.visible {
    opacity: 1;
}

/* Snap-Animation */
.marker-dot.snap {
    animation: marker-snap 0.2s ease-out;
}

@keyframes marker-snap {
    0% {
        transform: translate(-50%, -50%) scale(1.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ==========================================================================
   Mobile Anpassungen
   ========================================================================== */

@media (max-width: 600px) {
    #status {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
        font-size: var(--text-xs);
    }

    .status-btn {
        padding: var(--space-1) var(--space-2);
        gap: var(--space-1);
    }

    .status-btn .key {
        width: 1.2em;
        height: 1.2em;
    }

    /* Grid auf Mobile etwas dezenter */
    .grid-line {
        bottom: 50px;
    }

    .marker-dot {
        width: 10px;
        height: 10px;
    }
}
