/**
 * ACF Dynamic Tabs Widget Styles
 * Dark theme styling matching the design reference
 */

/* ============================================
   CSS Custom Properties (Theme Variables)
   ============================================ */
.acf-dynamic-tabs {
    --tabs-bg: #1a1a1a;
    --tabs-border: #333333;
    --tab-color: #888888;
    --tab-hover-color: #ffffff;
    --tab-active-color: #ffffff;
    --tab-active-indicator: #4CAF50;
    --content-bg: #1a1a1a;
    --content-color: #ffffff;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ============================================
   Main Container
   ============================================ */
.acf-dynamic-tabs {
    font-family: var(--font-family);
    background: var(--tabs-bg);
    border-radius: 8px;
    overflow: hidden;
}

/* ============================================
   Tab Navigation
   ============================================ */
.acf-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--tabs-bg);
    border-bottom: 1px solid var(--tabs-border);
    padding: 0;
    margin: 0;
    list-style: none;
}

.acf-tabs-nav-item {
    margin: 0;
    padding: 0;
}

.acf-tabs-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    color: var(--tab-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    position: relative;
    white-space: nowrap;
}

.acf-tabs-nav-link:hover {
    color: var(--tab-hover-color);
}

.acf-tabs-nav-link.active {
    color: var(--tab-active-color);
}

.acf-tabs-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tab-active-indicator);
}

/* Tab Icon */
.acf-tabs-nav-link i,
.acf-tabs-nav-link svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.acf-tabs-nav-link .tab-icon-circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
}

.acf-tabs-nav-link .tab-icon-circle.filled {
    background: currentColor;
}

/* ============================================
   Tab Content Area
   ============================================ */
.acf-tabs-content {
    background: var(--content-bg);
    padding: 30px;
}

.acf-tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.acf-tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content Title */
.acf-tab-content-title {
    font-size: 32px;
    font-weight: 300;
    font-style: italic;
    color: var(--tab-active-indicator);
    margin: 0 0 30px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tabs-border);
}

/* ============================================
   Track Item Styling
   ============================================ */
.acf-track-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid var(--tabs-border);
}

.acf-track-item:last-child {
    border-bottom: none;
}

.acf-track-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.acf-track-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.acf-track-info {
    flex: 1;
}

.acf-track-title {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.acf-track-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: #888888;
}

.acf-track-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.acf-track-price {
    font-size: 18px;
    font-weight: 500;
    color: var(--tab-active-indicator);
    white-space: nowrap;
}

/* ============================================
   Empty Tab Message
   ============================================ */
