/* ============================================
   Yay!Timer - Standardized Navigation Styles
   ============================================
   
   This is the SINGLE SOURCE OF TRUTH for all
   navigation styles. Do NOT add navigation CSS
   to individual page <style> blocks.
   
   Conventions:
   - Use opacity/visibility for smooth transitions
   - SVG icons only (no emojis)
   - Mobile accordions use .expanded class (also supports .active/.open for compatibility)
   
   Last Updated: November 24, 2026
   ============================================ */

/* ===========================================
   Where the Desktop Menu Row Starts
   ===========================================
   Below 1280 px the phone menu serves every page, from 1280 px the
   desktop row (Plan_Release_1_Corrections_Terms.md, Phase 13). In most
   languages the row's labels need 820 to 985 px beside the logo, so at
   768 to 1279 px they wrapped onto two lines or made the page wider
   than the screen. The phone menu holds the same links, the language
   list and the theme toggle.
   The pages keep their md:flex and md:hidden classes: the built
   tailwind.css has no lg: or xl: form of them, and each page's inline
   ".hidden" rule outranks Tailwind's layer, so the switch is made here. */
@media (min-width: 768px) and (max-width: 1279.98px) {
    nav .hidden.md\:flex {
        display: none;
    }

    #mobile-menu-button {
        display: inline-block;
    }

    #mobile-menu:not(.hidden) {
        display: block;
    }
}

/* ===========================================
   Desktop Navigation Dropdown
   =========================================== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #374151;
    transition: color 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1rem;
    padding: 0;
}

.dark .nav-dropdown-toggle {
    color: #d1d5db;
}

.nav-dropdown-toggle:hover {
    color: #FF6B6B;
}

.nav-dropdown-chevron {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-content {
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    /* Use opacity/visibility for smooth transitions */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.dark .nav-dropdown-content {
    background: #1f2937;
    border: 1px solid #374151;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-content a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 0.9375rem;
}

.dark .nav-dropdown-content a {
    color: #d1d5db;
}

.nav-dropdown-content a:hover {
    background: #f3f4f6;
    color: #667eea;
}

.dark .nav-dropdown-content a:hover {
    background: #374151;
    color: #a5b4fc;
}

.nav-dropdown-content .dropdown-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: #667eea;
}

.nav-dropdown-content .dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

.dark .nav-dropdown-content .dropdown-divider {
    background: #374151;
}

/* ===========================================
   Language Selector Dropdown
   =========================================== */
.lang-dropdown {
    position: relative;
}

.lang-dropdown-content {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    /* Always-visible scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #9ca3af transparent;
    /* Use opacity/visibility for smooth transitions */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* WebKit always-visible scrollbar */
.lang-dropdown-content::-webkit-scrollbar {
    width: 6px;
}
.lang-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}
.lang-dropdown-content::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 3px;
}
.lang-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.dark .lang-dropdown-content {
    background: #1f2937;
    border: 1px solid #374151;
    scrollbar-color: #4b5563 transparent;
}

.dark .lang-dropdown-content::-webkit-scrollbar-thumb {
    background: #4b5563;
}
.dark .lang-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.lang-dropdown:hover .lang-dropdown-content,
.lang-dropdown:focus-within .lang-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown-content a {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s ease;
}

.dark .lang-dropdown-content a {
    color: #d1d5db;
}

.lang-dropdown-content a:hover {
    background: #f3f4f6;
}

.dark .lang-dropdown-content a:hover {
    background: #374151;
}

.lang-dropdown-content a.active {
    background: #667eea;
    color: white;
}

/* ===========================================
   Mobile Navigation Accordion
   =========================================== */
.mobile-nav-accordion {
    border-top: 1px solid #e5e7eb;
    padding-top: 0.5rem;
}

.dark .mobile-nav-accordion {
    border-top-color: #374151;
}

.mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
    font-size: 1rem;
    text-align: left;
}

.dark .mobile-nav-toggle {
    color: #d1d5db;
}

.mobile-nav-toggle:hover {
    color: #667eea;
}

.mobile-nav-chevron {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.3s ease;
}

.mobile-nav-chevron.expanded,
.mobile-nav-chevron.active {
    transform: rotate(180deg);
}

/* Also support SVG rotation inside toggle button */
.mobile-nav-toggle.active svg,
.mobile-nav-toggle.expanded svg {
    transform: rotate(180deg);
}

.mobile-nav-list {
    display: none;
    padding-left: 1rem;
    padding-bottom: 0.5rem;
}

.mobile-nav-list.expanded,
.mobile-nav-list.active,
.mobile-nav-list.open {
    display: block;
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 0.9375rem;
}

.dark .mobile-nav-list a {
    color: #9ca3af;
}

.mobile-nav-list a:hover {
    color: #667eea;
}

.mobile-nav-list .dropdown-icon {
    width: 1rem;
    height: 1rem;
    color: #667eea;
}

/* ===========================================
   Mobile Language Accordion
   =========================================== */
.mobile-lang-accordion {
    border-top: 1px solid #e5e7eb;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.dark .mobile-lang-accordion {
    border-top-color: #374151;
}

.mobile-lang-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
}

.dark .mobile-lang-toggle {
    color: #d1d5db;
}

.mobile-lang-toggle:hover {
    color: #667eea;
}

.mobile-lang-toggle-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-lang-chevron {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.3s ease;
}

.mobile-lang-chevron.expanded,
.mobile-lang-chevron.active {
    transform: rotate(180deg);
}

.mobile-lang-list {
    display: none;
    padding-left: 1.75rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    /* Always show scrollbar */
    overflow-y: scroll;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #9ca3af transparent; /* Firefox: thumb track */
}

/* Webkit browsers (Chrome, Safari, Edge) - always visible scrollbar */
.mobile-lang-list::-webkit-scrollbar {
    width: 6px;
}

.mobile-lang-list::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-lang-list::-webkit-scrollbar-thumb {
    background-color: #9ca3af;
    border-radius: 3px;
}

.dark .mobile-lang-list {
    scrollbar-color: #6b7280 transparent; /* Firefox dark mode */
}

.dark .mobile-lang-list::-webkit-scrollbar-thumb {
    background-color: #6b7280;
}

.mobile-lang-list.expanded,
.mobile-lang-list.active {
    display: block;
}

.mobile-lang-list a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    color: #374151;
    text-decoration: none;
    transition: color 0.2s ease;
}

.dark .mobile-lang-list a {
    color: #d1d5db;
}

.mobile-lang-list a:hover {
    color: #667eea;
}

.mobile-lang-list a.active {
    color: #667eea;
    font-weight: 600;
}

/* ===========================================
   Active Page Indicator
   =========================================== */
.nav-link-active {
    color: #FF6B6B !important;
    font-weight: 500;
}

/* ===========================================
   Back to Top Button
   =========================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 50;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ===========================================
   Breadcrumb Styles
   =========================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-wrap: wrap;
}

/* The guides' breadcrumb (`nav.breadcrumb-nav > ol.flex`) wraps too: on a
   phone a long last item ("Trainingsprogramme") went past the screen
   (Plan_Release_1_Corrections_Terms.md, Phase 13). */
.breadcrumb-nav ol {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

.dark .breadcrumb {
    color: #9ca3af;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.breadcrumb-separator {
    color: #9ca3af;
}

.dark .breadcrumb-separator {
    color: #6b7280;
}

.breadcrumb-current {
    color: #374151;
    font-weight: 500;
}

.dark .breadcrumb-current {
    color: #e5e7eb;
}
