/**
 * Audio Controls Styling
 *
 * Positioned in bottom-right corner because that's where controls belong
 * when they're important but not intrusive.
 *
 * Design philosophy: Clean, minimal, and doesn't fight with existing page elements.
 * Z-index stays below modals (which are at 100) but above everything else.
 */

.audio-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50; /* Below modals (100), above ghosts (999 is for gallery ghosts but they're in different stacking contexts) */

    /* Visual styling - matches the spooky-romantic theme */
    background-color: rgba(58, 42, 26, 0.95); /* Dark wood tone with slight transparency */
    border: 2px solid #f5e8d7; /* Matches the parchment color from gallery */
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);

    /* Layout */
    display: flex;
    align-items: center;
    gap: 12px;

    /* Smooth appearance */
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.audio-controls:hover {
    opacity: 1;
    transform: translateY(-2px); /* Subtle lift on hover */
}

/**
 * Play/Pause Button
 * Large enough to tap on mobile, styled to match theme
 */
.control-btn {
    background-color: #ff6b35; /* Accent color - warm orange */
    border: none;
    border-radius: 50%;
    width: 44px;  /* Minimum touch target size for mobile */
    height: 44px;
    cursor: pointer;

    /* Center the icon */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Text styling */
    font-size: 18px;
    color: #fff;

    /* Interactive feedback */
    transition: background-color 0.2s ease, transform 0.1s ease;

    /* Accessibility */
    position: relative;
}

.control-btn:hover {
    background-color: #ff8559; /* Lighter on hover */
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95); /* Slight press effect */
}

.control-btn:focus-visible {
    outline: 3px solid #ff6b35;
    outline-offset: 3px;
}

/**
 * Volume Control Section
 * Groups the speaker icon, slider, and percentage display
 */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-label {
    font-size: 20px;
    cursor: default;
    user-select: none;
    /* Emoji doesn't need color styling */
}

/**
 * Volume Slider
 * Custom styled range input that matches the theme
 */
.volume-slider {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: rgba(245, 232, 215, 0.3); /* Semi-transparent parchment */
    outline: none;
    cursor: pointer;

    /* Remove default styling */
    -webkit-appearance: none;
    appearance: none;
}

/* Slider track styling for webkit browsers */
.volume-slider::-webkit-slider-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(245, 232, 215, 0.3);
}

/* Slider track styling for Firefox */
.volume-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(245, 232, 215, 0.3);
}

/* Slider thumb (the draggable part) - webkit */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6b35; /* Matches button color */
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #ff8559;
    transform: scale(1.1);
}

/* Slider thumb - Firefox */
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #ff6b35;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: #ff8559;
    transform: scale(1.1);
}

/* Focus state for slider - accessibility */
.volume-slider:focus-visible {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/**
 * Volume percentage display
 * Shows current volume as text for clarity
 */
.volume-value {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: #f5e8d7; /* Parchment color */
    min-width: 40px; /* Prevents layout shift when value changes */
    text-align: right;
    user-select: none;
}

/**
 * Mobile Responsive Design
 * Adjust sizing and layout for smaller screens
 */
@media (max-width: 768px) {
    .audio-controls {
        bottom: 15px;
        right: 15px;
        padding: 10px 12px;
        gap: 10px;
    }

    /* Slightly smaller button on mobile */
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Shorter slider on mobile to fit better */
    .volume-slider {
        width: 70px;
    }

    .volume-value {
        font-size: 12px;
        min-width: 35px;
    }
}

/**
 * Reduced Motion Support
 * Disable animations for users who prefer reduced motion
 */
@media (prefers-reduced-motion: reduce) {
    .audio-controls,
    .control-btn,
    .volume-slider::-webkit-slider-thumb,
    .volume-slider::-moz-range-thumb {
        transition: none;
    }

    .audio-controls:hover {
        transform: none;
    }

    .control-btn:hover {
        transform: none;
    }
}
