/* Advanced Audio Player Styles - Minimalist Design */

.advanced-audio-player {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Play/Pause Button Container with Animation */
.player-play-btn-container {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animated Vibrating Circle Layer 1 - Outermost */
.player-play-btn-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180%;
    height: 180%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(212, 165, 116, 0.4);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 0;
}

/* Animated Vibrating Circle Layer 2 - Middle */
.player-play-btn-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130%;
    height: 130%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(212, 165, 116, 0.5);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 0;
}

/* Additional animated circles - we'll add these via pseudo-elements on the button itself */

/* Circle wrapper for the innermost animated circle */
.player-circle-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 110%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(212, 165, 116, 0.7);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 0;
}

/* Activate wrapper circle animation when playing */
.player-play-btn-container.playing .player-circle-wrapper {
    opacity: 1;
    animation: vibrate-circle-closest 3.5s ease-in-out infinite 1.5s;
}

/* Vibrating closest circle animation - expands and fades */
@keyframes vibrate-circle-closest {
    0% {
        width: 100%;
        height: 100%;
        border-radius: 50% 48% 52% 50%;
        opacity: 1;
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        width: 120%;
        height: 118%;
        border-radius: 48% 52% 50% 48%;
        opacity: 0.8;
        transform: translate(-50%, -50%) rotate(-90deg);
    }
    50% {
        width: 140%;
        height: 138%;
        border-radius: 52% 50% 48% 52%;
        opacity: 0.5;
        transform: translate(-50%, -50%) rotate(-180deg);
    }
    75% {
        width: 160%;
        height: 158%;
        border-radius: 50% 48% 52% 48%;
        opacity: 0.25;
        transform: translate(-50%, -50%) rotate(-270deg);
    }
    100% {
        width: 180%;
        height: 178%;
        border-radius: 48% 52% 50% 52%;
        opacity: 0;
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

/* Activate animations when playing */
.player-play-btn-container.playing::before {
    opacity: 1;
    animation: vibrate-circle-outer 5s ease-in-out infinite;
}

.player-play-btn-container.playing::after {
    opacity: 1;
    animation: vibrate-circle-middle 4.5s ease-in-out infinite 0.5s;
}

/* Vibrating/undulating outer circle animation - expands and fades */
@keyframes vibrate-circle-outer {
    0% {
        width: 100%;
        height: 100%;
        border-radius: 50% 48% 52% 50%;
        opacity: 0.8;
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        width: 140%;
        height: 135%;
        border-radius: 48% 52% 50% 48%;
        opacity: 0.6;
        transform: translate(-50%, -50%) rotate(90deg);
    }
    50% {
        width: 180%;
        height: 175%;
        border-radius: 52% 50% 48% 52%;
        opacity: 0.35;
        transform: translate(-50%, -50%) rotate(180deg);
    }
    75% {
        width: 220%;
        height: 215%;
        border-radius: 50% 48% 52% 50%;
        opacity: 0.15;
        transform: translate(-50%, -50%) rotate(270deg);
    }
    100% {
        width: 250%;
        height: 245%;
        border-radius: 48% 52% 50% 48%;
        opacity: 0;
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Vibrating/undulating middle circle animation - expands and fades */
@keyframes vibrate-circle-middle {
    0% {
        width: 100%;
        height: 100%;
        border-radius: 52% 48% 50% 52%;
        opacity: 0.9;
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        width: 130%;
        height: 125%;
        border-radius: 50% 52% 48% 50%;
        opacity: 0.7;
        transform: translate(-50%, -50%) rotate(-90deg);
    }
    50% {
        width: 160%;
        height: 155%;
        border-radius: 48% 50% 52% 48%;
        opacity: 0.45;
        transform: translate(-50%, -50%) rotate(-180deg);
    }
    75% {
        width: 190%;
        height: 185%;
        border-radius: 52% 48% 50% 52%;
        opacity: 0.2;
        transform: translate(-50%, -50%) rotate(-270deg);
    }
    100% {
        width: 220%;
        height: 215%;
        border-radius: 50% 52% 48% 50%;
        opacity: 0;
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

/* Play/Pause Button */
.player-play-btn {
    position: relative;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 50% !important;
    border: none !important;
    background: #451D0F !important;
    color: white;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(69, 29, 15, 0.2);
    z-index: 1;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

#play-icon {
    font-size: 24px;
    color: white;
    transition: all 0.2s ease;
}

/* Inner vibrating circle - using button's ::before */
.player-play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160%;
    height: 160%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(212, 165, 116, 0.6);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: -1;
}

/* Activate inner circle animation when playing */
.player-play-btn-container.playing .player-play-btn::before {
    opacity: 1;
    animation: vibrate-circle-inner 4s ease-in-out infinite 1s;
}

/* Vibrating inner circle animation - expands and fades */
@keyframes vibrate-circle-inner {
    0% {
        width: 100%;
        height: 100%;
        border-radius: 48% 52% 50% 48%;
        opacity: 0.95;
        transform: translate(-50%, -50%) rotate(0deg);
    }
    25% {
        width: 125%;
        height: 123%;
        border-radius: 52% 48% 52% 48%;
        opacity: 0.75;
        transform: translate(-50%, -50%) rotate(90deg);
    }
    50% {
        width: 150%;
        height: 148%;
        border-radius: 50% 52% 48% 52%;
        opacity: 0.5;
        transform: translate(-50%, -50%) rotate(180deg);
    }
    75% {
        width: 175%;
        height: 173%;
        border-radius: 48% 50% 50% 48%;
        opacity: 0.25;
        transform: translate(-50%, -50%) rotate(270deg);
    }
    100% {
        width: 200%;
        height: 198%;
        border-radius: 52% 48% 50% 52%;
        opacity: 0;
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.player-play-btn:hover {
    background: var(--color-primary-dark, #3d2a23);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(82, 56, 47, 0.3);
}

.player-play-btn:active {
    transform: scale(0.98);
}

.player-play-btn i {
    font-size: 18px;
    margin-left: 2px; /* Slight adjustment for play icon centering */
    transition: margin-left 0.2s ease;
}

/* Adjust pause icon centering */
.player-play-btn .bi-pause-fill {
    margin-left: 0;
}

/* Enhanced subtle effect when playing */
.player-play-btn-container.playing .player-play-btn {
    box-shadow: 
        0 4px 16px rgba(82, 56, 47, 0.3),
        0 0 12px rgba(212, 165, 116, 0.4);
    animation: button-pulse 4s ease-in-out infinite;
}

/* Subtle button pulse synchronized with circles */
@keyframes button-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Progress Bar */
.player-progress-container {
    position: relative;
    height: 6px;
    background: #DDD0D0;
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.player-progress-container:hover {
    height: 8px;
}

.player-progress-bar {
    height: 100%;
    background: var(--color-primary, #52382f);
    border-radius: 3px;
    transition: width 0.1s linear;
    pointer-events: none; /* Allow clicks to pass through to parent container */
}

/* Time Display */
.player-time {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
}

.player-time-placeholder {
    height: 1.2rem; /* Approximate height of player-time */
}

/* Control Sliders */
.player-control-group {
    margin-bottom: 1rem;
}

.player-control-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-control-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary, #52382f);
    background: var(--bs-secondary-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Key Selector Dropdown */
.player-key-select {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.player-key-select:focus {
    border-color: var(--color-primary, #52382f);
    box-shadow: 0 0 0 0.2rem rgba(82, 56, 47, 0.15);
    outline: none;
}

.player-key-select:hover {
    border-color: var(--color-primary, #52382f);
}

.player-key-select option {
    padding: 0.5rem;
}

.player-key-select option:disabled {
    color: var(--bs-secondary-color);
    font-style: italic;
}

/* Range Sliders */
.player-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bs-secondary-bg);
    outline: none;
    transition: background 0.3s;
}

.player-slider:hover {
    background: var(--bs-tertiary-bg);
}

.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary, #52382f);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(82, 56, 47, 0.3);
    transition: all 0.2s ease;
}

.player-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(82, 56, 47, 0.5);
}

.player-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.player-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary, #52382f);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(82, 56, 47, 0.3);
    transition: all 0.2s ease;
}

.player-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(82, 56, 47, 0.5);
}

/* Volume Control */
.player-volume-slider {
    display: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: var(--bs-secondary-bg);
    outline: none;
}

.player-volume-slider:hover {
    height: 8px;
}

.player-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary, #52382f);
    cursor: pointer;
}

.player-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary, #52382f);
    cursor: pointer;
    border: none;
}

/* Control Icons */
.player-control-icon {
    font-size: 1.25rem;
    color: var(--bs-secondary-color);
    margin-right: 0.5rem;
}

/* Main Controls Container */
.player-main-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Advanced Controls Toggle */
.player-advanced-toggle {
    background: transparent;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #4E4B4B;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-advanced-toggle:hover {
    background: var(--bs-secondary-bg);
    border-color: var(--color-primary, #52382f);
}

.player-advanced-toggle i {
    margin-right: 0.5rem;
    color: #63301E;
}

/* Advanced Controls Panel */
.player-advanced-controls {
    padding-top: 1.5rem;
    border-top: 1px solid var(--bs-border-color);
    margin-top: 1.5rem;
}

/* SoundTouch Status Indicator */
#soundtouch-status {
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--bs-secondary-bg);
}

#soundtouch-status .text-success {
    color: #28a745 !important;
}

#soundtouch-status .text-warning {
    color: #ffc107 !important;
}

#soundtouch-mode {
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 576px) {
    .advanced-audio-player {
        padding: 16px;
    }
    
    .player-play-btn {
        width: 40px;
        height: 40px;
    }
    
    .player-play-btn i {
        font-size: 16px;
    }
    
    .player-volume-slider {
        width: 80px;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .advanced-audio-player {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .player-time {
    color: var(--color-text-primary, #f7f3ef);
}

[data-theme="dark"] .player-control-label {
    color: var(--color-text-primary, #f7f3ef);
}

[data-theme="dark"] .player-control-value {
    color: var(--color-primary-light, #c49675);
    background: var(--color-bg-tertiary, #3a302a);
}

[data-theme="dark"] .player-progress-container {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .player-slider {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .player-slider:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .player-key-select {
    background-color: #2b2b2b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    border-color: rgba(255, 255, 255, 0.3);
    color: #e0e0e0;
}

[data-theme="dark"] .player-key-select:focus {
    border-color: var(--color-primary-light, #c49675);
    background-color: #333333;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .player-key-select:hover {
    border-color: var(--color-primary-light, #c49675);
    background-color: #333333;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .player-control-icon {
    color: var(--color-primary-light, #c49675);
}

/* Loading state */
.player-loading {
    opacity: 0.6;
    pointer-events: none;
}

.player-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--bs-border-color);
    border-top-color: var(--color-primary, #52382f);
    border-radius: 50%;
    animation: player-spin 0.8s linear infinite;
}

@keyframes player-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
