/* Audio player component styles */

/* Audio Player Container */
.audio-player {
    width: 100%;
    max-width: 400px;
}

.track-list {
    display: flex;
    flex-direction: column;
}

/* Track Item Layout */
.track-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Track Name Typography */
.track-name {
    font-family: var(--font-main);
    font-size: 2rem;
    font-weight: 400;
    color: var(--audio-player-primary);
    letter-spacing: -0.01em;
    ;
    line-height: 1.3;
    min-width: 0;
    flex-shrink: 0;
    width: 120px;
    text-align: right;
    font-weight: bold;
}

/* Triangle Play Button Styling */
.play-button {
    background: none;
    border: none;
    cursor: pointer !important;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Ensure cursor stays pointer even when disabled */
.play-button:disabled {
    cursor: pointer !important;
}

.play-button:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.play-button:active {
    transform: scale(0.95);
    outline: none;
    border: none;
}

.play-button:focus {
    outline: none;
}

.play-button:focus-visible {
    outline: 2px solid var(--audio-player-primary);
    outline-offset: 2px;
}

.play-icon {
    font-size: 16px;
    color: var(--audio-player-primary);
    line-height: 1;
    display: block;
    margin-left: 2px;
    /* Slight offset to visually center the triangle */
}

/* Progress Bar Container */
.progress-container {
    flex: 0 0 auto;
    width: 25%;
    max-width: 25%;
    min-width: 2.5rem;
    margin-left: 0.5rem;
    padding: 0.55rem 0;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.progress-bar {
    width: 100%;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 1px;
    overflow: visible;
    position: relative;
}

.progress-bar:focus-visible {
    outline: 1px solid var(--audio-player-primary);
    outline-offset: 4px;
}

.progress-fill {
    height: 100%;
    background-color: var(--audio-player-primary);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 1px;
}

.progress-playhead {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--audio-player-primary);
    transform: translate(-50%, -50%);
    transition: left 0.1s linear;
    pointer-events: none;
    opacity: 0;
}

.track-item.playing .progress-playhead,
.progress-container:hover .progress-playhead,
.progress-container.is-seeking .progress-playhead {
    opacity: 1;
}

.progress-container.is-seeking .progress-fill,
.progress-container.is-seeking .progress-playhead {
    transition: none;
}

/* Playing State Styles */
.track-item.playing .play-icon {
    opacity: 0.8;
    transform: scale(1.05);
}

.track-item.playing .progress-fill {
    background-color: var(--audio-player-primary);
}

.track-item.playing .track-name {
    opacity: 0.9;
    font-weight: 600;
}

/* Button State Transitions */
.play-icon {
    transition: all 0.2s ease;
}

.track-item.playing .play-button:hover {
    transform: scale(1.15);
}

/* Play and Pause Button State Classes */
.play-button.play-state .play-icon {
    opacity: 1;
    transform: scale(1);
}

.play-button.pause-state .play-icon {
    opacity: 0.9;
    transform: scale(1.05);
    font-weight: bold;
    font-size: 14px;
    /* Slightly smaller for pause symbol */
}

/* Ensure pause symbol displays correctly */
.play-button.pause-state .play-icon {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1;
}

/* Enhanced button state transitions */
.play-button.play-state:hover .play-icon {
    transform: scale(1.1);
    opacity: 0.8;
}

.play-button.pause-state:hover .play-icon {
    transform: scale(1.15);
    opacity: 0.7;
}

/* Smooth icon transformation */
.play-icon {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

/* Loading State Styles */
.track-item.loading {
    opacity: 0.7;
}

.track-item.loading .play-button {
    cursor: pointer;
}

.track-item.loading .play-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Error State Styles */
.track-item.error .track-name {
    opacity: 0.5;
    color: #cc0000;
}

.track-item.error .play-icon {
    opacity: 0.5;
    color: #cc0000;
}

/* Responsive Audio Player Adjustments */

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    .audio-player {
        max-width: 400px;
    }

    .track-name {
        font-size: 2.2rem;
        width: 220px;
    }

    .play-button {
        width: 24px;
        height: 24px;
    }

    .play-icon {
        font-size: 16px;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .audio-player {
        max-width: 350px;
    }

    .track-name {
        font-size: 1rem;
        width: 100px;
    }

    .play-button {
        width: 22px;
        height: 22px;
    }

    .play-icon {
        font-size: 15px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .audio-player {
        max-width: 100%;
        width: 100%;
    }

    .track-name {
        font-size: 0.95rem;
        width: 90px;
    }

    .play-button {
        width: 20px;
        height: 20px;
    }

    .play-icon {
        font-size: 14px;
    }

    .track-item {
        gap: 0.8rem;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 479px) {
    .track-name {
        font-size: 0.9rem;
        width: 80px;
    }

    .play-button {
        width: 18px;
        height: 18px;
    }

    .play-icon {
        font-size: 12px;
    }

    .track-item {
        gap: 0.6rem;
    }

    .progress-container {
        margin-left: 0rem;
        width: 15%;
        max-width: 15%;
    }

    .track-list {
        align-content: center;
        width: 47%;
        margin: auto;
    }
}