/* Main Layout - Floating Sidebar Design */
@import url("CMSerif.css");

/* IBM Plex Sans - Variable font with weight axis (100-700) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@100..700&display=swap');

/* CSS Variables */
:root {
    /* UI Font (sans-serif for buttons, badges, nav, etc.) */
    --ui-font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Variable font weight settings */
    --ui-font-weight-normal: 400;
    --ui-font-weight-medium: 500;
    --ui-font-weight-semibold: 600;

    /* Dashboard panel text (matches nav labels: 14px, 400 weight) */
    --dashboard-text-weight: 400;
    --dashboard-text-size: 14px;
    --border-radius: 10px;
    --nav-transition-length: 0.3s;
    --shadow-color: rgba(0, 0, 0, 0.04);
    --fill-color-1: rgb(235, 235, 235);
    --fill-color-2: #ffffff;
    --text-color-1: black;
    --text-color-2: rgba(0, 0, 0, 0.521);
    --active-color: rgb(160, 218, 0);
    --highlighted-block-fill-color: rgba(255, 221, 0, 0.158);
    --proposition-color: rgb(212, 184, 0);
    --definition-color: #ff9b88;
    --définition-color: #ff9b88;

    /* Code syntax highlighting (dark theme) */
    --code-default-color: #FFE8CA;
    --code-blue: #00D0FF;
    --code-string-yellow: #FFE127;
    --code-comment-grey: #737373;
    --code-number-orange: #C97DFF;
    --code-operator-orange: #FF0071;
    --code-punctuation-blue: white;
    --code-border-color: #3a3a3a;
    --code-function-color: #93E600;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: CMSerif, 'Times New Roman', serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background-color: #000;
}

html {
    touch-action: pan-x pan-y;
}

/* Floating Sidebar */
.floating-sidebar {
    position: fixed;
    left: 20px;
    top: 20px;
    bottom: 20px;
    width: 240px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.9) 0%, rgba(28, 28, 40, 0.88) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    padding-bottom: 14px;
    user-select: none;
    -webkit-user-select: none;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.3em;
    color: white;
    text-decoration: none;
    margin: 25px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 18px;
}

.sidebar-logo .logo-icon {
    display: none;
    width: 28px;
    height: 28px;
    filter: invert(1);
    opacity: 0.9;
}

.sidebar-section-label {
    font-family: var(--ui-font);
    font-size: 11px;
    font-variant: small-caps;
    text-transform: lowercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    padding: 15px 20px 8px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-nav li.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #a0da00;
}

.sidebar-nav li:focus {
    outline: none;
}

.sidebar-nav li:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    box-shadow: inset 0 0 0 2px rgba(160, 218, 0, 0.6);
}

/* Subscribe button - accent styling */
.sidebar-nav li.nav-subscribe {
    background: linear-gradient(135deg, rgba(160, 218, 0, 0.15), rgba(120, 180, 0, 0.1));
    border-left: 3px solid rgba(160, 218, 0, 0.5);
    color: #a0da00;
}

.sidebar-nav li.nav-subscribe:hover {
    background: linear-gradient(135deg, rgba(160, 218, 0, 0.25), rgba(120, 180, 0, 0.15));
    color: #b8f000;
}

.sidebar-nav li.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-nav li.disabled:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav .nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    opacity: 0.8;
    pointer-events: none;  /* Clicks pass through to parent li */
}

.sidebar-nav .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.sidebar-nav .nav-icon {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

.sidebar-nav .nav-label {
    font-family: var(--ui-font);
    font-size: 14px;
    pointer-events: none;  /* Clicks pass through to parent li */
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    margin-top: 10px;
}

.sidebar-bottom li[data-action="logout"] {
    color: rgba(255, 100, 100, 0.7);
}

.sidebar-bottom li[data-action="logout"]:hover {
    color: rgb(255, 100, 100);
    background: rgba(255, 100, 100, 0.1);
}

/* Content Area */
.content-area {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

/* Views */
.view {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* Dashboard View */
#dashboard-view {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: auto;
    padding: 40px;
    padding-left: 300px;  /* 260px sidebar + 40px margin */
    position: relative;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    color: white;
    font-weight: normal;
    margin-bottom: 8px;
}

.dashboard-header .subtitle {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.5);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Admin View */
#admin-view {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: auto;
    padding: 40px;
    padding-left: 300px;  /* 260px sidebar + 40px margin */
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: rgba(255,255,255,0.5);
}

.admin-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #ef4444;
}

/* Panel Cards (shared between dashboard and settings) */
.dashboard-card,
.settings-card {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 18px 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 4px inset rgba(255, 255, 255, 0.07), 0 0 56px inset rgba(100, 100, 100, 0.1);
}

.dashboard-card h2,
.settings-card h2 {
    font-family: var(--ui-font);
    font-size: 1rem;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card h2 {
    margin-bottom: 16px;
}

.dashboard-card h2 svg,
.settings-card h2 svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    transform: translateY(0px);
}

/* Recent Documents */
.recent-list {
    list-style: none;
}

.recent-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.recent-list li:hover {
    background: rgba(255, 255, 255, 0.02);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 6px;
}

.recent-list li:last-child {
    border-bottom: none;
}

.recent-list .doc-title {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: white;
}

.recent-list .doc-time {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.4);
}

/* Progress Bars */
.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-item {
    display: grid;
    grid-template-columns: 100px 1fr 40px;
    align-items: center;
    gap: 12px;
}

.progress-label {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.7);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a0da00, #7cb800);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-percent {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
}

/* Favorites */
.favorites-list {
    list-style: none;
}

.favorites-list li {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    padding: 10px 12px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: background 0.2s, opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorites-list li:hover {
    background: rgba(255, 255, 255, 0.08);
}

.favorites-list .fav-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorites-list .fav-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 12px;
    flex-shrink: 0;
}

/* Exercises */
.exercises-list {
    list-style: none;
}

.exercises-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.exercises-list li:last-child {
    border-bottom: none;
}

.exercises-list .exercise-chapter {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    display: block;
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}

.exercises-list .exercise-title {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    color: white;
    font-size: var(--dashboard-text-size);
}

/* Streak */
.streak-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.streak-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 90px;
}

.streak-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-number {
    font-family: var(--ui-font);
    font-size: 2.5rem;
    color: #a0da00;
    font-weight: 600;
    line-height: 1;
}

.streak-label {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.3;
}

.streak-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.dashboard-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.dashboard-card .card-header h2 {
    margin-bottom: 0;
}

.streak-nav {
    display: flex;
    gap: 4px;
}

