/*
 Theme Name:   Kadence Child
 Template:     kadence
 Description:  Child Theme mit Off-Canvas Sidebar Navigation + alle bisherigen Features
 Version:      3.2
*/

/* ========================================
   HEADER Z-INDEX FIX
   ======================================== */

#masthead,
.site-header,
.site-header-wrap {
    z-index: 10001 !important;
}

.header-navigation,
.header-navigation-wrap,
.primary-menu-container {
    z-index: 10002 !important;
}

.header-menu .sub-menu,
.primary-navigation .sub-menu {
    z-index: 10003 !important;
}


/* ========================================
   MOBILE TOP BAR (Sidebar Navigation)
   ======================================== */

.musical-mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #fff9f5 0%, #ffffff 100%);
    border-bottom: 3px solid #FC943A;
    padding: 12px 20px;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 12px rgba(252, 148, 58, 0.15);
    /* Keine Verzögerung/Animation beim Ein-/Ausblenden */
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.admin-bar .musical-mobile-topbar {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .musical-mobile-topbar {
        top: 46px;
    }
}

/* Fallback Hamburger Button (wenn kein Musical) */
.sidebar-toggle:not(.mobile-musical-trigger) {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.sidebar-toggle:not(.mobile-musical-trigger):hover {
    background: rgba(252, 148, 58, 0.1);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: #FC943A;
    border-radius: 3px;
    transition: all 0.3s ease;
}


/* ========================================
   MOBILE MUSICAL TRIGGER BUTTON (NEU)
   ======================================== */

.mobile-musical-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    background: white;
    border: 2px solid #FC943A;
    border-radius: 25px;
    padding: 8px 16px 8px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-musical-trigger:hover,
.mobile-musical-trigger:active {
    background: #fff9f5;
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.2);
}

.mobile-musical-trigger .mobile-musical-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FC943A;
    flex-shrink: 0;
}

.mobile-musical-trigger .mobile-musical-title {
    flex: 1;
    text-align: left;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-chevron {
    font-size: 18px;
    color: #FC943A;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

/* Chevron dreht sich wenn Sidebar offen */
.sidebar-toggle.active .mobile-chevron {
    transform: rotate(180deg);
}


/* ========================================
   SIDEBAR OVERLAY
   ======================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}


/* ========================================
   SIDEBAR LAYOUT
   ======================================== */

.musical-sidebar-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: calc(100vh - 100px);
}


/* ========================================
   SIDEBAR
   ======================================== */

.musical-sidebar {
    background: linear-gradient(180deg, #fff9f5 0%, #ffffff 100%);
    border-right: 3px solid #FC943A;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    /* Verhindert Pull-to-Refresh und Overscroll-Bouncing */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Verhindert Pull-to-Refresh wenn Sidebar offen */
body:has(.musical-sidebar.open) {
    overscroll-behavior: none;
}

/* Fallback für Browser ohne :has() Support */
body.sidebar-open {
    overscroll-behavior: none;
}

/* iOS Safe Area Fix für Sidebar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .musical-sidebar {
        padding-bottom: calc(30px + env(safe-area-inset-bottom));
    }
    
    .sidebar-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.musical-sidebar::-webkit-scrollbar {
    width: 6px;
}

.musical-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.musical-sidebar::-webkit-scrollbar-thumb {
    background: rgba(252, 148, 58, 0.3);
    border-radius: 10px;
}

.musical-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(252, 148, 58, 0.5);
}

.sidebar-musical-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 2px solid #FC943A;
}

.sidebar-musical-thumb {
    flex-shrink: 0;
}

.sidebar-musical-thumb img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #FC943A;
}

.sidebar-musical-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.3;
    color: #333;
}

.sidebar-musical-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.sidebar-musical-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}


/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */

.sidebar-navigation {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-nav-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav-group-label {
    font-size: 13px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 10px;
}

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.sidebar-nav-item a:hover {
    background: rgba(252, 148, 58, 0.1);
    border-color: #FC943A;
    transform: translateX(5px);
}

.sidebar-nav-item.active a {
    background: #FC943A;
    color: white;
    font-weight: 600;
    border-color: #e67d29;
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.3);
}

.sidebar-nav-item .nav-icon {
    font-size: 1.5em;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-nav-item .nav-label {
    flex: 1;
}

.nav-active-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}


/* ========================================
   SIDEBAR FOOTER
   ======================================== */

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid #FC943A;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #FC943A;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sidebar-action-btn:hover {
    background: #FC943A;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.3);
}

.sidebar-musical-switcher {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-musical-switcher label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.sidebar-musical-switcher select {
    padding: 10px 12px;
    border: 2px solid #FC943A;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-musical-switcher select:hover,
.sidebar-musical-switcher select:focus {
    border-color: #e67d29;
    outline: none;
    box-shadow: 0 0 0 3px rgba(252, 148, 58, 0.1);
}


/* ========================================
   MAIN CONTENT (Sidebar Layout)
   ======================================== */

.musical-main-content {
    padding: 20px 40px 40px 40px; /* Weniger oben, mehr seitlich */
    max-width: 900px;
    margin: 0 auto;
}

/* Musical-Info Bar im Content */
.content-musical-bar {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #fff9f5 0%, #ffffff 100%);
    border: 2px solid #FC943A;
    border-radius: 25px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(252, 148, 58, 0.1);
    position: relative;
    z-index: 1;
}

/* Auf Mobile: Musical-Info-Bar ausblenden (ist schon in Top Bar) */
@media (max-width: 1023px) {
    .content-musical-bar {
        display: none !important; /* Versteckt auf Mobile - FORCED */
    }
}

.content-musical-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.2);
}

.musical-bar-thumb {
    flex-shrink: 0;
    display: block;
    line-height: 0;
}

.musical-bar-thumb img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FC943A;
    transition: transform 0.3s ease;
}

.content-musical-bar:hover .musical-bar-thumb img {
    transform: scale(1.1);
}

.musical-bar-info {
    flex: 1;
}

.musical-bar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 15px;
    transition: color 0.3s ease;
}

