/* ===================================
   TheSecureNote - Design System
   =================================== */

/* ===== CSS Variables ===== */
:root {
    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;

    /* Brand Colors */
    --brand-primary: #2563EB;
    --brand-primary-hover: #1D4ED8;
    --brand-primary-light: #DBEAFE;
    --brand-secondary: #10B981;

    /* Border Colors */
    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;
    --border-focus: #2563EB;

    /* Status Colors */
    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --error: #EF4444;
    --error-bg: #FEE2E2;
    --danger: #EF4444;
    --danger-light: #FEE2E2;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Max Widths */
    --max-width-sm: 640px;
    --max-width-md: 768px;
    --max-width-lg: 1024px;
    --max-width-xl: 1280px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-secondary);
    background: var(--bg-primary);
    line-height: 1.6;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    line-height: 1.2;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.text-large {
    font-size: 1.125rem;
}

.text-small {
    font-size: 0.875rem;
}

.text-caption {
    font-size: 0.75rem;
    font-weight: 500;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-center {
    text-align: center;
}

/* ===== Layout ===== */
.container {
    max-width: var(--max-width-xl);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--max-width-md);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-ghost {
    background: transparent;
    color: var(--brand-primary);
}

.btn-ghost:hover {
    background: var(--brand-primary-light);
}

.btn-full {
    width: 100%;
}

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

/* ===== Inputs ===== */
.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.input::placeholder {
    color: var(--text-tertiary);
}

/* ===== Select Dropdown Base (Global) ===== */
select.input,
.select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' 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 0.5rem center;
    background-size: 0.75rem;
    cursor: pointer;
}

body.dark-mode select.input,
body.dark-mode .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' 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");
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.input-group .input {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-group .input-suffix {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.input-prefix {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.input-group .input-prefix+.input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-error {
    margin-top: var(--space-2);
    font-size: 0.875rem;
    color: var(--error);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.card-elevated {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
}

/* ===== Pricing Cards ===== */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    margin-top: var(--space-12);
}

.pricing-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-lg);
}

.pricing-card.featured {
    border: 2px solid var(--brand-primary);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-primary);
    color: var(--text-inverse);
    padding: var(--space-1) var(--space-4);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pricing-icon {
    font-size: 2rem;
    margin-bottom: var(--space-4);
}

.pricing-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.pricing-price {
    margin-bottom: var(--space-4);
}

.pricing-price .amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-price .period {
    color: var(--text-tertiary);
    font-size: 1rem;
}

.pricing-url {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    font-family: monospace;
}

.pricing-features {
    list-style: none;
    margin: var(--space-6) 0;
    flex-grow: 1;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.pricing-features li svg {
    flex-shrink: 0;
    color: var(--brand-secondary);
    margin-top: 2px;
}

.pricing-input {
    margin-top: auto;
    margin-bottom: var(--space-4);
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-logo svg {
    color: var(--brand-primary);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.navbar-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.navbar-link:hover {
    color: var(--text-primary);
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: var(--space-20) var(--space-6);
    max-width: var(--max-width-md);
    margin: 0 auto;
}

.hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--brand-primary-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.hero-icon svg {
    width: 32px;
    height: 32px;
    color: var(--brand-primary);
}

.hero h1 {
    margin-bottom: var(--space-4);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Trust Badges ===== */
.trust-section {
    padding: var(--space-16) var(--space-6);
    background: var(--bg-secondary);
}

.trust-badges {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    max-width: var(--max-width-lg);
    margin: 0 auto;
}

.trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
}

.trust-badge svg {
    width: 32px;
    height: 32px;
    color: var(--brand-primary);
}

.trust-badge-title {
    font-weight: 600;
    color: var(--text-primary);
}

.trust-badge-desc {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* ===== How It Works ===== */
.how-it-works {
    padding: var(--space-20) var(--space-6);
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: var(--space-12);
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    max-width: var(--max-width-lg);
    margin: 0 auto;
}

.step {
    text-align: center;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--brand-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.step-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.step-desc {
    font-size: 0.9375rem;
    color: var(--text-tertiary);
}

/* ===== Footer ===== */
.footer {
    padding: var(--space-16) var(--space-6);
    border-top: 1px solid var(--border-light);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-12);
    max-width: var(--max-width-xl);
    margin: 0 auto;
}

.footer-brand {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
}

.footer-brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.footer-column h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-2);
}

.footer-links a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    text-align: center;
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-light);
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.2s ease-out;
}

.modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.modal-icon svg {
    width: 32px;
    height: 32px;
    color: var(--brand-primary);
}

.modal-icon-danger {
    width: 48px;
    height: 48px;
    background: var(--danger-light);
    border-radius: 50%;
    margin: 0 auto var(--space-4) auto;
}

.modal-icon-danger svg {
    width: 24px;
    height: 24px;
    color: var(--danger);
}

/* Delete modal specific: add spacing between title and description */
.modal-icon-danger+.modal-title {
    margin-bottom: var(--space-2);
}

.modal-warning {
    display: block;
    color: var(--danger);
    margin-top: var(--space-2);
}

/* Upgrade modal styles */
.modal-icon-upgrade {
    width: 48px;
    height: 48px;
    background: #FEF3C7;
    border-radius: 50%;
    margin: 0 auto var(--space-4) auto;
}

.modal-icon-upgrade svg {
    width: 24px;
    height: 24px;
    color: #F59E0B;
}

.upgrade-features {
    list-style: none;
    margin: var(--space-4) 0 var(--space-6) 0;
    padding: 0;
    text-align: left;
}

.upgrade-features li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.upgrade-features li svg {
    flex-shrink: 0;
    color: var(--brand-secondary);
}

.upgrade-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.upgrade-btn {
    text-decoration: none;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: var(--space-2);
    transition: color 0.15s ease;
}

.btn-text:hover {
    color: var(--text-secondary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.modal-close {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-primary-light);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0;
}

.modal-description {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: var(--space-6);
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.modal-url {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: var(--space-6);
    font-family: monospace;
}

.modal-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-6) 0;
}

/* Minimal forgot password link */
.forgot-password-link {
    text-align: center;
    margin-top: var(--space-4);
}

.forgot-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.15s ease;
}