.streak-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.streak-stat .stat-value {
    font-family: var(--ui-font);
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.streak-stat .stat-label {
    font-family: var(--ui-font);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.activity-calendar-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 150px;
    margin-left: auto;
}

.activity-calendar {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.activity-scroll-viewport {
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.activity-calendar-inner {
    transition: transform 0.2s ease;
}

/* Kept for backwards compat - now using .streak-nav */

.activity-nav-btn {
    width: 28px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.activity-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.activity-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.activity-nav-btn svg {
    width: 14px;
    height: 14px;
}

.activity-day-headers {
    display: grid;
    grid-template-columns: 20px repeat(7, 18px);
    gap: 3px;
    margin-bottom: 3px;
}

.activity-day-header {
    font-family: var(--ui-font);
    font-size: 8px;
    color: rgba(255,255,255,0.25);
    text-align: center;
}

.activity-month {
    margin-bottom: 6px;
}

.activity-month-header {
    font-family: var(--ui-font);
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,0.4);
    text-transform: capitalize;
    margin-bottom: 3px;
    padding-left: 23px;
}

.activity-week {
    display: grid;
    grid-template-columns: 20px repeat(7, 18px);
    gap: 3px;
    margin-bottom: 3px;
}

.activity-week-number {
    font-family: var(--ui-font);
    font-size: 8px;
    color: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
}

.activity-day {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    cursor: default;
}

.activity-day.empty {
    background: transparent;
}

.activity-day.active {
    background: #a0da00;
}

.activity-day.partial {
    background: rgba(160, 218, 0, 0.5);
}

.activity-day.today {
    outline: 1px solid rgba(255,255,255,0.5);
    outline-offset: -1px;
}

/* Pomodoro Timer Card */
.timer-card {
    display: flex;
    flex-direction: column;
}

.timer-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.timer-card .card-header h2 {
    margin-bottom: 0;
}

.timer-settings-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.timer-settings-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

.timer-settings-btn svg {
    width: 16px;
    height: 16px;
}

.timer-display {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

.timer-ring {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.timer-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: #a0da00;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease;
}

.timer-card.break .timer-progress {
    stroke: #4ecdc4;
}

.timer-card.long-break .timer-progress {
    stroke: #9b59b6;
}

.timer-time {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--ui-font);
    font-size: 1.5rem;
    font-weight: 500;
    color: white;
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-family: var(--ui-font);
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.timer-controls {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.timer-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, transform 0.1s;
}

.timer-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.timer-btn:active {
    transform: scale(0.95);
}

.timer-btn svg {
    width: 16px;
    height: 16px;
}

.timer-start {
    background: rgba(160, 218, 0, 0.2);
    color: #a0da00;
}

.timer-start:hover {
    background: rgba(160, 218, 0, 0.3);
    color: #b8f000;
}

.timer-settings {
    display: none;
    flex-direction: column;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.timer-settings-text {
    font-family: var(--ui-font);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 2.2;
    margin: 0;
    text-align: center;
}

.timer-settings-text input {
    width: 40px;
    padding: 2px 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-family: var(--ui-font);
    font-size: 13px;
    text-align: center;
    margin: 0 2px;
    color-scheme: dark;
}

.timer-settings-text input:focus {
    outline: none;
    border-color: rgba(160, 218, 0, 0.5);
}

.timer-reset-stats {
    margin-top: 12px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--ui-font);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.timer-reset-stats:hover {
    color: rgba(255, 100, 100, 0.8);
    border-color: rgba(255, 100, 100, 0.3);
    background: rgba(255, 100, 100, 0.05);
}

/* Empty State Styling */
.recent-list li.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 12px;
    cursor: default;
    border-bottom: none;
}

.recent-list li.empty-state:hover {
    background: transparent;
    margin: 0;
    padding: 32px 16px;
}

.empty-state .empty-icon {
    color: rgba(255, 255, 255, 0.2);
}

.empty-state .empty-text {
    font-family: var(--ui-font);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
}

.favorites-list li.empty-state,
.exercises-list li.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    gap: 8px;
    background: transparent !important;
    cursor: default;
    border-bottom: none;
}

/* Dashboard Header Animation */
.dashboard-header h1 {
    will-change: opacity, transform;
}

/* Progress Bar Glow Effect */
.progress-fill {
    box-shadow: 0 0 10px rgba(160, 218, 0, 0.3);
}

/* Sketches View - styles moved to sketch-browser.css */

/* Graph View */
#graph-view {
    background: linear-gradient(160deg, #0a0a12 0%, #12121f 40%, #1a1a28 70%, #0d1117 100%);
}

.graph-header {
    position: absolute;
    left: 300px;
    top: 40px;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.graph-header h1 {
    font-size: 2.5rem;
    color: white;
    font-weight: normal;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 0, 0, 0.6);
}

.graph-header .subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

#graph-container {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

#starfield-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#graph-container:focus {
    outline: none;
}

#graph-container canvas {
    display: block;
}

/* Chapter Sidebar (Right) */
.chapter-sidebar {
    position: fixed;
    right: -400px;
    top: 20px;
    max-height: calc(100vh - 40px);
    width: 340px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.9) 0%, rgba(28, 28, 40, 0.88) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 90;
    padding: 24px;
    overflow-y: auto;
    transition: right 0.3s ease;
}

.chapter-sidebar.open {
    right: 20px;
}

