/* 
 * Player Controls Components - Phase 2D
 * Reusable player control styles across all PWA pages
 * Extracted from player-styles.css and player.js patterns
 */

/* === Player Container === */
.player-container {
    text-align: center;
    padding: 90px var(--spacing-lg, 1.5rem) var(--spacing-lg, 1.5rem) var(--spacing-lg, 1.5rem);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
    background: rgba(31, 41, 55, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
}

/* === App Header === */
.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    height: 70px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(229, 184, 11, 0.2);
    display: flex;
    align-items: center;
#fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: auto;
    width: 100%;
    /* height is still set dynamically */
    background-color: rgba(229, 184, 11, 0.3);
    border-radius: 50%;
    pointer-events: none;
    transition: height 0.2s;
    transform-origin: top;
}
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.logo-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(229, 184, 11, 0.3);
    font-family: 'Poppins', sans-serif;
}

.logo-saa {
    color: var(--primary);
}

.logo-dha {
    color: var(--text-light);
}

.logo-gaa {
    color: var(--primary);
}

/* === Navigation Arrows === */
.nav-arrow {
    width: 40px;
    height: 40px;
    background: rgba(229, 184, 11, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 184, 11, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(229, 184, 11, 0.7);
    position: relative;
    overflow: hidden;
}

.nav-arrow:hover {
    background: rgba(229, 184, 11, 0.15);
    color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(229, 184, 11, 0.2);
}

.nav-arrow:active {
    transform: scale(0.95);
}

.nav-arrow svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.nav-arrow:hover svg {
    transform: scale(1.1);
}

/* === Volume Controls === */
.volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-medium);
    padding: 1rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider:hover {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
}

.volume-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #F59E0B);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.volume-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.volume-thumb:hover {
    width: 20px;
    height: 20px;
    right: -10px;
    box-shadow: 0 3px 8px rgba(229, 184, 11, 0.4);
}

.volume-icon {
    width: 24px;
    height: 24px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.volume-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.volume-display {
    min-width: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

/* === Audio Player Controls === */
.audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.play-button,
.pause-button,
.stop-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(229, 184, 11, 0.3);
}

.play-button:hover,
.pause-button:hover,
.stop-button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(229, 184, 11, 0.4);
}

.play-button:active,
.pause-button:active,
.stop-button:active {
    transform: scale(0.95);
}

.play-button.playing {
    background: #EF4444;
}

.play-button.playing:hover {
    background: #DC2626;
}

/* === Instrument Selection === */
.instrument-selection {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 1rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.instrument-label {
    display: block;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}

.instrument-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.instrument-select:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.instrument-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229, 184, 11, 0.1);
}

.instrument-select option {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 0.5rem;
}

/* === Pitch Display === */
.pitch-display {
    background: linear-gradient(135deg, var(--bg-medium), var(--bg-light));
    padding: 2rem;
    border-radius: 1rem;
    margin: 1.5rem 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pitch-label {
    display: block;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Poppins', sans-serif;
}

.pitch-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
    text-shadow: 0 2px 4px rgba(229, 184, 11, 0.3);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 2px;
}

.pitch-frequency {
    font-size: 1.1rem;
    color: var(--text-light);
    opacity: 0.8;
    font-family: 'Poppins', sans-serif;
}

/* === Tanpura Controls === */
.tanpura-controls {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 1rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tanpura-title {
    margin: 0 0 1rem 0;
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

.tanpura-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.tanpura-button {
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

.tanpura-button:hover {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(229, 184, 11, 0.3);
}

.tanpura-button:active {
    transform: translateY(0);
}

.tanpura-button.active {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(229, 184, 11, 0.3);
}

/* === Audio Visualizer === */
.audio-visualizer {
    height: 60px;
    background: var(--bg-dark);
    border-radius: 0.5rem;
    margin: 1rem 0;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 2px;
    padding: 0.5rem;
    overflow: hidden;
}

.visualizer-bar {
    width: 3px;
    background: linear-gradient(to top, var(--primary), #F59E0B);
    border-radius: 1px;
    transition: height 0.1s ease;
    min-height: 2px;
    opacity: 0.7;
}

.visualizer-bar.active {
    opacity: 1;
    animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.2); }
}

/* === Responsive Player Controls === */

/* Mobile optimizations */
@media screen and (max-width: 480px) {
    .player-container {
        padding: 70px 1rem 1rem 1rem;
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }
    
    .app-header {
        height: 60px;
        padding: 0 15px;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .nav-arrow {
        width: 35px;
        height: 35px;
    }
    
    .nav-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .volume-control {
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .volume-icon {
        width: 20px;
        height: 20px;
    }
    
    .audio-controls {
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .play-button,
    .pause-button,
    .stop-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .instrument-selection,
    .tanpura-controls {
        padding: 1rem;
        margin: 0.75rem 0;
    }
    
    .pitch-display {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .pitch-value {
        font-size: 2rem;
    }
    
    .tanpura-buttons {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .tanpura-button {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Very small screens */
@media screen and (max-width: 320px) {
    .app-header {
        height: 55px;
        padding: 0 10px;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
    
    .nav-arrow {
        width: 30px;
        height: 30px;
    }
    
    .audio-controls {
        gap: 0.75rem;
    }
    
    .play-button,
    .pause-button,
    .stop-button {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .pitch-value {
        font-size: 1.8rem;
    }
    
    .tanpura-buttons {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tablet and larger screens */
@media screen and (min-width: 768px) {
    .player-container {
        padding: 100px 2rem 2rem 2rem;
        max-width: 700px;
    }
    
    .app-header {
        max-width: 700px;
        height: 80px;
        padding: 0 25px;
    }
    
    .logo-text {
        font-size: 2rem;
    }
    
    .nav-arrow {
        width: 45px;
        height: 45px;
    }
    
    .volume-control {
        padding: 1.25rem;
        gap: 1.25rem;
    }
    
    .audio-controls {
        gap: 2rem;
    }
    
    .play-button,
    .pause-button,
    .stop-button {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    .pitch-display {
        padding: 2.5rem;
    }
    
    .pitch-value {
        font-size: 3rem;
    }
    
    .tanpura-buttons {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
    }
}

/* === Player Control States === */
.player-loading {
    opacity: 0.7;
    pointer-events: none;
}

.player-error {
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

.player-success {
    border-color: #10B981;
    background: rgba(16, 185, 129, 0.1);
}

/* === Accessibility === */
.audio-controls button:focus-visible,
.volume-icon:focus-visible,
.tanpura-button:focus-visible,
.nav-arrow:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .player-container,
    .volume-control,
    .instrument-selection,
    .tanpura-controls,
    .pitch-display {
        border-width: 2px;
        border-color: rgba(255, 255, 255, 0.3);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nav-arrow,
    .play-button,
    .pause-button,
    .stop-button,
    .tanpura-button,
    .volume-thumb,
    .volume-icon,
    .visualizer-bar {
        transition: none;
        animation: none;
    }
    
    .nav-arrow:hover,
    .volume-thumb:hover,
    .tanpura-button:hover {
        transform: none;
    }
}
