/* ==========================================================================
   REAL NOTEBOOK - STYLESHEET (STRICT 16-LINE PHYSICAL PAGE HEIGHT + 3D FLIP)
   ========================================================================== */

/* Root Variables & Color Themes */
:root {
    --primary-font: 'Caveat', cursive;
    --ui-font: 'Inter', sans-serif;
    --paper-bg: #fdfbf7;
    --paper-line-color: #bce0fd;
    --paper-margin-color: #fca5a5;
    --text-color: #1b4965;
    --ink-color: #1b4965;
    --bg-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    
    /* Cover Theme Variables (Default Vintage Leather) */
    --cover-bg: #4a2c11;
    --cover-gradient: linear-gradient(145deg, #5c3818, #3b210a);
    --cover-border: #2e1a07;
    --cover-accent: #d4af37;
    --shadow-deep: 0 20px 40px rgba(0, 0, 0, 0.4);
    --shadow-paper: 3px 5px 15px rgba(0, 0, 0, 0.15);
}

/* Theme Options */
body.theme-leather-brown {
    --cover-gradient: linear-gradient(145deg, #603813, #3a2008);
    --cover-border: #2c1805;
    --cover-accent: #d4af37;
}

body.theme-midnight-blue {
    --cover-gradient: linear-gradient(145deg, #1b2a4a, #0d1527);
    --cover-border: #090e1b;
    --cover-accent: #60a5fa;
}

body.theme-burgundy {
    --cover-gradient: linear-gradient(145deg, #541212, #330808);
    --cover-border: #240505;
    --cover-accent: #f87171;
}

body.theme-sage-green {
    --cover-gradient: linear-gradient(145deg, #2d4a3e, #1a2e26);
    --cover-border: #112019;
    --cover-accent: #34d399;
}

body.theme-dark-charcoal {
    --cover-gradient: linear-gradient(145deg, #2d3748, #1a202c);
    --cover-border: #11141d;
    --cover-accent: #cbd5e1;
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--ui-font);
    background: var(--bg-gradient);
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    touch-action: manipulation;
}

/* PRIVATE NOTEBOOK LOCK SCREEN OVERLAY */
.lock-screen-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.lock-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 2.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    position: relative;
}

.lock-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.lock-icon-circle {
    width: 64px;
    height: 64px;
    background: rgba(56, 189, 248, 0.12);
    border: 2px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    color: #38bdf8;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.lock-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
}

.lock-header p {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.4;
}

.lock-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group.full-width {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.input-group.full-width label {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 600;
}

.input-group.full-width input {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    color: white;
    font-size: 0.9rem;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: #64748b;
    font-size: 1rem;
}

.input-group input[type="password"], .input-group input[type="text"] {
    width: 100%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.75rem 2.8rem 0.75rem 2.6rem;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: #38bdf8;
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
}

.btn-toggle-pass:hover {
    color: white;
}

.lock-error-msg, .pin-error-msg {
    font-size: 0.82rem;
    color: #f87171;
    min-height: 18px;
    text-align: center;
}

.btn-unlock {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
    transition: all 0.2s;
}

.btn-unlock:hover {
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    transform: translateY(-1px);
}

.lock-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #64748b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.8rem;
}

.btn-link {
    background: transparent;
    border: none;
    color: #38bdf8;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-lock {
    background: #ef4444;
    color: white;
    border: 1px solid #f87171;
}

.btn-lock:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Top App Header & Toolbar */
.app-header {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    font-size: 1.6rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.2px;
}

.save-status-badge {
    font-size: 0.72rem;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.save-status-badge.saving {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
}

.mobile-actions {
    display: none;
    gap: 6px;
}

.mobile-toggle-btn {
    background: #1e293b;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
}

.mobile-toggle-btn.danger {
    background: #ef4444;
    color: white;
    border-color: #f87171;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Toolbar Controls */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tool-group label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
}

/* Styled Select Elements */
.styled-select {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.styled-select:hover, .styled-select:focus {
    border-color: #38bdf8;
    background: #334155;
}

/* Pen Selector Buttons */
.pen-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pen-btn {
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pen-btn .color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pen-btn:hover {
    transform: scale(1.15);
}

.pen-btn.active {
    box-shadow: 0 0 0 2px #38bdf8;
}

/* Formatting Tool Buttons */
.format-btn {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.format-btn:hover {
    background: #334155;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.format-btn.active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
}

.format-btn.listening {
    background: #ef4444 !important;
    color: white !important;
    animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Action Buttons */
.btn {
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-save:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: #334155;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: #475569;
    color: white;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 0.9rem;
}

/* Workspace Stage */
.notebook-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    position: relative;
}

/* Mobile Bookmark Category Scroll Bar */
.mobile-bookmark-bar {
    display: none;
    width: 100%;
    max-width: 600px;
    margin-bottom: 0.8rem;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-bar-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
}

.mobile-tags-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
}

.mobile-tab-btn {
    background: var(--tab-color, #0284c7);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.mobile-tab-btn.active {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Bookmark Tabs on Right Edge (Desktop) */
.bookmark-tabs.desktop-tabs {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.tab-btn {
    background: var(--tab-color, #38bdf8);
    color: white;
    border: none;
    padding: 10px 18px 10px 12px;
    border-radius: 0 8px 8px 0;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 3px 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
    transform: translateX(0);
}

.tab-btn:hover {
    transform: translateX(6px);
}

.tab-btn.active {
    transform: translateX(12px);
    box-shadow: 5px 3px 12px rgba(0, 0, 0, 0.4);
    outline: 2px solid white;
}

/* Notebook Wrapper & 3D Book Container */
.notebook-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    max-width: 1100px;
    width: 100%;
}

.notebook {
    position: relative;
    width: 100%;
    max-width: 1040px;
    min-height: 630px;
    display: flex;
    border-radius: 16px;
    box-shadow: var(--shadow-deep);
    perspective: 2000px;
    transform-style: preserve-3d;
    transition: background 0.4s ease;
    cursor: grab;
}

.notebook:active {
    cursor: grabbing;
}

/* REAL 3D PAGE FLIP OVERLAY & ANIMATION */
.flipping-page-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background-color: var(--paper-bg, #fdfbf7);
    border-radius: 0 10px 10px 0;
    z-index: 40;
    transform-origin: left center;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.flipping-page-overlay.flip-forward {
    animation: flipNext3D 0.55s ease-in-out forwards;
}

.flipping-page-overlay.flip-backward {
    animation: flipPrev3D 0.55s ease-in-out forwards;
}

@keyframes flipNext3D {
    0% {
        transform: rotateY(0deg);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: -35px 0 45px rgba(0, 0, 0, 0.45);
    }
    100% {
        transform: rotateY(-180deg);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }
}

@keyframes flipPrev3D {
    0% {
        transform: rotateY(-180deg);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: -35px 0 45px rgba(0, 0, 0, 0.45);
    }
    100% {
        transform: rotateY(0deg);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }
}

/* Leather Cover Backing Frame */
.notebook-cover {
    position: absolute;
    inset: -10px;
    background: var(--cover-gradient);
    border-radius: 20px;
    border: 2px solid var(--cover-border);
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.7),
        0 15px 35px rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.notebook-cover::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px dashed var(--cover-accent);
    opacity: 0.4;
    border-radius: 16px;
    pointer-events: none;
}

/* Notebook Pages (Left & Right Spreads) */
.notebook-page {
    position: relative;
    flex: 1;
    background-color: var(--paper-bg);
    z-index: 5;
    padding: 1.8rem 2.2rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-paper);
    transition: background 0.3s ease;
    overflow: hidden;
}

/* Left Page Specifics */
.left-page {
    border-radius: 10px 0 0 10px;
    background: #f7f3eb;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.page-header-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 0.6rem;
}

.notebook-title-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 1.1rem;
    width: 60%;
}

.notebook-title-edit input {
    background: transparent;
    border: none;
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2b2b2b;
    outline: none;
    width: 100%;
    border-bottom: 1px dashed transparent;
}

.notebook-title-edit input:hover, .notebook-title-edit input:focus {
    border-bottom-color: #888;
}

.page-date {
    font-size: 0.82rem;
    color: #777;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.page-body-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Sticky Note Widget & Color Picker */
.sticky-note {
    color: #713f12;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    transform: rotate(-1.5deg);
    transition: transform 0.2s, background 0.3s;
}

.sticky-note:hover {
    transform: rotate(0deg) scale(1.01);
}

.sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(113, 63, 18, 0.2);
    padding-bottom: 4px;
    margin-bottom: 0.4rem;
}

.sticky-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sticky-color-selector {
    display: flex;
    gap: 4px;
}

.sticky-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.sticky-dot:hover {
    transform: scale(1.3);
}

.sticky-pin {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    color: #dc2626;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sticky-content {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    line-height: 1.4;
    outline: none;
    min-height: 70px;
}

/* Mini Index List WITH SEARCH */
.mini-index-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mini-index-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mini-index-container h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.mini-search-box .search-icon {
    position: absolute;
    left: 8px;
    font-size: 0.75rem;
    color: #64748b;
}

.mini-search-box input {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 4px 6px 4px 24px;
    font-size: 0.78rem;
    outline: none;
    color: #334155;
}

.mini-search-box input:focus {
    border-color: #0284c7;
}

.mini-index-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 160px;
}

.mini-index-item {
    padding: 5px 8px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.mini-index-item:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
}

.mini-index-item.active {
    background: #0284c7;
    color: white;
    font-weight: 600;
}

.btn-add-page {
    margin-top: 0.4rem;
    background: #0284c7;
    color: white;
    border: none;
    padding: 0.45rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-add-page:hover {
    background: #0369a1;
}

/* Freehand Drawing Canvas Overlay */
.sketch-container {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(253, 251, 247, 0.95);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-radius: 0 10px 10px 0;
}

.sketch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #cbd5e1;
    font-size: 0.85rem;
    color: #334155;
    font-weight: 600;
}

.sketch-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sketch-controls input[type="color"] {
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
}

.sketch-controls input[type="range"] {
    width: 70px;
}

#sketchCanvas {
    flex: 1;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* Center Metallic Spiral Binding */
.spiral-binding {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 44px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 15px 0;
    pointer-events: none;
}

.ring {
    height: 14px;
    width: 46px;
    background: linear-gradient(90deg, 
        #94a3b8 0%, 
        #f8fafc 30%, 
        #64748b 70%, 
        #334155 100%);
    border-radius: 8px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.8);
    position: relative;
    left: -1px;
}

/* Right Page (The Active Note Sheet) */
.right-page {
    border-radius: 0 10px 10px 0;
    padding-left: 3.5rem;
}

/* Red Vertical Margin Line */
.margin-line {
    position: absolute;
    left: 3rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--paper-margin-color);
    z-index: 6;
}

/* Hole Punches on Paper */
.binder-holes {
    position: absolute;
    left: 0.6rem;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 30px 0;
    z-index: 6;
}

.hole {
    width: 14px;
    height: 14px;
    background: #3a220b;
    border-radius: 50%;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Paper Patterns & 16 Line Boundaries */
.paper-ruled .paper-content {
    background-image: repeating-linear-gradient(
        transparent,
        transparent 31px,
        var(--paper-line-color) 31px,
        var(--paper-line-color) 32px
    );
    background-attachment: local;
    line-height: 32px;
}

.paper-grid .paper-content {
    background-image: 
        linear-gradient(to right, var(--paper-line-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--paper-line-color) 1px, transparent 1px);
    background-size: 24px 24px;
    background-attachment: local;
    line-height: 32px;
}

.paper-dotted .paper-content {
    background-image: radial-gradient(var(--paper-line-color) 1.5px, transparent 1.5px);
    background-size: 24px 32px;
    background-attachment: local;
    line-height: 32px;
}

.paper-blank .paper-content {
    background-image: none;
    line-height: 32px;
}

/* Right Page Header Controls */
.page-header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    z-index: 8;
}

.page-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.page-title-input {
    font-family: var(--primary-font);
    font-size: 1.7rem;
    font-weight: 700;
    color: #0f172a;
    background: transparent;
    border: none;
    outline: none;
    width: 60%;
    border-bottom: 2px dashed transparent;
    transition: border-color 0.2s;
}

.page-title-input:hover, .page-title-input:focus {
    border-bottom-color: #94a3b8;
}

.category-tag-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.page-timestamp {
    font-size: 0.78rem;
    color: #64748b;
    font-family: 'Inter', sans-serif;
}

/* Editable Paper Content Area (Strict 16 Lines = 16 * 32px = 512px) */
.paper-content {
    flex: 1;
    outline: none;
    font-family: var(--primary-font);
    font-size: 1.35rem;
    color: var(--ink-color);
    overflow-y: hidden;
    padding-right: 0.4rem;
    z-index: 8;
    word-break: break-word;
    height: 512px;
    max-height: 512px;
}

.paper-content h1, .paper-content h2, .paper-content h3, .paper-content p {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 32px !important;
    min-height: 32px !important;
}

.paper-content ul, .paper-content ol {
    padding-left: 1.8rem;
    margin: 0 !important;
}

/* Footer Page Indicator & Controls */
.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.6rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.78rem;
    color: #64748b;
    z-index: 8;
}

.page-number-indicator {
    font-weight: 600;
    color: #334155;
}

/* Bottom Controls */
.page-turn-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.nav-arrow-btn {
    background: #334155;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.nav-arrow-btn:hover {
    background: #0284c7;
    border-color: #38bdf8;
}

.nav-arrow-btn.danger:hover {
    background: #ef4444;
    border-color: #f87171;
}

.page-slider-container {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 0.82rem;
}

.page-number-input {
    width: 40px;
    text-align: center;
    background: #1e293b;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 3px;
    font-weight: 600;
}

/* Modals Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

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

.modal-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal-card.modal-sm {
    max-width: 440px;
}

.modal-header {
    padding: 0.9rem 1.2rem;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1rem 1.2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #94a3b8;
}

.search-bar input {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.6rem 0.6rem 0.6rem 2.4rem;
    color: white;
    font-size: 0.88rem;
    outline: none;
}

.search-bar input:focus {
    border-color: #38bdf8;
}

.filter-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-btn {
    background: #0f172a;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
}

.filter-btn.active {
    background: #0284c7;
    color: white;
    border-color: #38bdf8;
}

.pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
}

.page-list-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.page-list-card:hover {
    border-color: #38bdf8;
    background: #1e293b;
}

.card-title {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.card-snippet {
    font-size: 0.78rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Export Options */
.export-options {
    gap: 0.8rem;
}

.export-opt-btn {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.85rem;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-align: left;
    transition: all 0.2s;
}

.export-opt-btn i {
    font-size: 1.5rem;
    color: #38bdf8;
}

.export-opt-btn:hover {
    background: #334155;
    border-color: #38bdf8;
}

.opt-info strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.opt-info span {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #10b981;
    color: white;
    padding: 0.65rem 1.2rem;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.active {
    transform: translateY(0);
    opacity: 1;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .desktop-tabs {
        display: none !important;
    }

    .mobile-bookmark-bar {
        display: flex;
    }

    .notebook {
        height: auto;
        min-height: 600px;
    }

    .left-page {
        display: none;
    }

    .left-page.mobile-visible {
        display: flex;
        width: 100%;
        border-radius: 10px;
    }

    .right-page {
        border-radius: 10px;
        width: 100%;
    }

    .spiral-binding {
        display: none;
    }

    .binder-holes {
        display: flex;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0.5rem 0.8rem;
    }

    .brand-text h1 {
        font-size: 0.98rem;
    }

    .save-status-badge {
        font-size: 0.68rem;
    }

    .mobile-actions {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }

    .toolbar {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        margin-top: 0;
        padding-top: 0;
        gap: 0.5rem;
    }

    .toolbar.mobile-open {
        max-height: 250px;
        opacity: 1;
        overflow-x: auto;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .toolbar-divider {
        display: none;
    }

    .notebook-stage {
        padding: 0.8rem 0.5rem;
    }

    .notebook-wrapper {
        gap: 0.8rem;
    }

    .notebook {
        border-radius: 12px;
        min-height: 540px;
    }

    .notebook-cover {
        inset: -6px;
        border-radius: 14px;
    }

    .notebook-page {
        padding: 1.2rem 1rem 1.2rem 2.4rem;
    }

    .right-page {
        padding-left: 2.5rem;
    }

    .margin-line {
        left: 2rem;
    }

    .binder-holes {
        left: 0.3rem;
    }

    .page-title-input {
        font-size: 1.35rem;
        width: 100%;
    }

    .page-header-right {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .page-timestamp {
        font-size: 0.72rem;
    }

    .paper-content {
        font-size: 1.2rem;
        height: 512px;
    }

    .page-turn-controls {
        padding: 0.4rem 0.8rem;
        gap: 0.6rem;
        width: 100%;
        justify-content: space-around;
    }

    .nav-arrow-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.78rem;
    }

    .nav-arrow-btn .btn-text {
        display: none;
    }

    .toast-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .notebook-page {
        padding-left: 2.2rem;
    }

    .margin-line {
        left: 1.7rem;
    }

    .paper-content {
        font-size: 1.1rem;
    }

    .card-snippet {
        max-width: 180px;
    }
}

/* FULL COLOR PDF & PRINT SUPPORT */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body {
        background: #f8fafc !important;
        color: #0f172a !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .app-header, .bookmark-tabs, .mobile-bookmark-bar, .page-turn-controls, .left-page, .spiral-binding, .modal-overlay, .toast-notification, .lock-screen-overlay {
        display: none !important;
    }

    .notebook-stage {
        padding: 0 !important;
        display: block !important;
    }

    .notebook-wrapper {
        max-width: 100% !important;
        margin: 0 !important;
    }

    .notebook {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 95vh !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .notebook-cover {
        display: none !important;
    }

    .right-page {
        display: flex !important;
        width: 100% !important;
        border-radius: 12px !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        padding: 2.5rem 2.5rem 2.5rem 4rem !important;
        background-color: var(--paper-bg, #fdfbf7) !important;
    }

    .margin-line {
        display: block !important;
        left: 3.2rem !important;
        background-color: var(--paper-margin-color, #fca5a5) !important;
    }

    .binder-holes {
        display: flex !important;
        left: 0.8rem !important;
    }

    .hole {
        background: #94a3b8 !important;
    }

    .paper-content {
        overflow: visible !important;
        font-family: var(--primary-font) !important;
        color: var(--ink-color) !important;
        height: auto !important;
        max-height: none !important;
    }

    .page-title-input {
        border-bottom: none !important;
        color: #0f172a !important;
    }

    .category-tag-badge {
        border: 1px solid #cbd5e1 !important;
    }
}