/* Typeahead search mode */
.chapter-sidebar.search-mode .chapter-title {
    font-family: CMSerif, 'Times New Roman', serif;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.typeahead-query {
    color: #a0da00;
    font-family: inherit;
}

.typeahead-cursor {
    color: #a0da00;
    animation: blink 1s infinite;
    font-family: inherit;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typeahead-placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    font-family: inherit;
}

.close-sidebar-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.close-sidebar-btn:hover {
    color: white;
}

.chapter-title {
    font-size: 1.5rem;
    color: white;
    font-weight: normal;
    margin-bottom: 8%;
    padding-right: 40px;
}

.chapter-description {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 30px;
}

.chapter-documents,
.chapter-prereqs {
    margin-bottom: 24px;
}

.chapter-documents h3,
.chapter-prereqs h3 {
    font-size: 0.85rem;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    font-weight: normal;
}

.document-list,
.prereq-list {
    list-style: none;
}

.document-list li {
    /* font-family: var(--ui-font); */
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    transform: translateY(0);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.document-list li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.document-list li:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.document-list li:focus {
    outline: none;
}

.document-list li:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 0 2px rgba(160, 218, 0, 0.6);
}

.document-list li.selected {
    background: rgba(160, 218, 0, 0.15);
    border-top-color: rgba(160, 218, 0, 0.4);
    color: white;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(160, 218, 0, 0.1), 0 0 3px inset rgba(160, 218, 0, 0.2);
}

.document-list li.selected:hover {
    background: rgba(160, 218, 0, 0.18);
}

.document-list li.locked {
    opacity: 0.5;
    cursor: not-allowed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-list li.locked:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.document-list li.locked:active {
    transform: none;
}

.document-list li .lock-icon {
    font-size: 0.85em;
    margin-left: 8px;
}

.prereq-list li {
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.prereq-list li::before {
    content: "\2192";
    margin-right: 8px;
    opacity: 0.5;
}

.last-viewed {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Admin actions in chapter sidebar */
.chapter-admin-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chapter-admin-actions h3 {
    font-size: 0.85rem;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    font-weight: normal;
}

.admin-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-admin {
    font-family: var(--ui-font);
    padding: 10px 14px;
    background: rgba(160, 218, 0, 0.1);
    color: #a0da00;
    border: none;
    border-top: 1px solid rgba(160, 218, 0, 0.35);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(160, 218, 0, 0.05), 0 0 3px inset rgba(160, 218, 0, 0.1);
    transform: translateY(0);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
    text-align: left;
}

.btn-admin:hover {
    background: rgba(160, 218, 0, 0.15);
}

.btn-admin:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(160, 218, 0, 0.05), 0 0 3px inset rgba(160, 218, 0, 0.1);
}

/* Sections list in chapter sidebar */
.chapter-sections {
    margin-bottom: 24px;
}

.chapter-sections h3 {
    font-size: 0.85rem;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    font-weight: normal;
}

.sections-list {
    list-style: none;
    position: relative;
}

.sections-list li {
    padding: 8px 8px;
    margin-bottom: 4px;
    margin-left: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: baseline;
}

.sections-list li:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sections-list li .section-number {
    flex-shrink: 0;
    min-width: 1em;
    margin-right: 1em;
    text-align: right;
    opacity: 0.6;
}

.sections-list li .section-title {
    flex: 1;
}

.sections-list li.subsection {
    padding-left: 24px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.sections-list li.subsection .section-number {
    min-width: 2.5em;
}

.sections-list li.subsection:hover {
    color: rgba(255, 255, 255, 0.8);
}

.sections-list li.subsubsection {
    padding-left: 36px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

.sections-list li.subsubsection .section-number {
    min-width: 3em;
}

.sections-list li.subsubsection:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Non-numbered sections (Section* syntax) */
.sections-list li.no-number .section-number {
    visibility: hidden;
}

.sections-list li.no-number .section-title {
    font-style: italic;
}

.sections-list li.active {
    color: rgba(160, 218, 0, 0.9);
}

.sections-list li.active .section-number {
    opacity: 1;
}

.sections-list li.scroll-to-bottom {
    margin-top: 8px;
    padding-top: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.sections-list li.scroll-to-bottom:hover {
    color: rgba(255, 255, 255, 0.7);
}

.sections-list li.scroll-to-bottom .section-number {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sections-list li.scroll-to-bottom svg {
    opacity: 0.6;
}

/* Reset progress button */
.reset-progress-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 10px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-progress-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

.reset-progress-btn svg {
    width: 12px;
    height: 12px;
}

/* Progress Pill - forward-looking reading indicator */
.sections-list .progress-pill {
    position: absolute;
    left: -4px;  /* Adjust to move pill left/right */
    top: 0;
    width: 10px;
    height: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 5px;
    box-sizing: border-box;
    pointer-events: none;
}

/* Pending block dots - neutral color, fade when read */
.progress-pill .progress-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    position: absolute;
    left: 3px;
    z-index: 2;
    transition: opacity 0.5s ease-out, transform 0.2s ease;
}

/* Read dots fade out and shrink */
.progress-pill .progress-dot.read {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

/* Dots in viewport get bigger and brighter */
.progress-pill .progress-dot.in-view:not(.read) {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
    transform: scale(1.8);
}

/* Section dividers */
.progress-pill .section-divider {
    position: absolute;
    left: 1px;
    width: 8px;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 1;
    transition: background 0.2s ease;
}

.progress-pill .section-divider.near-scroll {
    background: rgba(255, 255, 255, 0.5);
}

/* Scroll position marker - triangle */
.progress-pill .scroll-marker {
    position: absolute;
    left: -4px;
    z-index: 3;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid rgba(255, 255, 255, 0.5);
    transition: top 0.15s ease-out;
    pointer-events: none;
}

/* Favorite markers - diamond shape, always visible, clickable */
.progress-pill .favorite-marker {
    position: absolute;
    left: 2px;
    z-index: 4;
    width: 6px;
    height: 6px;
    background: rgba(255, 200, 100, 0.5);
    transform: rotate(45deg);
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
}

.progress-pill .favorite-marker:hover {
    background: rgba(255, 200, 100, 0.8);
    transform: rotate(45deg) scale(1.2);
}

/* Legacy scroll indicator - fallback */
.sections-list .scroll-indicator {
    position: absolute;
    left: -15px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid rgba(160, 218, 0, 0.9);
    transform: translateY(-60%);
    transition: top 0.15s ease-out;
    opacity: 0;
    pointer-events: none;
}

/* Hidden sidebar state */
.floating-sidebar.hidden {
    transform: translateX(-280px);
    opacity: 0;
    pointer-events: none;
}

/* Hide sidebar when document is open (600-1200px) */
@media (min-width: 601px) and (max-width: 1200px) {
    body.document-open .floating-sidebar {
        transform: translateX(-280px);
        opacity: 0;
        pointer-events: none;
    }

    /* Narrower chapter sidebar to fit alongside document */
    .chapter-sidebar {
        width: 300px;
        right: -320px;
    }

    .chapter-sidebar.open {
        right: 20px;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .floating-sidebar {
        width: 60px;
        padding: 0;
    }

    .sidebar-logo {
        margin: 16px;
        padding: 0;
        border-bottom: none;
    }

    .sidebar-logo .logo-text {
        display: none;
    }

    .sidebar-logo .logo-icon {
        display: block;
    }

    .sidebar-section-label {
        display: none;
    }

    .sidebar-nav .nav-label {
        display: none;
    }

    .sidebar-nav .nav-icon {
        margin-right: 0;
    }

    .sidebar-nav li {
        justify-content: center;
        padding: 15px;
    }

    .sidebar-footer {
        display: none;
    }

    #dashboard-view,
    #search-view,
    #admin-view {
        padding: 40px;
        padding-left: 120px;  /* 20px offset + 60px sidebar + 40px margin */
    }

    .subject-label {
        left: 120px;
    }

    /* Chapter sidebar position adjustments for small tablet */
    .chapter-sidebar {
        left: auto;
        top: 20px;
        bottom: 20px;
        max-height: calc(100vh - 40px);
    }
}

@media (max-width: 600px) {
    .floating-sidebar {
        left: 10px;
        top: auto;
        bottom: 10px;
        width: calc(100% - 20px);
        height: 60px;
        flex-direction: row;
        align-items: center;
        padding: 0 10px;
        border-radius: 12px;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 100;
    }

    /* Smart navbar - hidden when scrolling down on document */
    .floating-sidebar.navbar-hidden {
        transform: translateY(100px);
        opacity: 0;
        pointer-events: none;
    }

    .sidebar-logo,
    .sidebar-section-label,
    .sidebar-footer,
    .nav-subscribe {
        display: none !important;
    }

    /* Hide separator and logout on mobile navbar */
    .sidebar-bottom {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .sidebar-nav li[data-action="logout"] {
        display: none;
    }

    .sidebar-spacer {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        flex: 1;
        justify-content: space-around;
    }

    .sidebar-nav li {
        padding: 10px;
        border-left: none;
        border-bottom: 2px solid transparent;
        touch-action: manipulation;  /* Prevent double-tap zoom delay */
        -webkit-tap-highlight-color: rgba(160, 218, 0, 0.2);
        min-width: 44px;
        min-height: 44px;
    }

    .sidebar-nav li.active {
        border-left-color: transparent;
        border-bottom-color: #a0da00;
    }

    #dashboard-view,
    #search-view {
        padding: 20px;
        padding-bottom: 100px;  /* Extra space for bottom navbar */
    }

    .subject-label {
        left: 20px;
    }

    /* Graph header on mobile */
    .graph-header {
        left: 20px;
        top: 20px;
    }

    .graph-header h1 {
        font-size: 1.8rem;
    }

    /* Chapter sidebar on mobile - full width above bottom navbar */
    .chapter-sidebar {
        width: calc(100% - 20px);
        left: -100%;  /* Hidden off-screen to the left */
        right: auto;
        bottom: 80px;  /* Above bottom navbar */
        top: 20px;
        max-height: none;
        height: auto;
        transition: left 0.3s ease;
    }

    .chapter-sidebar.open {
        left: 10px;  /* Slide in from left */
        right: auto;
    }
}

/* ========================================
   Settings View
   ======================================== */
#settings-view {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: auto;
    padding: 40px;
    padding-left: 300px;  /* 260px sidebar + 40px margin */
}

.settings-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-header {
    margin-bottom: 16px;
}

.settings-header h1 {
    font-size: 2.5rem;
    color: white;
    font-weight: normal;
    margin-bottom: 0;
}

.settings-header .subtitle {
    font-family: var(--ui-font);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0;
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-name {
    font-family: var(--ui-font);
    color: white;
    font-size: 0.95rem;
}

.setting-desc {
    font-family: var(--ui-font);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.setting-note {
    flex-basis: 100%;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: -4px;
}

.setting-item-with-note {
    flex-wrap: wrap;
}

.setting-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.profile-value {
    font-family: var(--ui-font);
    color: white;
    font-size: 0.95rem;
}

/* Theme selector */
.theme-selector {
    display: flex;
    gap: 6px;
}

.theme-option {
    font-family: var(--ui-font);
    width: 44px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.theme-option:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.theme-option:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.theme-option.active {
    background: rgba(160, 218, 0, 0.15);
    border-top-color: rgba(160, 218, 0, 0.3);
    color: #a0da00;
    transform: translateY(2px);
    box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(160, 218, 0, 0.05), 0 0 3px inset rgba(160, 218, 0, 0.1);
}

.theme-option svg {
    width: 18px;
    height: 18px;
}

/* Progress mode selector */
.progress-mode-selector {
    display: flex;
    gap: 6px;
}

.progress-mode-option {
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    font-size: 0.85rem;
}

.progress-mode-option:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.progress-mode-option:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.progress-mode-option.active {
    background: rgba(160, 218, 0, 0.15);
    border-top-color: rgba(160, 218, 0, 0.3);
    color: #a0da00;
    transform: translateY(2px);
    box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(160, 218, 0, 0.05), 0 0 3px inset rgba(160, 218, 0, 0.1);
}

.progress-mode-option svg {
    width: 16px;
    height: 16px;
}

/* Font size control */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.font-size-btn {
    font-family: var(--ui-font);
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.font-size-btn svg {
    width: 18px;
    height: 18px;
}

.font-size-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.font-size-btn:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.font-size-value {
    font-family: var(--ui-font);
    min-width: 50px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Account info */
.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0px;
}

.settings-card-header h2 {
    margin-bottom: 0;
}

.setting-item.account-info {
    padding: 20px 0;
    gap: 16px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.account-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

@media (max-width: 500px) {
    .account-actions {
        margin-left: 0;
        width: 100%;
        margin-top: 12px;
    }
}

.account-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(160, 218, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0da00;
}

.account-avatar svg {
    width: 28px;
    height: 28px;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-name {
    font-family: var(--ui-font);
    font-weight: var(--ui-font-weight-medium);
    color: white;
    font-size: 1rem;
}

.account-email-role {
    font-family: var(--ui-font);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.account-email-role #account-email {
    color: rgba(255, 255, 255, 0.5);
}

.account-email-role #account-role {
    color: rgba(255, 255, 255, 0.4);
}

.subscription-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.subscription-badge {
    font-family: var(--ui-font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: normal;
    letter-spacing: 0.02em;
    line-height: 1;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 3px inset rgba(255, 255, 255, 0.05), 0 0 12px inset rgba(100, 100, 100, 0.08);
    backdrop-filter: blur(4px);
}

.subscription-badge.plan-active {
    background: rgba(var(--active-color-rgb, 195, 255, 20), 0.15);
    color: var(--active-color);
}

.subscription-badge.inactive {
    background: rgba(255, 100, 100, 0.15);
    color: #ff6b6b;
}

/* Setting buttons - matching fold button style */
.setting-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
}

.btn-setting {
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.btn-setting:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.btn-setting:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.btn-setting svg {
    width: 18px;
    height: 18px;
}

.btn-setting.btn-danger {
    color: rgba(255, 100, 100, 0.85);
    border-top-color: rgba(255, 100, 100, 0.25);
    background: rgba(255, 80, 80, 0.12);
}

.btn-setting.btn-danger:hover {
    background: rgba(255, 80, 80, 0.2);
    color: #ff6b6b;
}

.btn-setting-small {
    font-family: var(--ui-font);
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-setting-small:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.btn-setting-small:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 255, 255, 0.05), 0 0 3px inset rgba(255, 255, 255, 0.1);
}

.btn-setting-small svg {
    width: 16px;
    height: 16px;
}

.btn-setting-small.btn-danger {
    color: rgba(255, 100, 100, 0.85);
    border-top-color: rgba(255, 100, 100, 0.25);
    background: rgba(255, 80, 80, 0.12);
}

.btn-setting-small.btn-danger:hover {
    background: rgba(255, 80, 80, 0.2);
    color: #ff6b6b;
}

/* Danger zone card */
.settings-card-danger {
    border: 1px solid rgba(255, 99, 99, 0.64);
    border-top-color: rgba(255, 99, 99, 0.91);
}

.settings-card-danger h2 {
    color: rgba(255, 100, 100, 0.9);
}

.settings-card-danger h2 svg {
    color: rgba(255, 100, 100, 0.7);
}

/* Plan badges */
.subscription-badge.plan-free {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
}

.subscription-badge.plan-monthly,
.subscription-badge.plan-yearly {
    background: rgba(195, 255, 20, 0.12);
    color: var(--active-color);
    border-top-color: rgba(195, 255, 20, 0.4);
}

.subscription-badge.plan-teacher {
    background: rgba(180, 130, 255, 0.12);
    color: #b482ff;
    border-top-color: rgba(180, 130, 255, 0.4);
}

.subscription-badge.plan-admin {
    background: rgba(255, 180, 100, 0.12);
    color: #ffb464;
    border-top-color: rgba(255, 180, 100, 0.4);
}

.subscription-badge.plan-root {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
    border-top-color: rgba(255, 107, 107, 0.4);
}

.subscription-badge.plan-cancelling-active {
    background: rgba(255, 180, 100, 0.12);
    color: #ffb464;
    border-top-color: rgba(255, 180, 100, 0.4);
}

.subscription-badge.plan-cancelling-inactive {
    background: rgba(255, 100, 100, 0.12);
    color: #ff6b6b;
    border-top-color: rgba(255, 100, 100, 0.4);
}

.subscription-control .subscription-badge {
    position: relative;
    margin-right: 14px;
}

/* Separator line after badge when buttons are visible */
.subscription-control .subscription-badge::after {
    content: '';
    position: absolute;
    right: -11px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 1px;
    background: rgba(255, 255, 255, 0.2);
}

/* Hide separator when no buttons are visible */
.subscription-control.no-buttons .subscription-badge {
    margin-right: 0;
}

.subscription-control.no-buttons .subscription-badge::after {
    display: none;
}

.btn-manage-subscription,
.btn-subscribe {
    text-decoration: none;
    /* Ensure consistent sizing for both button and anchor */
    box-sizing: border-box;
    height: 34px;
}

.btn-subscribe {
    background: var(--active-color);
    color: #000;
}

/* Passkey list */
.passkey-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.passkey-empty {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    font-style: italic;
}

.passkey-empty p {
    margin: 0;
}

.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.passkey-item:last-child {
    border-bottom: none;
}

.passkey-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.passkey-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
}

.passkey-icon svg {
    width: 20px;
    height: 20px;
}

.passkey-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.passkey-name {
    font-family: var(--ui-font);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

.passkey-meta {
    font-family: var(--ui-font);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

.passkey-actions {
    display: flex;
    gap: 8px;
}

.btn-passkey-delete {
    font-family: var(--ui-font);
    padding: 8px 14px;
    background: rgba(255, 80, 80, 0.12);
    border: none;
    border-top: 1px solid rgba(255, 100, 100, 0.25);
    border-radius: 6px;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 80, 80, 0.05), 0 0 3px inset rgba(255, 80, 80, 0.1);
    color: rgba(255, 100, 100, 0.85);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-passkey-delete:hover {
    background: rgba(255, 80, 80, 0.2);
    color: #ff6b6b;
}

.btn-passkey-delete:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2), 0 0 32px inset rgba(255, 80, 80, 0.05), 0 0 3px inset rgba(255, 80, 80, 0.1);
}

.btn-passkey-delete svg {
    width: 16px;
    height: 16px;
}

/* Small setting button */

/* Change password modal */
.password-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.password-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.password-modal {
    background: rgba(34, 34, 34, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.password-modal-overlay.active .password-modal {
    transform: translateY(0);
}

.password-modal h3 {
    font-size: 1.3rem;
    margin-bottom: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.password-modal .form-group {
    margin-bottom: 16px;
}

.password-modal .form-group label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.password-modal .form-group input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.password-modal .form-group input:focus {
    outline: none;
    border-color: rgba(160, 218, 0, 0.5);
}

.password-modal-error {
    padding: 10px 14px;
    background: rgba(255, 100, 100, 0.15);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: none;
}

.password-modal-error.visible {
    display: block;
}

.password-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.password-modal-actions button {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.btn-modal-submit {
    background: rgba(160, 218, 0, 0.9);
    color: #000;
    border: none;
    font-weight: 500;
}

.btn-modal-submit:hover {
    background: rgba(180, 238, 20, 0.95);
}

.btn-modal-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Settings footer */
.settings-footer {
    margin-top: 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.settings-footer .footer-logo {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.4);
}

.settings-footer .footer-version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.2);
}

/* Responsive settings */
@media (max-width: 900px) {
    #settings-view {
        padding: 40px;
        padding-left: 120px;  /* 20px offset + 60px sidebar + 40px margin */
    }
}

@media (max-width: 600px) {
    #settings-view {
        padding: 20px;
        padding-bottom: 100px;  /* Extra space for bottom navbar */
    }

    .settings-header h1 {
        font-size: 1.8rem;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .setting-control {
        width: 100%;
    }

    .theme-selector,
    .font-size-control {
        width: 100%;
        justify-content: center;
    }

    .theme-option {
        flex: 1;
    }
}

/* ========================================
   Graph Header Fade Animation
   ======================================== */
.graph-header h1,
.graph-header .subtitle {
    transition: opacity 0.2s ease;
}

.graph-header h1.fading,
.graph-header .subtitle.fading {
    opacity: 0;
}

/* ========================================
   Public Document Mode
   (For non-logged-in users viewing public documents)
   ======================================== */

/* Hide elements in public mode */
.public-mode-hidden {
    display: none !important;
}

/* Body styling in public mode */
body.public-document-mode {
    background: #1a1a24;
}

/* Show page wrapper full width in public mode */
body.public-document-mode .page-wrapper {
    left: 0;
    right: 0;
    padding: 0 20px;
}

body.public-document-mode .page-wrapper .page {
    max-width: 900px;
    margin: 0 auto;
}

/* Public mode header bar */
.public-mode-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.95) 0%, rgba(28, 28, 40, 0.95) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.public-document-mode .public-mode-header {
    opacity: 1;
    visibility: visible;
}

.public-mode-header .logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.15em;
}

.public-mode-header .logo-link img {
    width: 24px;
    height: 24px;
    filter: invert(1);
    opacity: 0.9;
}

.public-mode-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-mode-header .login-btn {
    font-family: var(--ui-font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.public-mode-header .login-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.public-mode-header .register-btn {
    font-family: var(--ui-font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4a7c59 0%, #2d5a3d 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.public-mode-header .register-btn:hover {
    opacity: 0.9;
}

/* Adjust page wrapper for public mode header */
body.public-document-mode .page-wrapper {
    top: 56px;
}

/* Mobile adjustments for public mode */
@media (max-width: 600px) {
    .public-mode-header {
        padding: 0 12px;
    }

    .public-mode-header .login-btn,
    .public-mode-header .register-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    body.public-document-mode .page-wrapper {
        padding: 0 10px;
    }
}

/* ========================================
   Search View
   ======================================== */

#search-view {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: auto;
    padding: 40px;
    padding-left: 300px;  /* 260px sidebar + 40px margin */
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-header {
    margin-bottom: 32px;
}

.search-header h1 {
    font-size: 2.5rem;
    color: white;
    font-weight: normal;
    margin-bottom: 8px;
}

.search-header .subtitle {
    font-family: var(--ui-font);
    font-weight: var(--dashboard-text-weight);
    font-size: var(--dashboard-text-size);
    color: rgba(255, 255, 255, 0.5);
}

/* Search Box - uses glassmorphic card style */
.search-box {
    position: relative;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 4px inset rgba(255, 255, 255, 0.07), 0 0 56px inset rgba(100, 100, 100, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 16px 48px;
    font-family: var(--ui-font);
    font-size: 1rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: white;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.02);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.search-clear svg {
    width: 18px;
    height: 18px;
}

/* Search Filters - uses glassmorphic card style */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 4px inset rgba(255, 255, 255, 0.07), 0 0 56px inset rgba(100, 100, 100, 0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 130px;
}

.filter-group label {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.5);
}

.filter-group select {
    padding: 10px 36px 10px 14px;
    font-family: var(--ui-font);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
    box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 255, 255, 0.04), 0 0 2px inset rgba(255, 255, 255, 0.08);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.filter-group select:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.25);
}

.filter-group select:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 255, 255, 0.06), 0 0 2px inset rgba(255, 255, 255, 0.12);
}

.filter-group select:active {
    transform: translateY(1px);
    box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 255, 255, 0.04), 0 0 2px inset rgba(255, 255, 255, 0.08);
}

.filter-group select option {
    background: #1e1e2e;
    color: white;
    padding: 8px;
}

/* Favorites filter button */
.filter-favorites-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--ui-font);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 255, 255, 0.04), 0 0 2px inset rgba(255, 255, 255, 0.08);
    align-self: flex-end;
    margin-bottom: 1px;
}

.filter-favorites-btn svg {
    width: 16px;
    height: 16px;
    transition: all 0.15s ease;
}

.filter-favorites-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

.filter-favorites-btn:active {
    transform: translateY(1px);
    box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 255, 255, 0.04), 0 0 2px inset rgba(255, 255, 255, 0.08);
}

/* Active/pressed state */
.filter-favorites-btn[aria-pressed="true"] {
    background: rgba(255, 200, 50, 0.15);
    border-top-color: rgba(255, 200, 50, 0.4);
    color: #ffc832;
    box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.15), 0 0 24px inset rgba(255, 200, 50, 0.1), 0 0 2px inset rgba(255, 200, 50, 0.2);
}

.filter-favorites-btn[aria-pressed="true"] svg {
    fill: #ffc832;
}

/* Search Results - transparent container */
.search-results {
    min-height: 200px;
}

.search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.3);
}

