/**
 * Podcast Player Styles - Bootstrap-first approach
 * Only custom styles that Bootstrap doesn't provide
 */

/* Podcast Player Wrapper - Prevent horizontal overflow und Shadow-Clipping */
.podcast-player-wrapper {
    overflow-x: hidden;
    width: 100%;
    /* Zusätzlicher Padding für Shadow-Raum */
    padding: 20px 0;
}

/* Container für bessere Shadow-Containment */
.podcast-player-container {
    /* Genügend Raum für Shadow-Effekte */
    padding: 0 20px;
    /* Verhindert Shadow-Overflow */
    overflow: visible;
}

/* Main Player Glass Morphism */
.podcast-main-player {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px); /* Reduced from 20px for better performance */
    /* Optimale Transition-Zeit - sanft aber nicht zu langsam */
    transition: box-shadow 0.5s ease-out, transform 0.4s ease-out !important;
    display: flex;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Basis-Shadow für sanfte Transition */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* AOS Animation fixes - Intelligente Transition-Verwaltung */
.podcast-main-player[data-aos]:not(.aos-animate) {
    /* Deaktiviere nur unsere Hover-Transitions während AOS */
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out !important;
    /* Ensure element stays within bounds during animation */
    max-width: 100%;
    overflow: hidden;
}

.podcast-main-player.aos-animate {
    /* Nach AOS: Aktiviere Hover-Transitions mit kleiner Verzögerung */
    transition: box-shadow 0.5s ease-out, transform 0.4s ease-out, 
                opacity 0.3s ease-out !important;
}

/* Prevent AOS fade-up from causing horizontal overflow */
.podcast-main-player[data-aos="fade-up"]:not(.aos-animate) {
    transform: translateY(30px) !important;
    opacity: 0;
    /* Ensure no horizontal displacement */
    max-width: 100%;
    width: 100%;
}

/* Podcast Artwork Container */
.podcast-artwork {
    position: relative;
    width: 200px;
    height: 200px;
    min-width: 200px;
    background: linear-gradient(135deg, var(--new-green) 0%, var(--new-green-dk) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* Ensure square aspect ratio */
}

/* Podcast Info Section */
.podcast-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .podcast-player-wrapper {
        overflow-x: hidden;
        padding-left: 15px;
        padding-right: 15px;
    }

    .podcast-main-player {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 2rem !important;
        /* Disable backdrop-filter on mobile for better performance */
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98) !important;
        /* Ensure no overflow on mobile */
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
    }

    /* Mobile AOS animation fixes */
    .podcast-main-player[data-aos="fade-up"]:not(.aos-animate) {
        transform: translateY(20px) !important; /* Reduced distance on mobile */
        opacity: 0;
        width: 100%;
        max-width: 100%;
    }

    .podcast-artwork {
        width: 140px;
        height: 140px;
        min-width: 140px;
        aspect-ratio: 1 / 1;
        border-radius: 15px;
    }

    .play-button {
        width: 70px !important;
        height: 70px !important;
        min-width: 70px !important;
        min-height: 70px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2) !important;
    }

    .play-button i {
        font-size: 1.75rem;
        color: var(--new-green);
        margin-left: 3px;
    }

    .podcast-info {
        text-align: center;
    }

    .episode-badge {
        font-size: 0.625rem;
        padding: 0.2rem 0.6rem;
        align-self: center;
        margin: 0 auto 0.5rem;
    }

    .podcast-info h4 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        text-align: center;
    }

    .episode-description {
        font-size: 0.9375rem;
    }

    .episode-meta {
        font-size: 0.75rem;
        justify-content: center;
    }

    .episode-meta .separator {
        margin: 0 0.5rem;
    }

    .podcast-progress-container {
        margin-top: 1rem;
    }


    .podcast-progress-handle {
        opacity: 1; /* Always visible on mobile */
    }

    /* Platform buttons full width on mobile */
    .platform-buttons {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }

    .platform-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .podcast-main-player:hover {
        transform: translateY(-5px);
        /* Einfacher, sanfter Shadow - KISS */
        box-shadow:
            0 16px 40px rgba(0, 0, 0, 0.15),
            0 8px 25px rgba(40, 167, 69, 0.2),
            0 4px 12px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Pulse Effect Animation */
.podcast-main-player.pulse-effect {
    animation: playerPulse 1s ease-out;
}

@keyframes playerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}


