/*
 * =================================
 *  Settings Modal - Styles
 * =================================
 */

/* Overlay */
#settings-modal-overlay {
    position: fixed;
    top: 0;
    /* Cover the entire screen including behind logo bar */
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Full viewport height */
    z-index: 1100;
    /* 1100 is above timeline (1000), but below nav-bar (2000) and logo-bar (3000) */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align content to top */
    background: #fbfbfb;
    /* Light grey solid background covers the map */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#settings-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Full-Page Modal Container */
#settings-modal {
    background: transparent;
    /* Rely on overlay background */
    width: 100vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333333;
    /* Dark text for light background */
}

#settings-modal-overlay.visible #settings-modal {
    transform: translateY(0);
    opacity: 1;
}

/* Header */
#settings-modal-header {
    display: none;
    /* Hide header as we use the nav bar top and shouldn't occlude */
}

/* Body: Content */
#settings-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Horizontal Navigation Bar */
#horizontal-nav-bar {
    position: fixed;
    /* Keep it fixed at the top */
    top: 50px;
    /* Below 50px logo bar */
    left: 0;
    width: 100%;
    height: 60px;
    background: #ffffff;
    /* Solid white */
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    /* Center the nav items */
    align-items: center;
    z-index: 2000;
    /* Extremely high z-index to make sure it is clickable and visible */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Always visible on desktop */
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Base visible class for mobile to use */
#horizontal-nav-bar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#nav-items-container {
    display: flex;
    align-items: center;
    gap: 40px;
    /* Increased from 32px for better horizontal balance */
}


.nav-item {
    color: #666;
    /* Darker grey text */
    font-size: 16px;
    font-weight: 500;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    position: relative;
    padding: 18px 0;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    color: #e67e22;
    /* Warm orange for activity */
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #e67e22;
}

#mobile-nav-close-btn {
    display: none;
}

/* Dropdown Sub-menu */
.dropdown-trigger {
    display: flex;
    align-items: center;
    /* Ensures the text and the icon are vertically aligned with themselves */
    gap: 0;
    position: relative;
    padding: 18px 0;
    /* Match padding with .nav-item to keep baseline consistent */
    margin-bottom: 0;
    /* Remove the hacky negative margin */
}

.dropdown-header {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.dropdown-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.dropdown-trigger:hover .dropdown-icon {
    transform: rotate(180deg);
}

/* Because we gave it normal padding above to align baselines, 
   we need to adjust the dropdown content position to avoid hover gap issues */
.dropdown-content {
    position: absolute;
    top: 50px;
    /* Attach exactly below the trigger bounds */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 8px 0;
    z-index: 3000;
}

.dropdown-trigger:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Language Switcher Button Override (Inside Dropdown) */
.dropdown-content .lang-btn {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px 24px;
    color: #5f6368;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    text-align: center;
    width: 100%;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-content .lang-btn:hover {
    background: #fff8f3;
    color: #e67e22;
}

.dropdown-content .lang-btn.active {
    background: #fff0e6;
    /* Softer orange bg */
    color: #d35400;
    font-weight: bold;
}

/* Content Area (One Page Scroll) */
#settings-modal-content-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    /* Enable smooth scrolling here */
    padding-top: 110px;
    /* Offset spacing for the fixed Logo Bar (50) + Nav Bar (60) */
    scroll-padding-top: 110px;
    /* Ensure scrollIntoView accounts for the fixed headers and leaves a 110px gap */
    padding-bottom: 100px;
}

.settings-pane {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 48px;
    min-height: 20vh;
    /* Make sure each block gives enough space to scroll */
    border-bottom: 1px solid #eaeaea;
    /* Light mode border */
}

.settings-pane:last-child {
    border-bottom: none;
    min-height: 30vh;
    /* Give last item space to scroll */
}

.settings-section-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 32px;
    font-weight: 600;
}

/* Unified Pane Elegant Light Theme Styling */
.settings-pane-content {
    background: transparent;
    color: #333333;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.8;
}