.search-placeholder .placeholder-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.search-placeholder p {
    font-family: var(--ui-font);
    font-size: 0.95rem;
}

/* Search Result Items - matches recent-list pattern */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.02);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 6px;
}

.search-result-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    flex-shrink: 0;
}

.search-result-icon svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.5);
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-family: var(--ui-font);
    font-size: 0.95rem;
    font-weight: var(--dashboard-text-weight);
    color: white;
    margin-bottom: 2px;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

.search-result-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.search-result-badge.type-définition {
    background: rgba(255, 155, 136, 0.15);
    color: #ff9b88;
}

.search-result-badge.type-théorème {
    background: rgba(100, 200, 255, 0.15);
    color: #64c8ff;
}

.search-result-badge.type-proposition {
    background: rgba(212, 184, 0, 0.15);
    color: #d4b800;
}

.search-result-badge.type-chapitre {
    background: rgba(160, 218, 0, 0.15);
    color: var(--active-color);
}

/* No results */
.search-no-results {
    text-align: center;
    padding: 50px 20px;
}

.search-no-results p {
    font-family: var(--ui-font);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.search-no-results .hint {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Loading state */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
}

.search-loading .loading-spinner {
    width: 28px;
    height: 28px;
}

/* Search hint */
.search-hint {
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.25) !important;
    margin-top: 4px;
}