.musical-bar-link:hover {
    color: #FC943A;
}

.musical-bar-icon {
    font-size: 1.2em;
    line-height: 1;
}

.musical-bar-title {
    line-height: 1.3;
}

.page-header-compact {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px; /* Weniger Abstand */
    padding-bottom: 15px; /* Weniger Padding */
    border-bottom: 3px solid #FC943A;
}

.page-header-icon {
    font-size: 3.5em;
    line-height: 1;
}

.page-header-compact h1 {
    margin: 0;
    font-size: 2.5em;
    color: #333;
    line-height: 1.2;
}

.page-content-body {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    margin-bottom: 60px;
}

.page-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.page-navigation-arrows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 60px;
}

.nav-arrow {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff9f5;
    border: 2px solid #FC943A;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.nav-arrow:hover {
    background: #FC943A;
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(252, 148, 58, 0.3);
}

.nav-arrow .arrow {
    font-size: 2em;
    font-weight: bold;
}

.nav-arrow-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-arrow-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.7;
}

.nav-arrow-title {
    font-size: 16px;
    font-weight: 600;
}

.nav-arrow.prev-page {
    justify-content: flex-start;
}

.nav-arrow.next-page {
    justify-content: flex-end;
    text-align: right;
}


/* ========================================
   FALLBACK: Old Styles (für Kompatibilität)
   ======================================== */

/* Breadcrumb (falls noch verwendet) */
.breadcrumb {
    padding: 20px 0;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #FC943A;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #e67d29;
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 8px;
    color: #ccc;
}

.breadcrumb .current {
    color: #333;
    font-weight: 600;
}

/* Musical Badge (falls noch verwendet) */
.musical-badge {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: #fff9f5;
    border-radius: 30px;
    margin-bottom: 30px;
    border: 2px solid #FC943A;
    transition: all 0.3s ease;
}

.musical-badge:hover {
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.2);
    transform: translateY(-2px);
}

.musical-badge a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
}

.musical-badge img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FC943A;
}

.musical-badge span {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

/* Old Page Wrapper (falls noch verwendet) */
.musical-page-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
}

.musical-page-header {
    margin-bottom: 40px;
}

.musical-page-header .header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.musical-page-header .page-icon {
    font-size: 3em;
    line-height: 1;
}

.musical-page-header h1 {
    margin: 0;
    font-size: 2.5em;
    color: #333;
    line-height: 1.3;
}