/* Markdown Body Overrides for light theme */
.markdown-body {
    background: transparent;
    color: #333333;
    /* Elegant dark grey for readability */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.settings-pane>h1 {
    color: #111111;
    border-bottom: none;
    /* No border for a cleaner look */
    margin-bottom: 32px;
    margin-top: 0;
    font-weight: 600;
}

.markdown-body p,
.markdown-body li {
    line-height: 1.8;
    margin-bottom: 24px;
    font-size: 16px;
    color: #444444;
    /* Slightly softer than pure black for long text */
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body a {
    color: #1a365d;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

/* Placeholder texts */
.coming-soon-text {
    color: #888;
    font-style: italic;
    margin-top: 20px;
}

/* 
 * =================================
 *  Responsive Styles (Mobile Optimization)
 * =================================
 */
@media screen and (max-width: 768px) {
    #horizontal-nav-bar {
        top: 0;
        height: 100vh;
        width: 100vw;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0;
        background: rgba(18, 18, 18, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        z-index: 2900;
        display: flex;
        align-items: center;
        transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;

        /* Hidden by default on mobile */
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }

    /* Disable desktop hover effects on mobile to prevent sticky offsets */
    .dropdown-trigger:hover .dropdown-content {
        opacity: 0;
        visibility: hidden;
        transform: none;
    }

    .dropdown-trigger.mobile-expanded:hover .dropdown-content {
        opacity: 1;
        visibility: visible;
    }

    #nav-items-container {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        padding-top: 8vh;
        /* Push menu items up */
        gap: 10px;
        /* Slightly tighter for cleaner look */
        box-sizing: border-box;
        overflow-y: auto;
        /* Allow scrolling if content is too tall */
        max-height: 100vh;
    }

    .nav-item {
        width: 100%;
        max-width: 320px;
        padding: 8px 0;
        font-size: 20px;
        /* Refined size */
        font-weight: 300;
        font-family: 'Outfit', sans-serif;
        color: #ffffff;
        text-align: center;
        justify-content: center;
        display: flex;
        align-items: center;
        letter-spacing: 2px;
        border-bottom: none !important;
        transition: all 0.4s ease;
        position: relative;
    }

    /* Remove any desktop or default arrows */
    .nav-item::after {
        display: none !important;
    }

    /* Keep active items consistent with others on mobile */
    .nav-item.active {
        color: #ffffff;
        font-weight: 300;
        transform: none;
    }

    /* Active indicator for mobile - a small dot below instead of line */
    /* Remove the dot indicator */
    .nav-item.active::before {
        display: none;
    }

    /* --- Language Dropdown Mobile --- */
    .dropdown-trigger {
        flex-direction: column;
        align-items: center;
        padding: 0;
        cursor: pointer;
        width: 100%;
        background: transparent !important;
    }

    .dropdown-header {
        display: flex;
        flex-direction: column;
        /* Arrow BELOW text as requested */
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 100%;
        padding: 14px 0 8px 0;
        /* Increased top padding from 8px to 14px for visual compensation */
    }

    .dropdown-header span:first-child {
        font-size: 20px;
        color: #ffffff;
        font-family: 'Outfit', sans-serif;
        letter-spacing: 2px;
    }

    /* Kill desktop 'sticky' hover rotation on mobile */
    .dropdown-trigger:hover .dropdown-icon {
        transform: rotate(0deg);
    }

    .dropdown-trigger.mobile-expanded:hover .dropdown-icon {
        transform: rotate(180deg);
    }

    .dropdown-icon {
        font-size: 22px;
        color: rgba(255, 255, 255, 0.4);
        transform: rotate(0deg);
        /* Base state */
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .dropdown-trigger.mobile-expanded .dropdown-icon {
        transform: rotate(180deg);
        color: #ffffff;
    }

    .dropdown-trigger.mobile-expanded .dropdown-header span:first-child {
        color: #ffffff;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        background: transparent !important;
        /* REMOVE BOX BACKGROUND */
        border: none !important;
        /* REMOVE BOX BORDER */
        box-shadow: none !important;
        /* REMOVE BOX SHADOW */
        transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0;
        margin: 0;
        transform: none !important;
        /* KILL DESKTOP OFFSETS */
    }

    .dropdown-trigger.mobile-expanded .dropdown-content {
        max-height: 250px;
        opacity: 1;
        visibility: visible;
        padding: 10px 0 0 0;
    }

    .dropdown-content .lang-btn {
        width: 100%;
        max-width: 200px;
        padding: 10px 0;
        font-size: 17px;
        color: rgba(255, 255, 255, 0.5);
        background: transparent !important;
        border: none;
        font-family: 'Outfit', sans-serif;
        text-align: center;
        transition: all 0.3s ease;
    }

    .dropdown-content .lang-btn.active {
        color: #ffffff;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 8px;
    }

    /* --- Bottom Close Button --- */
    #mobile-nav-close-btn {
        margin-top: 25px;
        width: 52px;
        height: 52px;
        min-height: 52px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
        cursor: pointer;
        padding: 0;
        transition: all 0.3s ease;
    }

    #mobile-nav-close-btn:active {
        transform: scale(0.9);
        background: rgba(255, 255, 255, 0.15);
    }

    #mobile-nav-close-btn span {
        font-size: 28px;
        color: #ffffff;
    }

    /* Hide standard top close btn on mobile */

    #settings-modal-content-area {
        padding-top: 60px;
        padding-bottom: 60px;
        scroll-padding-top: 60px;
        /* Accounts for 50px logo-bar + 10px gap */
    }

    #horizontal-nav-bar.visible.mobile-collapsed {
        transform: translateY(-100%);
        pointer-events: none;
        opacity: 0;
    }

    .settings-pane {
        padding: 40px 24px;
    }
}

/* Custom Signature Style */
.signature {
    font-family: 'Dancing Script', cursive;
    font-size: 52px;
    color: #333;
    margin-top: 40px;
    letter-spacing: 0.5px;
}