/* Base Styles */
html {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Roboto Condensed', sans-serif;
    background: var(--app-bg);
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

/* Glassmorphism Header */
:root {
    --app-bg: linear-gradient(to top right, #ffc75f, #ff8a75);
    --header-bg: rgba(0, 0, 0, 0.2);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-color: #64ffda;
    --header-height-desktop: 50px;
    --header-height-mobile: 90px;
    --menu-bg: var(--header-bg);
    --menu-text: #ffffff;
}

/* Themes */
body.theme-sunrise {
    --app-bg: linear-gradient(to top right, #ffc75f, #ff8a75);
    --header-bg: rgba(0, 0, 0, 0.2);
}

body.theme-dark-night {
    --app-bg: linear-gradient(to top right, #000000, #0a192f);
    --header-bg: rgba(255, 255, 255, 0.1);
}

body.theme-deep-ocean {
    --app-bg: linear-gradient(to top right, #0f2027, #2c5364);
    --header-bg: rgba(0, 0, 0, 0.3);
}

body.theme-rain-forest {
    --app-bg: linear-gradient(to top right, #71b280, #134e5e);
    --header-bg: rgba(0, 0, 0, 0.3);
}



.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: none;
    border-radius: 0 0 30px 30px;
    /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); */
    padding: 0 24px;
    transition: all 0.3s ease;
    height: var(--header-height-desktop);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Great Vibes', cursive;
    font-size: 38px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    flex-shrink: 0;
}

.app-logo {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.nav-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
    flex: 1;
    /* Take remaining space */
    margin-left: 12px;
}

.app-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    scroll-behavior: smooth;
    padding: 0 4px;
    /* Space for focus rings */
}

.app-nav::-webkit-scrollbar {
    display: none;
}

.nav-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32px;
    border: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
    transition: color 0.2s;
}

.nav-scroll-btn:hover {
    color: var(--text-primary);
}

.nav-scroll-btn.left {
    left: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
}

.nav-scroll-btn.right {
    right: 0;
    background: linear-gradient(-90deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
}

.nav-scroll-btn .material-icons {
    font-size: 20px;
}

.app-nav>div {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 16px;
    margin: 0 2px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Highlighter Underline */
.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    /* Already 0, but parent height is 100% of header */
    left: 0;
    width: 100%;
    height: 3px;
    /* Slightly thicker */
    background: #ffffff;
    /* White */
    transform: scaleX(0);
    transform-origin: bottom center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.8), 0 0 5px rgba(255, 255, 255, 0.5);
    /* Glowing white */
}

.nav-btn:hover::after,
.nav-btn.active::after {
    transform: scaleX(1);
}

.nav-btn:hover,
.nav-btn.active {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    /* Glowing text */
    opacity: 1;
    background: transparent;
    transform: none;
}

/* Existing Components */
#note {
    font-size: 164px;
    display: inline-block;
    height: 180px;
    text-align: left;
}

.droptarget {
    background-color: #348781
}

div.confident {
    color: #e0e0e0;
}

div.vague {
    color: #555;
}

#detector,
#output,
#flat,
#sharp {
    display: none;
}

.flat #flat,
.sharp #sharp {
    display: inline;
}

#pitchCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    width: 100vw;
    height: 100vh;
    background: var(--app-bg);
    z-index: 1;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: var(--app-bg);
    color: white;
    font-size: 2em;
    z-index: 10;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.5s;
}

#marquee-container {
    position: absolute;
    top: 90px;
    /* Adjusted for header */
    left: 30px;
    right: 30px;
    height: 60px;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.note-bubble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-right: 10px;
    flex-shrink: 0;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.2);
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .glass-header {
        height: auto;
        padding: 4px 16px 8px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2) !important;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .app-brand {
        width: 100%;
        justify-content: flex-start;
        /* Logo left */
    }

    /* Mobile specific adjustments */
    .menu-btn {
        background: transparent;
        border: none;
        color: #ffffff;
        padding: 10px 12px;
        text-align: left;
        cursor: pointer;
        width: 100%;
        border-radius: 8px;
        font-family: 'Roboto Condensed', sans-serif;
        font-size: 15px;
        transition: background 0.2s ease;
        box-sizing: border-box;
        line-height: normal;
    }

    .menu-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Mobile adjustments */
    .nav-wrapper {
        width: 100%;
        margin-left: 0;
        padding: 0 30px;
        /* Space for arrows */
        box-sizing: border-box;
    }

    .app-nav {
        width: 100%;
        padding-bottom: 0;
    }

    .nav-btn {
        background: rgba(255, 255, 255, 0.05);
        padding: 8px 16px;
        font-size: 13px;
    }

    #marquee-container {
        top: 120px;
        /* Push down for taller mobile header */
    }

    .nav-scroll-btn {
        display: flex !important;
        background: transparent !important;
        color: white !important;
        width: 24px;
        height: 100%;
        align-items: center;
        justify-content: center;
        z-index: 20;
    }

    .nav-scroll-btn .material-icons {
        font-size: 24px;
        text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    }

    .nav-scroll-btn.left {
        left: 0;
        background: transparent !important;
    }

    .nav-scroll-btn.right {
        right: 0;
        background: transparent !important;
    }
}

/* Floating Menus */
.floating-menu {
    position: fixed;
    /* top/left set by JS */
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    /* Darker background for visibility */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px;
    /* Reduced padding */
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.15);
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
    /* Reduced min-width */
}

/* Specific styles for slider menus to be slim */
#mic-slider-container,
#zoom-slider-container {
    min-width: 40px !important;
    width: fit-content;
    padding: 12px 6px;
}

#mic-slider-container .menu-note,
#zoom-slider-container .menu-note {
    display: none;
}

/* Triangle pointer */
.floating-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    .floating-menu {
        position: fixed;
        /* top and left will be set by JS */
        transform: none;
        width: auto;
        max-width: 90vw;
    }

    /* Restore triangle pointer */
    .floating-menu::before {
        display: block;
        /* Allow JS to position arrow if needed, or default center */
        left: var(--arrow-left, 50%);
    }
}

/* Menu UI Refinements */
.menu-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    border-radius: 8px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 15px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    box-sizing: border-box;
    line-height: normal;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.menu-note {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-style: italic;
    text-align: center;
}

/* Stop Button */
.menu-btn.stop-btn {
    background: rgba(211, 47, 47, 0.2);
    border: 1px solid rgba(211, 47, 47, 0.5);
    color: #ffcdd2;
    margin-top: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-btn.stop-btn:hover {
    background: rgba(211, 47, 47, 0.3);
    border-color: rgba(211, 47, 47, 0.7);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.dropdown-selected {
    background-color: rgba(0, 0, 0, 0.6);
    /* Increased opacity */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.dropdown-selected:hover {
    background-color: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
}

.dropdown-selected::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid white;
    margin-left: 8px;
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.9);
    /* Increased opacity */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    margin-top: 4px;
    padding: 4px 0;
    z-index: 1001;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dropdown-options.show {
    display: block;
}

.dropdown-option {
    padding: 8px 12px;
    color: white;
    transition: background 0.2s;
}

.dropdown-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-option.selected {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

/* Tanpura Scale Display */
#tanpuraScaleDisplay {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin-top: 8px;
    padding: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Inputs and Selects */
input {
    font-family: 'Roboto Condensed', sans-serif;
}