/* Audiobook Player Styles - Based on Slėnio Istorijos Design */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Lora:wght@500;700&display=swap');

.audiobook-widget {
    font-family: 'Lato', sans-serif;
    color: #3D3532;
    margin: 0 auto;
    max-width: 700px;
    position: relative;
}

/* Audiobook Title */
.audiobook-title {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 20px 0;
    color: #3D3532;
    line-height: 1.2;
}

/* Cover Image with Player Overlay */
.audiobook-cover {
    height: 100%;
    position: relative;
    text-align: center;
    margin: 0 0 20px 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.audiobook-cover img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.audiobook-cover:hover img {
    transform: scale(1.02);
}

/* Main Player Container - Overlay Style */
.audiobook-player-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(250,238,234,0) 0%, rgba(250,238,234,0.3) 50%, rgba(250,238,234,0.7) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 0 0 16px 16px;
    padding: 20px;
    transition: all 0.3s ease;
    border-top: 1px solid rgba(250,238,234,0.4);
}

.audiobook-player-container:hover {
    background: linear-gradient(180deg, rgba(250,238,234,0) 0%, rgba(250,238,234,0.5) 50%, rgba(250,238,234,0.85) 100%);
    box-shadow: 0 -4px 20px rgba(250,238,234,0.2);
    border-top: 1px solid rgba(250,238,234,0.6);
}

/* Standalone Player (no cover image) */
.audiobook-player-standalone {
    position: relative;
    background-color: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.audiobook-player-standalone .player-controls {
    color: #3D3532;
}

.audiobook-player-standalone .time-display {
    color: #3D3532;
    text-shadow: none;
}

.audiobook-player-standalone .volume-button {
    color: #3D3532;
    text-shadow: none;
}

.audiobook-player-standalone .speed-control {
    background-color: #ffffff;
    border: 1px solid #ddd;
    color: #3D3532;
    text-shadow: none;
}

.audiobook-player-standalone .download-button {
    background-color: #ffffff;
    border: 2px solid #FF5C17;
    color: #FF5C17;
    text-shadow: none;
}

.audiobook-player-standalone .download-button:hover {
    background-color: #FF5C17;
    color: #ffffff;
}

/* Player Controls Layout */
.player-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    color: #3D3532;
}

/* Play Button */
.play-button {
    background-color: #FF5C17;
    color: #FFFFFF;
    border: none;
    width: 50px;
    height: 50px;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 92, 23, 0.5);
    position: relative;
    flex-shrink: 0;
}

.play-button:hover {
    background-color: #e04a0f;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 92, 23, 0.6);
}

.play-button:active {
    transform: scale(1.05);
}

.play-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.play-icon {
    margin-left: 5px;
}

/* Progress Container */
.progress-container {
    flex-grow: 1;
    min-width: 200px;
    position: relative;
}

.progress-bar {
    height: 6px;
    background-color: rgba(61, 53, 50, 0.2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.progress-bar:hover {
    height: 8px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background-color: #FF5C17;
    transition: width 0.1s ease;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(255, 92, 23, 0.4);
}

.progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background-color: #FF5C17;
    border: 2px solid #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.progress-bar:hover .progress-handle {
    opacity: 1;
}

.progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

/* Time Display */
.time-display {
    font-weight: 700;
    font-size: 0.85rem;
    color: #3D3532;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 75px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.separator {
    margin: 0 5px;
    opacity: 0.6;
}

/* Volume Controls */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.volume-button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #3D3532;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.volume-button:hover {
    background-color: rgba(255, 92, 23, 0.1);
    transform: scale(1.1);
}

.volume-bar {
    width: 50px;
    height: 3px;
    background-color: rgba(61, 53, 50, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-fill {
    width: 100%;
    height: 100%;
    background-color: #FF5C17;
    border-radius: 2px;
    transition: width 0.1s ease;
    box-shadow: 0 0 6px rgba(255, 92, 23, 0.4);
}

.volume-handle {
    position: absolute;
    top: 50%;
    left: 100%;
    width: 10px;
    height: 10px;
    background-color: #FF5C17;
    border: 1px solid #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease, left 0.1s ease;
}

.volume-bar:hover .volume-handle {
    opacity: 1;
}

.volume-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

/* Speed Control */
.speed-container {
    flex-shrink: 0;
}

.speed-control {
    padding: 4px 8px;
    border: 1px solid rgba(61, 53, 50, 0.4);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #3D3532;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.speed-control:hover,
.speed-control:focus {
    border-color: #FF5C17;
    background-color: rgba(255, 92, 23, 0.1);
    outline: none;
}

/* Download Button */
.download-container {
    flex-shrink: 0;
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(61, 53, 50, 0.4);
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    color: #3D3532;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.download-button:hover {
    background-color: #FF5C17;
    border-color: #FF5C17;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 92, 23, 0.5);
}

/* Audiobook Info */
.audiobook-info {
    line-height: 1.6;
    margin-top: 20px;
}

.audiobook-meta {
    background-color: #FAEEEA;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #FF5C17;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.audiobook-meta p {
    margin: 0;
    font-size: 0.9rem;
    flex: 1;
    min-width: 120px;
}

.audiobook-meta strong {
    color: #FF5C17;
    font-weight: 700;
}

.audiobook-description {
    font-size: 1rem;
    line-height: 1.7;
}

.audiobook-description p {
    margin-bottom: 15px;
}

.audiobook-description p:last-child {
    margin-bottom: 0;
}

/* Loading States */
.loading-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error/Notice Styles */
.audiobook-widget-notice {
    background-color: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 0.95rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .audiobook-title {
        font-size: 1.8rem;
    }
    
    .audiobook-cover img {
        height: 250px;
    }
    
    .audiobook-player-container {
        padding: 15px;
    }
    
    .player-controls {
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .play-button {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .progress-container {
        min-width: 120px;
        flex: 1;
    }
    
    .time-display {
        font-size: 0.8rem;
        min-width: 65px;
    }
    
    .volume-bar {
        width: 40px;
    }
    
    .audiobook-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .audiobook-meta p {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .audiobook-widget {
        max-width: 100%;
    }
    
    .audiobook-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .audiobook-cover img {
        height: 100%;
    }
    
    .audiobook-player-container,
    .audiobook-player-standalone {
        padding: 15px;
    }
    
    .player-controls {
        gap: 10px;
    }
    
    .play-button {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .progress-container {
        min-width: 100px;
    }
    
    .time-display {
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    .volume-container {
        display: none; /* Hide volume on very small screens */
    }
    
    .speed-control {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
    
    .download-button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .audiobook-meta {
        padding: 12px 15px;
        text-align: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
.play-button:focus,
.volume-button:focus,
.speed-control:focus,
.download-button:focus {
    outline: 2px solid #FF5C17;
    outline-offset: 2px;
}

.progress-bar:focus-within,
.volume-bar:focus-within {
    outline: 2px solid #FF5C17;
    outline-offset: 2px;
    border-radius: 4px;
}