/* Expanded query note */
.expanded-note {
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.35) !important;
    font-style: italic;
}

/* Search Results Sections */
.search-results-section {
    margin-bottom: 24px;
}

.search-results-heading {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Fade-in animation for search results */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chapter Results - Grid with bubble display */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.search-result-chapter {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.85) 0%, rgba(28, 28, 40, 0.8) 100%);
    backdrop-filter: blur(16px) saturate(2);
    -webkit-backdrop-filter: blur(16px) saturate(2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.search-result-chapter:hover {
    background: linear-gradient(165deg, rgba(48, 48, 62, 0.9) 0%, rgba(38, 38, 50, 0.85) 100%);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.chapter-nav-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.3);
    transition: color 0.2s ease, transform 0.2s ease;
}

.search-result-chapter:hover .chapter-nav-icon {
    color: rgba(255, 255, 255, 0.6);
    transform: translateX(2px);
}

.search-result-chapter.selected {
    background: linear-gradient(165deg, rgba(160, 218, 0, 0.15) 0%, rgba(160, 218, 0, 0.08) 100%);
    border-color: var(--active-color);
    box-shadow:
        0 0 0 2px rgba(160, 218, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.25);
}

.chapter-bubble {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.chapter-bubble-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.chapter-info {
    flex: 1;
    min-width: 0;
}

.chapter-info .chapter-title {
    font-family: var(--ui-font);
    font-size: 1rem;
    font-weight: 500;
    color: white;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-info .chapter-meta {
    font-family: var(--ui-font);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0;
}

.chapter-info .chapter-description {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Block Results - List with rendered content */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Search result wrapper - handles animation and selection */
.search-result-wrapper {
    border-radius: 15px;
    transition: all 0.2s;
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.search-result-wrapper.selected {
    box-shadow: 0 0 0 2px rgba(160, 218, 0, 0.5);
}

/* Blocks within search results inherit document.css styling */
/* Just reset margins for cleaner list layout */
.search-result-wrapper .block {
    margin: 0;
}

/* Override theorem tint for search results in skeleton state */
.search-result-wrapper.theme-light .block.theoreme,
.search-result-wrapper.theme-light .block.theoremes,
.search-result-wrapper.theme-light .block.théorème,
.search-result-wrapper.theme-light .block.théorèmes {
    background: #f5edd5;
}

.search-result-wrapper.theme-dark .block.theoreme,
.search-result-wrapper.theme-dark .block.theoremes,
.search-result-wrapper.theme-dark .block.théorème,
.search-result-wrapper.theme-dark .block.théorèmes {
    background: rgba(212, 184, 0, 0.15);
}

/* Block skeleton loader */
.block-preview-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* Shimmer for dark theme (light shimmer on dark background) */
.theme-dark .skeleton-line {
    height: 14px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Shimmer for light theme (dark shimmer on light background) */
.theme-light .skeleton-line {
    height: 14px;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.04) 0%,
        rgba(0, 0, 0, 0.08) 50%,
        rgba(0, 0, 0, 0.04) 100%
    );
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-line-1 {
    width: 92%;
}

.skeleton-line-2 {
    width: 88%;
}

.skeleton-line-3 {
    width: 94%;
}

.skeleton-line-4 {
    width: 78%;
}

.skeleton-line-5 {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.block-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: loadingDot 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Load more button */
.load-more-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin-top: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--ui-font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.load-more-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

/* rendered-block-content uses parser-output class for block styling from document.css */

.block-preview-text {
    font-family: var(--ui-font);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: pre-wrap;
}

.block-preview-empty {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

/* Sketch placeholder banner in search results */
.sketch-search-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    margin: 12px 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sketch-search-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
}

.sketch-search-label {
    font-family: var(--ui-font);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.sketch-search-card:hover .sketch-search-label {
    color: rgba(255, 255, 255, 0.8);
}

.sketch-search-error {
    font-family: var(--ui-font);
    font-size: 0.8rem;
    color: rgba(255, 100, 100, 0.7);
}

/* Light theme sketch banner */
.rendered-block-content.theme-light .sketch-search-card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.12);
}

.rendered-block-content.theme-light .sketch-search-card:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

.rendered-block-content.theme-light .sketch-search-label {
    color: rgba(0, 0, 0, 0.5);
}

.rendered-block-content.theme-light .sketch-search-card:hover .sketch-search-label {
    color: rgba(0, 0, 0, 0.7);
}

.rendered-block-content.theme-light .sketch-search-error {
    color: rgba(180, 50, 50, 0.8);
}

.search-result-block .block-chapter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.search-result-block .block-chapter::before {
    content: '';
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

/* View in context button - positioned to look inline with .titles, uses fold-button styling */
.rendered-block-content .titles {
    position: relative;
    padding-right: 90px; /* Make room for button */
}

.view-in-context-btn {
    position: absolute;
    top: 0px; /* Align with h6 - accounts for h5 height (~14px + margin) */
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-right: 0 !important;
}

.view-in-context-btn svg {
    width: 14px;
    height: 14px;
}

/* Block preview placeholder (click to load) */
.block-preview-placeholder {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.block-preview-placeholder:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
}

/* Highlight effect for navigated-to blocks */
.search-highlight {
    animation: searchHighlight 2s ease-out;
}

@keyframes searchHighlight {
    0% {
        outline: 3px solid rgba(100, 200, 255, 0.8);
        outline-offset: 4px;
    }
    100% {
        outline: 3px solid transparent;
        outline-offset: 8px;
    }
}

/* Tablet adjustments for search (900px - matches sidebar collapse) */
@media (max-width: 900px) {
    .search-box input {
        padding: 14px 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Mobile adjustments for search (600px - matches bottom navbar) */
@media (max-width: 600px) {
    .search-header h1 {
        font-size: 1.8rem;
    }

    .search-box {
        margin-bottom: 12px;
    }

    .search-filters {
        flex-direction: column;
        gap: 14px;
        padding: 16px 20px;
        margin-bottom: 16px;
    }

    .filter-group {
        min-width: 100%;
    }

    .filter-favorites-btn {
        align-self: flex-start;
        margin-bottom: 0;
    }

    .search-results {
        padding: 8px 16px;
    }

    .search-result-item:hover {
        margin: 0 -8px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* =====================================================
   NOTIFICATIONS DROPDOWN
   ===================================================== */

.notifications-dropdown {
    position: fixed;
    left: 90px;
    bottom: 140px;
    width: 360px;
    max-height: 480px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.95) 0%, rgba(28, 28, 40, 0.92) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 200;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom left;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.notifications-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.notifications-header h3 {
    margin: 0;
    font-family: var(--ui-font);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-mark-all-read {
    background: none;
    border: none;
    color: var(--active-color);
    font-family: var(--ui-font);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-mark-all-read:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-mark-all-read:disabled {
    opacity: 0.4;
    cursor: default;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
}

.notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--ui-font);
    font-size: 13px;
}

.notifications-empty svg {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
    stroke: currentColor;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notification-item.unread {
    background: rgba(160, 218, 0, 0.06);
}

.notification-item.unread:hover {
    background: rgba(160, 218, 0, 0.1);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
}

.notification-icon svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 255, 255, 0.7);
}

.notification-icon.system { background: rgba(59, 130, 246, 0.15); }
.notification-icon.system svg { stroke: #60a5fa; }

.notification-icon.reminder { background: rgba(245, 158, 11, 0.15); }
.notification-icon.reminder svg { stroke: #fbbf24; }

.notification-icon.feedback-reply { background: rgba(16, 185, 129, 0.15); }
.notification-icon.feedback-reply svg { stroke: #34d399; }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-family: var(--ui-font);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 3px;
    line-height: 1.3;
}

.notification-body {
    font-family: var(--ui-font);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-family: var(--ui-font);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 6px;
}

.notification-unread-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--active-color);
    flex-shrink: 0;
    margin-top: 6px;
}

/* Click outside to close */
.notifications-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
    display: none;
}

.notifications-backdrop.active {
    display: block;
}

/* =====================================================
   FEEDBACK MODAL
   ===================================================== */

.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.feedback-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.feedback-modal {
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.98) 0%, rgba(28, 28, 40, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 440px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s;
}

.feedback-modal-overlay.visible .feedback-modal {
    transform: scale(1) translateY(0);
}

.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.feedback-modal-header h2 {
    margin: 0;
    font-family: var(--ui-font);
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.feedback-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    transition: all 0.2s;
}

.feedback-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.feedback-close svg {
    width: 18px;
    height: 18px;
}

#feedback-form {
    padding: 20px;
}

.feedback-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.feedback-type-option {
    flex: 1;
    cursor: pointer;
}

.feedback-type-option input {
    display: none;
}

.feedback-type-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: var(--ui-font);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
}

.feedback-type-label:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
}

.feedback-type-option input:checked + .feedback-type-label {
    border-color: var(--active-color);
    background: rgba(160, 218, 0, 0.08);
    color: var(--active-color);
}

.feedback-type-label svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.feedback-context {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-family: var(--ui-font);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.feedback-context:empty {
    display: none;
}

.feedback-context strong {
    color: rgba(255, 255, 255, 0.7);
}

#feedback-message {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: var(--ui-font);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    resize: vertical;
    margin-bottom: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#feedback-message::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#feedback-message:focus {
    outline: none;
    border-color: var(--active-color);
    box-shadow: 0 0 0 3px rgba(160, 218, 0, 0.1);
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-feedback-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--ui-font);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-feedback-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

.btn-feedback-submit {
    background: var(--active-color);
    color: #1a1a2e;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--ui-font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-feedback-submit:hover {
    background: #b8f000;
    transform: translateY(-1px);
}

.btn-feedback-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .notifications-dropdown {
        left: 10px;
        right: 10px;
        bottom: 80px;
        width: auto;
    }

    .feedback-modal {
        width: calc(100vw - 32px);
        margin: 16px;
    }
}

/* ============================================
   Search Overlay
   ============================================ */

/* Backdrop */
.search-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.search-overlay-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Main overlay - full screen */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Floating search header */
.search-overlay-header {
    width: 100%;
    max-width: 680px;
    padding: 80px 16px 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Search row (pill + button) */
.search-overlay-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

/* Search pill (spotlight-like with sidebar material) */
.search-overlay-pill {
    position: relative;
    flex: 1;
    max-width: 600px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.95) 0%, rgba(28, 28, 40, 0.92) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 20px;
    transition: all 0.2s;
}

.search-overlay-icon {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.5);
    width: 20px;
    height: 20px;
}

#search-overlay-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 18px 12px;
    font-family: var(--ui-font);
    font-size: 16px;
    color: rgba(255, 255, 255, 0.95);
}

#search-overlay-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#search-overlay-input:focus {
    outline: none;
}

