/* Glass Menu and Control Center Styles */

.control-center {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
    opacity: 0.9;
}

.control-center:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

.menu-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1920px;
    margin: 0 auto;
    gap: 20px;
}

.control-center__categories {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    padding: 0 20px;
    min-height: 48px;
    align-items: center;
}

.control-center__categories .ios-segmented {
    max-width: 760px;
    width: 100%;
}

.control-center__categories .ios-segmented--content {
    width: 100%;
}

.search-container {
    flex: 0 0 auto;
    min-width: 300px;
    max-width: 400px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Animated Logo Styles */
.animated-logo {
    display: flex;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.word {
    display: flex;
    overflow: hidden;
}

.letter {
    display: inline-block;
    opacity: 0; /* Hidden initially, shown via animation */
    transform: translateY(20px);
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.year-display {
    background: var(--accent);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.scroll-status {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 165, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1001;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 1;
    transition: opacity 2s ease-out;
    white-space: nowrap;
}

.scroll-status.fade-in {
    opacity: 1;
    transition: opacity 1s ease-in;
}
.scroll-status.fade-out {
    opacity: 0;
    transition: opacity 3s ease-out;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.menu-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Wrapper to unify hover/focus context for settings button + panel */
.settings-wrapper {
    position: relative;
    display: inline-block;
}

/* Make panel appear only when JS marks wrapper open. JS handles focus open/close state. */
.settings-wrapper.open > .settings-panel {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.menu-button, .settings-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
}

.menu-button:hover, .settings-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 100%;
    right: 0;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    pointer-events: none;
    will-change: transform, opacity;
    transform-origin: top right;
    z-index: 9999;
    /* Black blurred transparent 50% background */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 16px; /* keep spacing here */
}

/* Visibility is controlled by wrapper hover/focus. No .hidden toggle needed. */

.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.setting-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    position: relative;
    transform: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.setting-group .setting-control {
    margin-top: 6px;
    position: relative !important;
    transform: none !important;
}

.setting-group .setting-control .ios-segmented {
    width: 100%;
    position: relative !important;
    transform: none !important;
}

.setting-group .setting-control * {
    transform: none !important;
}

.setting-group .setting-control .ios-segmented__thumb {
    position: absolute;
}

.setting-group select:focus {
    outline: none;
    border-color: rgba(0, 122, 255, 0.5);
    transform: none;
}

.setting-group select:active {
    transform: none;
}

.setting-group select option {
    background: var(--card-bg);
    color: var(--text-primary);
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-container span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Segmented Controls in Settings Panel */
.settings-panel .qui-segmented-control {
    margin-top: 5px;
    font-size: 12px;
}

.settings-panel .qui-segment {
    padding: 0.4rem 0.6rem;
    font-size: 12px;
    min-width: 50px;
}

.content-type-segmented.ios-segmented {
    max-width: 200px;
    position: relative !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    /* Equalize segments visually when using distribution: fill */
    gap: 8px;
}

.content-type-segmented .ios-segmented__option {
    flex: 1 1 0 !important;
    text-align: center !important;
    justify-content: center !important;
    min-width: unset !important;
}

.content-type-segmented .ios-segmented__thumb {
    /* Let base styles handle positioning and allow JS to animate left/top */
    position: absolute;
}

.sort-quick-segmented.qui-segmented-control {
    max-width: none;
}

.sort-quick-segmented .qui-segment {
    min-width: 55px;
    font-size: 11px;
    padding: 0.3rem 0.4rem;
}

/* Category Sidebar */
.category-sidebar {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 260px;
    max-height: calc(100vh - 120px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 999;
    padding: 20px;
    overflow-y: auto;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    transform-origin: top right;
}

.category-sidebar:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.category-sidebar h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.category-btn {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    text-align: left;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.category-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.home-btn {
    background: rgba(0, 122, 255, 0.2) !important;
    border: 2px solid rgba(0, 122, 255, 0.4) !important;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 15px;
}

.home-btn:hover {
    background: rgba(0, 122, 255, 0.3) !important;
    transform: translateX(5px) scale(1.02);
    border-color: rgba(0, 122, 255, 0.6) !important;
}

.home-btn.active {
    background: rgba(0, 122, 255, 0.4) !important;
    border-color: rgba(0, 122, 255, 0.8) !important;
}

.category-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px 0;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.4);
}

/* Year Slider Container */
.year-slider-container {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    width: calc(100vw / 3) !important;
    min-width: 200px;
    max-width: none;
    padding: 8px 12px;
}

/* iOS-style Year Slider */
.year-slider-ios {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.year-slider-ios__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.year-slider-ios__label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.year-slider-ios__value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.year-slider-ios__range {
    appearance: none;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    position: relative;
    transition: box-shadow 0.2s ease;
}

.year-slider-ios__range:focus {
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.year-slider-ios__range::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 22px rgba(79, 140, 255, 0.35), 0 0 0 8px rgba(79, 140, 255, 0.15);
    transition: transform 120ms ease, box-shadow 160ms ease;
    cursor: pointer;
}

.year-slider-ios__range::-webkit-slider-thumb:active {
    transform: scale(1.06);
    box-shadow: 0 14px 26px rgba(79, 140, 255, 0.38), 0 0 0 12px rgba(79, 140, 255, 0.18);
}

.year-slider-ios__ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* Legacy Year Slider Styles for Compatibility */

.year-slider-inline {
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
}

.year-slider-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
    color: var(--text-secondary);
}

.year-slider-label--min {
    align-items: flex-start;
    text-align: left;
}

.year-slider-label--max {
    align-items: flex-end;
    text-align: right;
}

.year-slider-label__title {
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.7;
}

.year-slider-label__value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.year-slider-core {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.year-slider-current {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--accent);
}

.year-slider-current__label {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.7;
}

.year-slider-current__value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.year-slider-track {
    width: 100%;
}

.year-range-input {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: box-shadow 0.2s ease;
}

.year-range-input:focus {
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.year-range-input::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 999px;
    background: transparent;
}

.year-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.year-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.year-range-input::-moz-range-track {
    height: 10px;
    border-radius: 999px;
    background: transparent;
}

.year-range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.year-range-input::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.year-range-input::-ms-track {
    height: 10px;
    border-radius: 999px;
    background: transparent;
    color: transparent;
}

.year-range-input::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .menu-content {
        padding: 12px 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .logo-section h1 {
        font-size: 1.2rem;
    }

    .control-center__categories {
        width: 100%;
        padding: 0;
    }

    .control-center__categories .ios-segmented {
        width: 100%;
    }
    
    .scroll-status {
        top: 60px;
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    
    .settings-panel {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .category-sidebar {
        width: 250px;
    }
    
    .year-slider-container {
        bottom: 10px;
        width: calc(100vw / 3) !important;
        min-width: 180px;
        max-width: none;
        padding: 6px 10px;
    }

    .year-slider-ios {
        gap: 12px;
    }

    .year-slider-ios__label {
        font-size: 0.8rem;
    }

    .year-slider-ios__value {
        font-size: 1.2rem;
    }

    .year-slider-ios__ticks {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .year-slider-container {
        width: calc(100vw / 3) !important;
        min-width: 150px;
        max-width: none;
        padding: 8px;
    }

    .year-slider-ios {
        gap: 10px;
    }

    .year-slider-ios__label {
        font-size: 0.75rem;
    }

    .year-slider-ios__value {
        font-size: 1.1rem;
    }

    .year-slider-ios__ticks {
        font-size: 0.65rem;
    }

    .control-center__categories .ios-segmented {
        gap: 6px;
    }
}