.forgot-text:hover {
    color: var(--text-secondary);
}

.forgot-detail {
    display: none;
    font-size: 0.75rem;
    color: var(--error);
    margin-top: var(--space-2);
}

.forgot-detail.show {
    display: block;
}

/* ===== Checkbox ===== */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.checkbox-wrapper label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ===== Password Input ===== */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: var(--space-1);
}

.password-toggle:hover {
    color: var(--text-secondary);
}

/* ===== Notebook Layout ===== */
.notebook-layout {
    display: flex;
    height: calc(100vh - 56px);
    margin-top: 56px;
    overflow: hidden;
}

.notebook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 var(--space-6);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.notebook-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.notebook-url {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.notebook-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.encryption-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
    color: var(--brand-secondary);
}

.encryption-status svg {
    width: 16px;
    height: 16px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: sticky;
    top: 0;
}

.sidebar-sections {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: var(--space-1);
}

.section-item:hover {
    background: var(--bg-tertiary);
}

.section-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

.section-item-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.section-item-left span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Section 3-Dot Menu ===== */
.section-menu-container {
    position: relative;
    flex-shrink: 0;
}

.section-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.section-menu-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.section-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: -8px;
    min-width: 160px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(-4px);
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    overflow: hidden;
    padding: 6px;
}

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

.section-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.section-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.section-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.section-menu-item:hover svg {
    opacity: 1;
}

.section-menu-item-danger {
    color: var(--error);
}

.section-menu-item-danger svg {
    opacity: 0.8;
}

.section-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.section-menu-item-danger:hover svg {
    opacity: 1;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-4);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* Sidebar Header Actions */
.sidebar-header-actions {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.new-section-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);

    /* Modern Secondary / Ghost Style */
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);

    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-section-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.new-section-btn:active {
    background: var(--bg-secondary);
    transform: translateY(1px);
}

.new-section-btn svg {
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

.new-section-btn:hover svg {
    color: var(--text-primary);
}

/* ===== Editor Area ===== */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    height: 100%;
    overflow: hidden;
}

.editor-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 1rem;
    line-height: 1.7;
    padding: var(--space-8);
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
}