/* Play Button Enhancements */
.play-button {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    transition: transform 0.3s ease, background-color 0.3s ease; /* Specific properties for better performance */
    z-index: 10;
    position: relative;
    border: none;
    background: rgba(255, 255, 255, 0.95) !important;
    /* Performance optimization */
    will-change: transform;
    backface-visibility: hidden;
}

.play-button:hover {
    transform: scale(1.1);
    background: white !important;
}

.play-button:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

.play-button i {
    font-size: 1.5rem;
    color: var(--new-green);
    margin-left: 3px; /* Optical centering */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Audio Wave Animation */
.audio-wave {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 30px;
}

.audio-wave span {
    width: 4px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    animation: audioWave 1.5s ease-in-out infinite;
    /* Performance optimization for animations */
    will-change: height, opacity;
    backface-visibility: hidden;
}

.audio-wave span:nth-child(1) { animation-delay: 0.1s; height: 10px; }
.audio-wave span:nth-child(2) { animation-delay: 0.3s; height: 20px; }
.audio-wave span:nth-child(3) { animation-delay: 0.5s; height: 25px; }
.audio-wave span:nth-child(4) { animation-delay: 0.7s; height: 15px; }
.audio-wave span:nth-child(5) { animation-delay: 0.9s; height: 8px; }

.audio-wave span.playing {
    animation: audioWavePlaying 0.8s ease-in-out infinite alternate;
}

@keyframes audioWave {
    0%, 100% { height: 10px; opacity: 0.7; }
    50% { height: 25px; opacity: 1; }
}

@keyframes audioWavePlaying {
    0% { transform: scaleY(0.3); opacity: 0.7; }
    100% { transform: scaleY(1); opacity: 1; }
}

/* Episode Badge */
.episode-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--new-green);
    background: rgba(40, 167, 69, 0.1);
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Episode Title */
.podcast-info h4 {
    font-family: 'Patua One', serif;
    line-height: 1.3;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Episode Meta */
.episode-meta {
    font-size: 0.875rem;
    opacity: 0.8;
}

.episode-meta i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.episode-meta .separator {
    color: #dee2e6;
    font-weight: 300;
}

/* Episode Description */
.episode-description {
    color: #6c757d;
    line-height: 1.6;
}

/* Additional mobile refinements */
@media (max-width: 480px) {
    .podcast-main-player {
        padding: 1rem !important;
        border-radius: 15px !important;
        gap: 0.75rem;
    }

    .podcast-artwork {
        width: 100px;
        height: 100px;
        min-width: 100px;
        aspect-ratio: 1 / 1;
    }

    .play-button {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
    }

    .play-button i {
        font-size: 1.5rem;
    }

    .episode-badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    .podcast-info h4 {
        font-size: 1.25rem;
        line-height: 1.2;
    }

    .episode-description {
        font-size: 0.875rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .show-more-btn {
        font-size: 0.75rem;
    }

    #show-all-episodes {
        font-size: 0.875rem;
    }

    .platform-buttons .platform-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1.5rem !important;
    }
}

/* Show More Button Customization */
.show-more-btn i,
.show-more-modal-btn i {
    transition: transform 0.3s ease;
}

.show-more-btn.expanded i {
    transform: rotate(180deg);
}

/* Progress Bar */
.podcast-progress-container {
    margin-top: 1.25rem;
    width: 100%;
}