.search-overlay-pill:focus-within {
    border-color: var(--active-color);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 3px rgba(160, 218, 0, 0.15);
}

/* Clear button */
.search-overlay-clear {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-overlay-clear:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.search-overlay-clear svg {
    width: 16px;
    height: 16px;
}

/* Filter toggle button (floating to the right) */
.search-filter-toggle {
    flex-shrink: 0;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.95) 0%, rgba(28, 28, 40, 0.92) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
}

.search-filter-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.18);
    background: linear-gradient(165deg, rgba(48, 48, 62, 0.95) 0%, rgba(38, 38, 50, 0.92) 100%);
}

.search-filter-toggle.active {
    color: var(--active-color);
    border-color: rgba(160, 218, 0, 0.4);
    background: linear-gradient(165deg, rgba(160, 218, 0, 0.15) 0%, rgba(160, 218, 0, 0.08) 100%);
}

.search-filter-toggle svg {
    width: 20px;
    height: 20px;
}

/* Filter chips */
.search-filter-chips {
    max-height: 200px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 600px;
    position: relative;
}

.search-filter-chips.hidden {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.filter-chip-wrapper {
    position: relative;
}

.filter-chip {
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.95) 0%, rgba(28, 28, 40, 0.92) 100%);
    backdrop-filter: blur(24px) saturate(3);
    -webkit-backdrop-filter: blur(24px) saturate(3);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    padding: 6px 14px;
    font-family: var(--ui-font);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.filter-chip:hover {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 6px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.filter-chip.active {
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(160, 218, 0, 0.4);
    background: linear-gradient(165deg, rgba(160, 218, 0, 0.15) 0%, rgba(160, 218, 0, 0.08) 100%);
}

.filter-chip-label {
    flex: 1;
}

.filter-chip-clear {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    flex-shrink: 0;
}

.filter-chip-clear:hover {
    color: rgba(255, 255, 255, 0.9);
}

.filter-chip-clear svg {
    pointer-events: none;
}

/* Filter chip chevron */
.filter-chip-chevron {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s, color 0.2s;
}

.filter-chip.dropdown-open .filter-chip-chevron {
    transform: rotate(180deg);
    color: rgba(255, 255, 255, 0.7);
}

/* Filter chip icon (for toggle chips like favorites) */
.filter-chip-icon {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.5);
    stroke: rgba(255, 255, 255, 0.5);
    fill: none;
    transition: all 0.2s;
}