.editor-textarea::placeholder {
    color: var(--text-tertiary);
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.editor-footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
}

.save-status {
    color: var(--text-tertiary);
}

.save-status.saved {
    color: var(--success);
}

.editor-footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.small {
    width: 16px;
    height: 16px;
}

/* ===== Animations ===== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Status Indicators ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge.error {
    background: var(--error-bg);
    color: var(--error);
}

/* ===== Availability Check ===== */
.availability {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: 0.875rem;
}

.availability.available {
    color: var(--success);
}

.availability.taken {
    color: var(--error);
}

.availability.taken .access-link {
    color: var(--brand-primary);
    margin-left: var(--space-2);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.availability.taken .access-link:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

.availability.checking {
    color: var(--text-tertiary);
}

/* ===== DNS Setup Page ===== */
.dns-setup {
    max-width: var(--max-width-md);
    margin: 0 auto;
    padding: var(--space-12) var(--space-6);
}

.dns-step {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.dns-step-title {
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.dns-record {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    font-family: monospace;
    font-size: 0.875rem;
}

.dns-record-row {
    display: flex;
    margin-bottom: var(--space-2);
}

.dns-record-row:last-child {
    margin-bottom: 0;
}

.dns-record-label {
    width: 80px;
    color: var(--text-tertiary);
}

.dns-record-value {
    color: var(--text-primary);
    font-weight: 500;
}

.dns-status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

.dns-status.pending {
    background: var(--warning-bg);
}

.dns-status.verified {
    background: var(--success-bg);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pricing-cards {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .trust-badges {
        grid-template-columns: repeat(2, 1fr);
    }

    .steps {
        grid-template-columns: 1fr;
        gap: var(--space-12);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero {
        padding: var(--space-12) var(--space-4);
    }

    .navbar {
        padding: var(--space-3) var(--space-4);
    }

    .trust-badges {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    /* Mobile sidebar drawer */
    .sidebar {
        position: fixed;
        left: -240px;
        top: 56px;
        height: calc(100vh - 56px);
        width: 240px;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 56px;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .editor-textarea {
        padding: var(--space-4);
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Formatting Toolbar ===== */
.formatting-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.format-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.format-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.format-btn.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 var(--space-2);
}

.toolbar-spacer {
    flex: 1;
}

.auto-save-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ===== Rich Text Editor ===== */
.editor-richtext {
    width: 100%;
    height: 100%;
    padding: var(--space-6);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: none;
    outline: none;
    overflow-y: auto;
    min-height: 300px;
}

.editor-richtext:empty::before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
    pointer-events: none;
}

.editor-richtext ul,
.editor-richtext ol {
    margin-left: var(--space-6);
    padding-left: var(--space-4);
}

.editor-richtext li {
    margin-bottom: var(--space-1);
}

/* ===== Settings Modal ===== */
.settings-section {
    margin-bottom: var(--space-6);
    max-height: 400px;
    /* Fixed max height */
    overflow-y: auto;
    /* Enable scrolling */
    padding-right: var(--space-2);
    /* Space for scrollbar */
}

.settings-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
}

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

.settings-item-info {
    flex: 1;
}

.settings-item-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.settings-item-desc {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

.settings-select {
    padding: var(--space-2) var(--space-3);
    padding-right: 2rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' 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 0.5rem center;
    background-size: 0.75rem;
}

.settings-select:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* ===== Toggle Switch ===== */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    transition: 0.2s;
    border-radius: var(--radius-full);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle input:checked+.toggle-slider {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

/* ===== Button States ===== */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
}

.btn-disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== Save Status States ===== */
.save-status.saving {
    color: var(--brand-primary);
}

.save-status.saved {
    color: var(--success);
}

/* ===== Sidebar Search ===== */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    margin: var(--space-2);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.sidebar-search svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
    margin-top: auto;
    padding: var(--space-3);
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
}

.sidebar-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Section Drag Handle ===== */
.section-drag-handle {
    cursor: grab;
    color: var(--text-tertiary);
}

.section-item.dragging {
    opacity: 0.5;
    background: var(--brand-primary-light);
}

/* ===== Last Edited Timestamp ===== */
.section-item-meta {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* ===== Search Highlight ===== */
.search-highlight {
    background: var(--warning);
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.section-item.no-match {
    display: none;
}

/* ===== Export Options ===== */
.export-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.export-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.export-option-btn:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
}

.export-option-btn svg {
    color: var(--brand-primary);
}

.export-option-title {
    font-weight: 600;
    font-size: 1rem;
}

.export-option-desc {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

/* ===== Dark Mode ===== */
body.dark-mode {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;

    --border-light: #30363d;
    --border-medium: #484f58;

    --brand-primary-light: rgba(56, 139, 253, 0.15);
    --brand-primary: #58a6ff;
    --brand-secondary: #3fb950;

    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
}

body.dark-mode .modal {
    background: var(--bg-secondary);
    box-shadow: 0 16px 70px rgba(0, 0, 0, 0.5);
}

body.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .notebook-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-light);
}

body.dark-mode .sidebar {
    background: var(--bg-secondary);
    border-right-color: var(--border-light);
}

body.dark-mode .editor-richtext {
    background: var(--bg-primary);
}

body.dark-mode .formatting-toolbar {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-light);
}

body.dark-mode .editor-footer {
    background: var(--bg-secondary);
    border-top-color: var(--border-light);
}

body.dark-mode .input {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

body.dark-mode .settings-select {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' 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 0.5rem center;
    background-size: 0.75rem;
}

body.dark-mode .toggle-slider {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

body.dark-mode .sidebar-search {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

body.dark-mode .section-item:hover {
    background: var(--bg-tertiary);
}

body.dark-mode .section-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

body.dark-mode .new-section-btn {
    border-color: var(--border-light);
    color: var(--text-secondary);
}

body.dark-mode .new-section-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

body.dark-mode .section-menu-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 10px 15px -3px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

body.dark-mode .section-menu-item:hover {
    background: var(--bg-tertiary);
}

body.dark-mode .section-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

body.dark-mode .btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

body.dark-mode .btn-secondary:hover {
    background: var(--border-light);
}

body.dark-mode .export-option-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

body.dark-mode .modal-icon-upgrade {
    background: rgba(245, 158, 11, 0.15);
}

body.dark-mode .upgrade-features li {
    color: var(--text-secondary);
}

body.dark-mode .btn-text {
    color: var(--text-tertiary);
}

body.dark-mode .btn-text:hover {
    color: var(--text-secondary);
}

/* ===== Mobile Optimization for Notebook ===== */
@media (max-width: 768px) {

    /* Notebook Header */
    .notebook-header {
        padding: var(--space-2) var(--space-2);
        gap: var(--space-1);
    }

    .notebook-header-left {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .navbar-logo {
        font-size: 0.875rem;
        gap: var(--space-1);
    }

    .navbar-logo svg {
        width: 16px;
        height: 16px;
    }

    .notebook-url {
        display: none;
        /* Hide URL on mobile to save space */
    }

    .notebook-header-right {
        gap: var(--space-1);
        flex-shrink: 0;
    }

    #notebook-created-time {
        display: none;
        /* Hide in header, will show in footer */
    }

    .encryption-status {
        font-size: 0.625rem;
        padding: var(--space-1);
        gap: 2px;
    }

    .encryption-status svg {
        width: 10px;
        height: 10px;
    }

    .icon-btn {
        padding: var(--space-1);
        min-width: 32px;
        min-height: 32px;
    }

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

    /* Sidebar for Mobile */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
        overflow-y: auto !important;
    }

    /* Ensure footer is not cut off on mobile */
    .sidebar-footer {
        flex-shrink: 0;
        padding-bottom: var(--space-6);
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.mobile-open {
        display: block;
    }

    /* Section Menu Mobile Optimization */
    .section-menu-btn {
        padding: var(--space-2);
        min-width: 36px;
        min-height: 36px;
    }

    .section-menu-dropdown {
        min-width: 160px;
    }

    .section-menu-item {
        padding: var(--space-3) var(--space-4);
        font-size: 1rem;
    }

    /* Mobile Menu Button */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: var(--space-2);
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--text-primary);
        min-width: 36px;
        min-height: 36px;
    }

    .mobile-menu-toggle svg {
        width: 22px;
        height: 22px;
    }

    /* Editor Area */
    .editor-area {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Formatting Toolbar */
    .formatting-toolbar {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-1);
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .formatting-toolbar::-webkit-scrollbar {
        display: none;
    }

    .format-btn {
        min-width: 36px;
        min-height: 36px;
        padding: var(--space-2);
        flex-shrink: 0;
    }

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

    .toolbar-divider {
        height: 20px;
        flex-shrink: 0;
    }

    .toolbar-spacer {
        display: none;
    }

    .auto-save-hint {
        font-size: 0.7rem;
        padding: var(--space-1) var(--space-2);
    }

    /* Editor Content */
    .editor-content {
        padding: var(--space-3);
        padding-bottom: 100px;
        /* Ensure content isn't hidden behind sticky footer */
    }

    .editor-richtext {
        padding: var(--space-4) var(--space-3);
        font-size: 16px;
        min-height: calc(100vh - 280px);
    }

    /* Editor Footer */
    /* Editor Footer - 50/50 Grid Layout */
    .editor-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-light);
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "status timestamps"
            "button button";
        gap: var(--space-3) var(--space-2);
        padding: var(--space-3);
        align-items: center;
    }

    /* Hide editor footer when sidebar is open on mobile */
    body:has(.sidebar.mobile-open) .editor-footer {
        display: none !important;
    }

    /* Unwrap containers to let children participate in grid */
    .editor-footer-left,
    .editor-footer-right {
        display: contents;
    }

    .save-status {
        grid-area: status;
        font-size: 0.75rem;
        text-align: left;
        width: auto;
    }

    #footer-timestamps {
        grid-area: timestamps;
        font-size: 9px;
        line-height: 1.4;
        margin: 0;
        text-align: right;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    #save-btn {
        grid-area: button;
        padding: var(--space-3) var(--space-4);
        font-size: 0.9375rem;
        width: 100%;
        max-width: none;
    }

    #save-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Modals */
    .modal {
        max-width: 90%;
        margin: var(--space-4);
        padding: var(--space-5);
    }

    .modal-title {
        font-size: 1.125rem;
    }

    .modal-description {
        font-size: 0.875rem;
    }

    .modal-input {
        font-size: 16px;
        padding: var(--space-3);
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: var(--space-3);
    }

    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Mobile Small Screens ===== */
@media (max-width: 480px) {
    .notebook-header {
        padding: var(--space-2);
    }

    .sidebar {
        width: 100% !important;
        left: -100% !important;
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    .modal {
        max-width: 95%;
        padding: var(--space-4);
    }

    .editor-richtext {
        padding: var(--space-3) var(--space-2);
        min-height: calc(100vh - 240px);
    }

    #footer-timestamps span {
        font-size: 9px;
    }

    .notebook-url {
        display: none;
    }
}

/* ===== Desktop-only styles ===== */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar {
        position: relative !important;
        left: 0 !important;
    }
}

/* Sidebar Close Button - Mobile Only */
.sidebar-close-btn {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: var(--space-2) var(--space-3);
        width: 100%;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sidebar-close-btn:hover {
        color: var(--text-primary);
    }

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

    .sidebar-close-btn svg {
        width: 20px;
        height: 20px;
    }

    .settings-section {
        max-height: 300px;
        /* Smaller height on mobile */
    }
}

/* ===== Toast Notifications ===== */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 90%;
    max-width: 450px;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
    justify-content: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    background: var(--error-bg);
    border: 1px solid var(--error);
    color: #991B1B;
}

.toast-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    color: #92400E;
}

.toast-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: #065F46;
}

.toast-message {
    flex: 1;
}

.toast-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.toast-link:hover {
    opacity: 0.8;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    #toast-container {
        left: 50%;
        transform: translateX(-50%);
        bottom: var(--space-4);
        width: calc(100% - var(--space-8));
        max-width: none;
    }
}

/* Dark mode toast */
body.dark-mode .toast-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: #FCA5A5;
}

body.dark-mode .toast-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--warning);
    color: #FCD34D;
}

body.dark-mode .toast-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: #6EE7B7;
}