.acf-empty-tab-message {
    color: var(--tab-color);
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

/* ============================================
   Multi-Video Grid
   ============================================ */
.acf-video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* 2 Videos: side-by-side */
.acf-video-grid.videos-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* 3+ Videos: 2 columns on desktop */
.acf-video-grid.videos-3,
.acf-video-grid.videos-4,
.acf-video-grid.videos-5,
.acf-video-grid.videos-6 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .acf-video-grid.videos-2,
    .acf-video-grid.videos-3,
    .acf-video-grid.videos-4,
    .acf-video-grid.videos-5,
    .acf-video-grid.videos-6 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Embed Containers
   ============================================ */
.acf-embed-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* Video Embeds (YouTube, Vimeo) - aspect-ratio statt padding-bottom Trick */
.acf-embed-container.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

/*
 * Überschreibt den WordPress oEmbed-Wrapper (.iframe-wrap)
 * der manchmal mit padding-bottom: NaN% hinzugefügt wird.
 * Dieser !important ist nötig, da WordPress Inline-Styles nutzt.
 */
.acf-embed-container.video-embed > div {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
}

.acf-embed-container.video-embed iframe,
.acf-embed-container.video-embed > div > iframe,
.acf-embed-container.video-embed object,
.acf-embed-container.video-embed embed {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 8px;
}

/* Spotify Embed */
.acf-embed-container.spotify-embed iframe {
    width: 100%;
    min-height: 352px;
    border: none;
    border-radius: 12px;
}

.acf-embed-container.spotify-embed.compact iframe {
    min-height: 152px;
}

/* SoundCloud Embed */
.acf-embed-container.soundcloud-embed iframe {
    width: 100%;
    min-height: 166px;
    border: none;
    border-radius: 8px;
}

.acf-embed-container.soundcloud-embed.visual iframe {
    min-height: 300px;
}

/* SoundCloud Profile Embed (All Tracks) */
.acf-embed-container.soundcloud-embed.profile-embed iframe {
    min-height: 400px;
}

.acf-embed-container.soundcloud-embed.profile-embed.visual iframe {
    min-height: 450px;
}

/* ============================================
   Post Content Styling
   ============================================ */
.acf-post-content {
    color: var(--content-color);
    line-height: 1.7;
}

.acf-post-content p {
    margin-bottom: 1.5em;
}

.acf-post-content h1,
.acf-post-content h2,
.acf-post-content h3,
.acf-post-content h4 {
    color: #ffffff;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.acf-post-content a {
    color: var(--tab-active-indicator);
    text-decoration: none;
}

.acf-post-content a:hover {
    text-decoration: underline;
}

.acf-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    /* Nav: Icons nebeneinander, gleichmäßig verteilt */
    .acf-tabs-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-around;
        border-bottom: 1px solid var(--tabs-border);
    }

    .acf-tabs-nav-item {
        flex: 1;
    }

    .acf-tabs-nav-link {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px 4px;
        gap: 0;
        border-bottom: none;
        width: 100%;
    }

    /* Tab-Name ausblenden – nur Icon sichtbar */
    .acf-tabs-nav-link .tab-label {
        display: none;
    }

    /* Icon etwas größer für bessere Tappbarkeit */
    .acf-tabs-nav-link i,
    .acf-tabs-nav-link svg {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }

    .acf-tabs-nav-link .tab-icon-circle {
        width: 10px;
        height: 10px;
    }

    /* Aktiver Tab: Unterstrich wieder sichtbar (horizontal) */
    .acf-tabs-nav-link.active::after {
        display: block;
    }

    .acf-tabs-nav-link.active {
        background: transparent;
        border-left: none;
    }

    .acf-tabs-content {
        padding: 20px;
        /* Wichtig: overflow sichtbar lassen, damit Video-iframes nicht abgeschnitten werden */
        overflow: visible;
    }

    /* Video-Container braucht auf Mobile einen sichtbaren overflow-Kontext */
    .acf-tab-panel {
        overflow: visible;
    }

    /* Sicherstellen, dass der Haupt-Container Videos nicht abschneidet */
    .acf-dynamic-tabs {
        overflow: visible;
    }

    .acf-tab-content-title {
        font-size: 24px;
    }

    .acf-track-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .acf-track-price {
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .acf-tabs-nav-link {
        padding: 10px 2px;
    }

    .acf-tabs-nav-link i,
    .acf-tabs-nav-link svg {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }

    .acf-tabs-content {
        padding: 15px;
    }

    .acf-track-image {
        width: 60px;
        height: 60px;
    }
}

/* ============================================
   Light Theme Variant
   ============================================ */
.acf-dynamic-tabs.light-theme {
    --tabs-bg: #ffffff;
    --tabs-border: #e0e0e0;
    --tab-color: #666666;
    --tab-hover-color: #333333;
    --tab-active-color: #333333;
    --content-bg: #ffffff;
    --content-color: #333333;
}

/* ============================================
   Elementor Editor Preview
   ============================================ */
.elementor-editor-active .acf-dynamic-tabs {
    min-height: 200px;
}

.elementor-editor-active .acf-tab-panel {
    display: none;
}

.elementor-editor-active .acf-tab-panel:first-child {
    display: block;
}