.musical-page-content {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    margin-bottom: 60px;
}

.musical-page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}


/* ========================================
   SEITENTYP-SPEZIFISCHE STYLES
   ======================================== */

.seitentyp-auffuehrung .musical-page-header,
.seitentyp-auffuehrung .page-header-compact {
    border-left: 5px solid #ff6b6b;
    padding-left: 20px;
}

.seitentyp-musik .musical-page-header,
.seitentyp-musik .page-header-compact {
    border-left: 5px solid #4ecdc4;
    padding-left: 20px;
}

.seitentyp-hoerbuch .musical-page-header,
.seitentyp-hoerbuch .page-header-compact {
    border-left: 5px solid #95e1d3;
    padding-left: 20px;
}

.seitentyp-bilderbuch .musical-page-header,
.seitentyp-bilderbuch .page-header-compact {
    border-left: 5px solid #f38181;
    padding-left: 20px;
}

.seitentyp-basteln .musical-page-header,
.seitentyp-basteln .page-header-compact {
    border-left: 5px solid #ffd93d;
    padding-left: 20px;
}

.seitentyp-aufwaerm .musical-page-header,
.seitentyp-aufwaerm .page-header-compact {
    border-left: 5px solid #6bcf7f;
    padding-left: 20px;
}

.seitentyp-probentipps .musical-page-header,
.seitentyp-probentipps .page-header-compact {
    border-left: 5px solid #a29bfe;
    padding-left: 20px;
}

.seitentyp-eltern .musical-page-header,
.seitentyp-eltern .page-header-compact {
    border-left: 5px solid #fd79a8;
    padding-left: 20px;
}

.seitentyp-downloads .musical-page-header,
.seitentyp-downloads .page-header-compact {
    border-left: 5px solid #74b9ff;
    padding-left: 20px;
}

.seitentyp-lizenzhilfe .musical-page-header,
.seitentyp-lizenzhilfe .page-header-compact {
    border-left: 5px solid #a29bfe;
    padding-left: 20px;
}


/* ========================================
   RESPONSIVE: MOBILE & TABLET
   ======================================== */

@media (max-width: 1023px) {
    
    .musical-mobile-topbar {
        display: flex !important;
    }
    
    .musical-sidebar-layout {
        grid-template-columns: 1fr;
    }
    
    .musical-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 9999;
        box-shadow: none;
    }
    
    .musical-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .musical-main-content {
        padding: 30px 20px;
        transition: transform 0.3s ease;
    }
    
    /* Musical-Info Bar: Kompakter auf Mobile */
    .content-musical-bar {
        padding: 8px 15px;
        gap: 10px;
    }
    
    .musical-bar-thumb img {
        width: 30px;
        height: 30px;
    }
    
    .musical-bar-link {
        font-size: 14px;
    }
    
    .page-header-compact {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header-icon {
        font-size: 2.5em;
    }
    
    .page-header-compact h1 {
        font-size: 1.8em;
    }
    
    .page-navigation-arrows {
        grid-template-columns: 1fr;
    }
    
    .nav-arrow.next-page {
        flex-direction: row-reverse;
        text-align: left;
    }
    
    .musical-page-wrapper {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {
    .musical-main-content {
        padding: 20px 15px;
    }
    
    .page-content-body {
        font-size: 1em;
    }
    
    .nav-arrow {
        padding: 15px;
    }
    
    .nav-arrow .arrow {
        font-size: 1.5em;
    }
    
    .nav-arrow-title {
        font-size: 14px;
    }
    
    .musical-page-header h1 {
        font-size: 1.8em;
    }
}


/* ========================================
   UTILITY CLASSES
   ======================================== */

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

.mt-40 {
    margin-top: 40px;
}

.mb-40 {
    margin-bottom: 40px;
}

.highlight-box {
    background: #fff9f5;
    padding: 25px;
    border-radius: 12px;
    border-left: 5px solid #FC943A;
    margin: 30px 0;
}

.button-primary {
    display: inline-block;
    padding: 12px 30px;
    background: #FC943A;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 2px solid #FC943A;
}

.button-primary:hover {
    background: #e67d29;
    border-color: #e67d29;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 148, 58, 0.4);
}