.filter-chip-toggle {
    cursor: pointer;
}

.filter-chip-toggle:hover .filter-chip-icon {
    color: rgba(255, 255, 255, 0.8);
    stroke: rgba(255, 255, 255, 0.8);
}

.filter-chip-toggle.active {
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(160, 218, 0, 0.4);
    background: linear-gradient(165deg, rgba(160, 218, 0, 0.15) 0%, rgba(160, 218, 0, 0.08) 100%);
}

.filter-chip-toggle.active .filter-chip-icon {
    color: var(--active-color);
    stroke: var(--active-color);
    fill: var(--active-color);
}

/* Filter dropdown */
.filter-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 140px;
    background: linear-gradient(165deg, rgba(38, 38, 52, 0.98) 0%, rgba(28, 28, 40, 0.95) 100%);
    backdrop-filter: blur(32px) saturate(3);
    -webkit-backdrop-filter: blur(32px) saturate(3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.1),
        0 12px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    max-height: 300px;
    overflow-y: auto;
}

.filter-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.filter-dropdown-item {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-family: var(--ui-font);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 1);
}

.filter-dropdown-item.selected {
    background: rgba(160, 218, 0, 0.15);
    color: var(--active-color);
}

/* Filter dropdown scrollbar */
.filter-dropdown::-webkit-scrollbar {
    width: 6px;
}