.podcast-progress-bar {
    width: 100%;
    height: 24px; /* Larger touch target */
    background: transparent;
    cursor: pointer;
    position: relative;
    margin-bottom: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

/* Visual track */
.podcast-progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    pointer-events: none;
}

.podcast-progress-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    transform: translateY(-50%);
    background: var(--new-green);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

.podcast-progress-bar.dragging .podcast-progress-fill {
    transition: none;
}

.podcast-progress-handle {
    position: absolute;
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--new-green);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 2;
}

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

.podcast-time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6c757d;
    font-family: 'Noto Sans', sans-serif;
}

/* Platform Button Hover Effects */
.platform-btn {
    backdrop-filter: blur(4px); /* Reduced from 10px for better performance */
    transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease; /* Specific properties */
}

/* Disable backdrop-filter on mobile for platform buttons */
@media (max-width: 768px) {
    .platform-btn {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95) !important;
    }
}

.platform-btn:hover {
    transform: translateY(-2px);
}

.platform-btn.spotify:hover {
    background: #1db954 !important;
    border-color: #1db954 !important;
    color: white !important;
}

.platform-btn.apple:hover {
    background: #000 !important;
    border-color: #000 !important;
    color: white !important;
}

.platform-btn.google:hover {
    background: #4285f4 !important;
    border-color: #4285f4 !important;
    color: white !important;
}

/* Episodes Modal Enhancements */
.episodes-modal {
    backdrop-filter: blur(3px); /* Reduced from 5px for better performance */
}

/* Disable modal backdrop-filter on mobile */
@media (max-width: 768px) {
    .episodes-modal {
        backdrop-filter: none;
        background: rgba(0, 0, 0, 0.8) !important;
    }
}

.episodes-modal-close {
    transition: transform 0.2s ease;
}

.episodes-modal-close:hover {
    transform: rotate(90deg);
}

.episode-modal-item {
    transition: all 0.3s ease;
}

.episode-modal-item:hover {
    background: #e9ecef;
    border-color: var(--new-green) !important;
    transform: translateX(5px);
}

.episode-modal-item.playing {
    background: rgba(40, 167, 69, 0.05);
}

.episode-modal-play {
    width: 50px;
    height: 50px;
    border-radius: 50% !important;
    transition: all 0.3s ease;
}

.episode-modal-play:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Notification Toast */
.new-episode-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--new-green);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 100;
    animation: slideIn 0.3s ease-out;
}

.new-episode-notification.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Additional tablet refinements */
@media (max-width: 968px) {
    .episode-badge {
        font-size: 0.7rem;
    }

    .podcast-info h4 {
        font-size: 1.6rem;
    }
}

/* Mobile Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .podcast-progress-handle {
        opacity: 1;
    }

    .episode-modal-item:hover {
        transform: none;
    }

    .episode-modal-item:active {
        transform: scale(0.98);
    }
}

/* Modal Mobile Styles */
@media (max-width: 576px) {
    .episodes-modal .modal-dialog {
        margin: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    .episodes-modal .modal-content {
        min-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .episodes-modal .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
        border-radius: 0;
    }

    .episodes-modal .modal-body {
        padding: 1rem;
    }
}

@media (min-width: 577px) {
    .episodes-modal .modal-dialog {
        margin: 1.75rem auto;
    }

    .episodes-modal .modal-content {
        max-height: calc(100vh - 3.5rem);
    }
}

/* Episodes Modal Button fixes */
.episode-modal-play {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    font-size: 1.25rem !important;
}

@media (max-width: 768px) {
    .episode-modal-item {
        gap: 15px;
    }

    .episode-modal-item:hover {
        transform: none;
    }

    .episode-modal-item:active {
        transform: scale(0.98);
    }

    .episode-modal-info p {
        margin-bottom: 0.5rem;
    }

    .episode-modal-play {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

@media (max-width: 480px) {
    .episode-modal-item {
        padding: 12px;
        gap: 10px;
    }

    .episode-modal-info p {
        display: none;
    }
}