.filter-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.filter-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.filter-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Results container */
.search-overlay-results {
    flex: 1;
    width: 100%;
    max-width: 680px;
    overflow-y: auto;
    padding: 24px 16px 80px;
    margin-top: 16px;
}

.search-overlay-results .search-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.search-overlay-results .placeholder-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.3;
}

.search-overlay-results .search-placeholder p {
    font-family: var(--ui-font);
    font-size: 16px;
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.5);
}

.search-overlay-results .search-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.35);
}

/* Result items will use existing .search-result-item styles from search page */
.search-overlay-results .search-result-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-overlay-results .search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.search-overlay-results .search-result-item.selected {
    background: rgba(160, 218, 0, 0.08);
    border-color: var(--active-color);
}

/* Chapter result adjustments for overlay */
.search-overlay-results .search-result-chapter {
    gap: 0;
}

.search-overlay-results .chapter-info {
    margin-left: 16px;
}

.search-overlay-results .chapter-info .chapter-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Footer with keyboard shortcuts */
.search-overlay-footer {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    transition: opacity 0.2s, transform 0.2s;
}

.search-overlay-footer.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
}

.shortcut-hint {
    font-family: var(--ui-font);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.shortcut-hint kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--ui-font);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .search-overlay-header {
        padding: 60px 12px 0;
    }

    .search-overlay-row {
        gap: 8px;
    }

    .search-overlay-pill {
        padding: 0 16px;
    }

    #search-overlay-input {
        font-size: 16px;
        padding: 16px 8px;
    }

    .search-filter-toggle {
        width: 48px;
        height: 48px;
    }

    .search-filter-toggle svg {
        width: 18px;
        height: 18px;
    }

    .filter-chip {
        font-size: 12px;
        padding: 5px 12px;
    }

    .filter-dropdown {
        min-width: 130px;
        font-size: 12px;
    }

    .filter-dropdown-item {
        padding: 7px 10px;
        font-size: 12px;
    }

    .search-overlay-results {
        padding: 20px 12px 60px;
    }

    .search-overlay-footer {
        bottom: 20px;
        padding: 10px 16px;
        font-size: 11px;
    }

    .shortcut-hint {
        font-size: 11px;
    }
}
