/* ============================================
   NOTES APP STYLES - COMPLETE REDESIGN
   ============================================ */

#notes-container {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    /* hide any accidental overflow (both axes) */
    min-width: 0;
    /* allow flex children to shrink instead of forcing horizontal scroll */
    display: flex;
    flex-direction: column;
    position: relative;
    /* Enable container queries for responsive columns based on window width */
    container-type: inline-size;
    container-name: notes;
}

.notes-main {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    /* allow shrinking within parent */
    position: relative;
}

.notes-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Debug helpers - enabled by setting localStorage.notes_debug = '1' */
.notes-debug #notes-container {
    outline: 2px dashed magenta;
}

.notes-debug .notes-debug-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 0, 150, 0.9);
    color: white;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 6px;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.notes-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.notes-search-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.notes-search-container {
    position: relative;
}

.notes-search {
    /* reserve space for the clear control inside the input area */
    padding-right: 40px;
    /* slightly smaller to match a smaller icon */
}

.notes-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    /* transparent so only the X shows */
    border: none;
    /* no border to avoid expanding past input */
    color: #fff;
    /* white X as requested */
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.notes-search-clear svg {
    pointer-events: none;
    width: 16px;
    height: 16px;
}

/* subtle circular hit area on hover/focus, using translucent overlay so it doesn't extend layout */
.notes-search-clear:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-50%) scale(1.06);
}

.notes-search-clear:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.notes-search-container:focus-within {
    border-color: var(--accent);
    background: var(--input-bg);
}

.notes-search-container svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.notes-search {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 0;
    outline: none;
}

.notes-search::placeholder {
    color: var(--text-disabled);
}

.notes-count {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.new-note-fab {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-note-fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.new-note-menu {
    position: absolute;
    bottom: 100px;
    right: 30px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 8px;
    z-index: 11;
    min-width: 200px;
    animation: slideUp 0.2s ease;
}

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

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

.new-note-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-note-menu button:hover {
    background: var(--bg-tertiary);
}

.new-note-menu button svg {
    color: var(--accent);
}

/* =======================================================
   MOBILE RESPONSIVE FIXES (phones & small screens)
   Ensure header fits, back button is visible, and editor is usable
   ======================================================= */
@media (max-width: 520px) {

    /* Compact header: hide the title and inline the count to the right of the search */
    .notes-header {
        padding: 10px 12px;
        gap: 8px;
        align-items: center;
        flex-wrap: nowrap;
    }

    /* Hide the large title on phones */
    .notes-title {
        display: none;
    }

    /* Make search take available space and keep count inline to the right */
    .notes-search-container {
        order: 1;
        flex: 1 1 auto;
        width: auto;
        margin: 0;
        min-width: 0;
    }

    .notes-count {
        order: 2;
        flex: 0 0 auto;
        margin-left: 8px;
        white-space: nowrap;
        font-size: 13px;
        align-self: center;
    }

    .notes-grid {
        padding: 16px;
    }

    .new-note-fab {
        width: 56px;
        height: 56px;
        bottom: 18px;
        right: 16px;
    }

    .new-note-menu {
        right: 16px;
        bottom: 88px;
        min-width: 180px;
    }

    /* Note editor tweaks */
    /* Editor header layout: back at left, tabs just right of it, title fills center, delete at right */
    .note-header {
        padding: 4px 4px;
        /* reduce horizontal padding to give title more room */
        gap: 4px;
        /* smaller gap between controls */
        align-items: center;
        display: flex;
        flex-wrap: nowrap;
        position: sticky;
        top: 0;
        z-index: 5;
        background: var(--bg-secondary);
    }

    .note-header .back-btn {
        order: 1;
        flex: 0 0 auto;
        margin-right: 2px;
        padding: 2px;
        /* reduce surrounding space */
        min-width: 28px;
    }

    .note-header .note-title-wrapper {
        order: 2;
        flex: 1 1 auto;
        min-width: 0;
    }

    .note-header .note-title-input {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        /* remove outer margins to use full space */
        padding: 6px 6px;
        /* smaller horizontal padding */
        font-size: 16px;
    }

    .note-header .note-tabs {
        order: 3;
        flex: 0 0 auto;
        margin-left: 2px;
        padding: 0;
        /* remove internal padding so tabs are tight */
    }

    .note-header .delete-btn {
        order: 4;
        flex: 0 0 auto;
        margin-left: 2px;
        padding: 2px 4px;
        /* reduce surrounding space */
        min-width: 28px;
    }

    /* Tighten internal spacing on tabs and delete button so title gets more room */
    .note-header .note-tabs .note-tab {
        padding: 3px 4px;
        /* tighten tab paddings further */
        font-size: 13px;
    }

    .delete-btn {
        padding: 6px 8px;
        border-radius: 6px;
    }

    .note-textarea {
        padding-bottom: 24px;
    }

    .checklist-content {
        padding-bottom: 24px;
    }

    .checklist-item input[type="text"] {
        font-size: 16px;
    }

    .checklist-items {
        gap: 6px;
    }

    /* Use CSS columns for a masonry-like layout so cards stack independently by height */
    .notes-grid {
        display: block;
        /* override desktop grid */
        column-count: 2;
        column-gap: 12px;
        padding: 8px 12px;
    }

    .note-card {
        display: inline-block;
        /* required for column flow */
        width: 100%;
        padding: 12px;
        margin: 0 0 12px 0;
        min-height: 120px;
        max-height: none;
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
        page-break-inside: avoid;
    }

    /* On mobile, stack header vertically: title on top, icons below */
    .note-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 10px;
    }

    .note-card-header h3 {
        font-size: 16px;
        margin: 0;
        white-space: normal;
        /* allow wrapping on small cards */
        overflow: visible;
        text-overflow: clip;
        width: 100%;
        /* Title takes full width since icons are below */
    }

    /* Icons row below title - pin on left, type badge on right */
    .note-card-header .note-header-icons {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .note-card-header .note-type-badge {
        font-size: 18px;
    }

    .note-card-header .pin-btn {
        padding: 2px;
        min-width: 20px;
        height: 20px;
    }

    .note-card-preview {
        font-size: 13px;
        line-height: 1.4;
        color: var(--text-secondary);
        max-height: 6em;
        /* limit excessive height while allowing wrap */
        overflow: hidden;
    }
}

/* Late override: ensure mobile uses column-based masonry instead of forcing grid
       Some desktop rules later in this file switch to columns for wider screens; to
       preserve the masonry stacking on phones we explicitly set column layout here. */
@media (max-width: 520px) {
    .notes-grid {
        display: block !important;
        /* column flow requires block container */
        column-count: 2 !important;
        column-gap: 12px !important;
        padding: 12px !important;
    }

    /* Ensure cards flow correctly into columns on mobile */
    .note-card {
        display: inline-block !important;
        /* required for column flow */
        width: 100%;
        margin: 0 0 12px 0 !important;
        break-inside: avoid !important;
        -webkit-column-break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* On small screens, prefer a single-column layout for Trash to keep cards roomy
           and avoid the large restore button covering content. Main listing remains two columns. */
    .notes-grid.trash-grid {
        column-count: 1 !important;
        grid-template-columns: 1fr !important;
    }

    /* Reduce restore button size on mobile Trash so it doesn't cover preview text */
    .notes-grid.trash-grid .note-card .restore-btn {
        font-size: 12px !important;
        padding: 4px 6px !important;
        right: 8px !important;
        bottom: 8px !important;
    }

    /* Move the hamburger/menu to the right on mobile to match desktop layout */
    .notes-menu-inline {
        order: 3;
        margin-left: auto;
    }
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 20px;
    margin: 8px 0;
}

.empty-subtitle {
    font-size: 15px !important;
    opacity: 0.6;
}

/* Responsive masonry grid using CSS grid only */
/* Mobile: grid layout for 2 columns */
.notes-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

/* Masonry columns - using container queries for responsive behavior based on window width */
/* This makes column count adapt to the Notes window size, not the viewport */
@container notes (min-width: 521px) {
    .notes-grid {
        display: block;
        column-count: 1;
        column-gap: 18px;
        padding: 30px;
    }

    .note-card {
        display: inline-block;
        width: 100%;
        margin: 0 0 18px 0;
    }
}

/* 2 columns for small-medium windows */
@container notes (min-width: 600px) {
    .notes-grid {
        column-count: 2;
    }
}

/* 3 columns for medium windows */
@container notes (min-width: 900px) {
    .notes-grid {
        column-count: 3;
    }
}

/* 4 columns for large windows */
@container notes (min-width: 1200px) {
    .notes-grid {
        column-count: 4;
    }
}

/* 5 columns for extra large windows */
@container notes (min-width: 1500px) {
    .notes-grid {
        column-count: 5;
    }
}

.note-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    /* smaller cards */
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Allow cards to be short but expand up to a reasonable limit (approx ~2x current) */
    min-height: 120px;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    break-inside: avoid;
    /* prevent column breaks when using masonry columns */
    -webkit-column-break-inside: avoid;
}

.note-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--accent);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.note-card-header h3 {
    font-size: 18px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-type-badge {
    font-size: 24px;
}

.note-header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pin-btn {
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    cursor: pointer;
    color: var(--text-disabled);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s;
    min-width: 24px;
    height: 24px;
}

.pin-btn:hover {
    color: var(--accent, #0078d7);
    opacity: 1;
    background: rgba(0, 0, 0, 0.05) !important;
}

.pin-btn.pinned {
    color: var(--accent, #0078d7);
    opacity: 1;
}

.pin-btn svg {
    display: block;
}

/* Enforce fill states to prevent "always filled" issues */
.pin-btn:not(.pinned) svg {
    fill: none !important;
}

.pin-btn.pinned svg {
    fill: currentColor !important;
}

.note-card-preview {
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    /* Allow a larger preview for taller cards but clamp to avoid runaway heights */
    max-height: 18em;
    /* approx doubles the previous visible area */
}

/* Masonry column overrides removed: grid handles all breakpoints above mobile */

.note-card-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    font-size: 13px;
    color: var(--text-disabled);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Color picker button in card footer */
.note-color-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.note-card:hover .note-color-btn {
    opacity: 1;
}

.note-color-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-color, #1e6edc);
}

.note-color-btn svg {
    width: 12px;
    height: 12px;
    color: var(--text-disabled);
}

/* Cards with custom colors */
.note-card.has-color {
    border-color: rgba(0, 0, 0, 0.1);
}

.note-card.has-color .note-card-footer {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.note-card.has-color .note-color-btn {
    opacity: 0.6;
}

.note-card.has-color:hover .note-color-btn {
    opacity: 1;
}

/* Text contrast for readability - dark text on light backgrounds */
.note-card.text-dark {
    color: #1a1a1a;
}

.note-card.text-dark h3 {
    color: #1a1a1a;
}

.note-card.text-dark .note-card-preview {
    color: #333333;
}

.note-card.text-dark .note-date {
    color: #555555;
}

.note-card.text-dark .note-type-badge {
    color: #333333;
}

.note-card.text-dark .pin-btn {
    color: #333333;
}

.note-card.text-dark .note-color-btn svg {
    color: #333333;
}

/* Text contrast for readability - light text on dark backgrounds */
.note-card.text-light {
    color: #f5f5f5;
}

.note-card.text-light h3 {
    color: #ffffff;
}

.note-card.text-light .note-card-preview {
    color: #e0e0e0;
}

.note-card.text-light .note-date {
    color: #bbbbbb;
}

.note-card.text-light .note-type-badge {
    color: #e0e0e0;
}

.note-card.text-light .pin-btn {
    color: #e0e0e0;
}

.note-card.text-light .note-color-btn {
    border-color: rgba(255, 255, 255, 0.3);
}

.note-card.text-light .note-color-btn svg {
    color: #e0e0e0;
}

.note-card.text-light .note-card-footer {
    border-top-color: rgba(255, 255, 255, 0.15);
}

.note-card.text-light .preview-item-check {
    color: #bbbbbb;
}

/* Color picker popup */
.color-picker-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.15s ease;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
}

.color-swatch:first-child {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-swatch.selected {
    border-color: var(--text-primary);
}

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

.color-swatch .check {
    position: absolute;
    color: rgba(0, 0, 0, 0.5);
}

/* Custom color picker button */
.color-swatch.custom-color-btn {
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
    border: 2px solid var(--border-color);
}

.color-swatch.custom-color-btn svg {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.hidden-color-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    pointer-events: auto;
}

.preview-checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.preview-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 0;
    line-height: 1.2;
}

.preview-item.checked {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Preview "more" indicator - subtle, no border */
.preview-more {
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 4px;
    margin-top: 4px;
    display: block;
}

/* Notes menu (hamburger) */
.notes-menu {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.notes-menu-btn {
    background: rgba(255, 255, 255, 0.02);
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
}

.notes-menu-dropdown {
    position: absolute;
    right: 0;
    top: 36px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
    min-width: 205px;
    z-index: 9999;
}

.notes-menu-item {
    padding: 10px 12px;
    cursor: pointer;
    color: inherit;
    font-size: 13px;
}

.notes-menu-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.notes-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notes-back-btn,
.notes-empty-trash-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 8px;
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
}

.notes-back-btn:hover,
.notes-empty-trash-btn:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Trash drawer styles */
.side-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -12px 0 24px rgba(0, 0, 0, 0.32);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 9998;
    display: flex;
    flex-direction: column;
}

.side-drawer.open {
    transform: translateX(0);
}

.side-drawer .side-drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.side-drawer .drawer-menu {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    text-align: left;
}

.drawer-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.drawer-item .drawer-item-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.drawer-item .drawer-item-label {
    font-size: 14px;
}

.drawer-item.drawer-trash {
    color: var(--text-primary);
}

.side-drawer .trash-header {
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.side-drawer .trash-header h2 {
    margin: 0;
    font-size: 16px;
    flex: 0 0 auto;
}

.side-drawer .trash-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.side-drawer .trash-actions .trash-search {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: inherit;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.side-drawer .trash-body {
    padding: 10px;
    overflow: auto;
    flex: 1 1 auto;
}

.side-drawer .trash-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.side-drawer .trash-footer .trash-notice {
    flex: 1 1 100%;
    margin: 4px 0 0 0;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
}

.drawer-backdrop {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 360px;
    background: rgba(0, 0, 0, 0.28);
    z-index: 9997;
}

/* ==========================
   IMPORT / EXPORT STYLES
   ========================== */
.side-drawer.import-export {
    width: 520px;
    /* wider drawer for import/export UI */
}

.side-drawer.import-export+.drawer-backdrop {
    right: 520px;
    /* ensure backdrop doesn't cover the drawer */
}

.import-export-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.import-export-section {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-section .export-notes-btn {
    align-self: start;
    padding: 10px 14px;
    background: var(--accent-color, #1e6edc);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.export-section .export-notes-btn:hover {
    filter: brightness(0.96);
}

.import-section .import-file-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: inherit;
    box-sizing: border-box;
}

.import-preview {
    margin-top: 6px;
    background: var(--bg-tertiary);
    padding: 10px;
    border-radius: 8px;
    min-height: 44px;
    max-height: 220px;
    overflow-y: auto;
    color: var(--text-primary);
}

.import-preview-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.import-preview-item {
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.import-preview-more {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.import-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 6px;
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    padding-bottom: 8px;
    z-index: 2;
}

.confirm-import-btn {
    padding: 8px 12px;
    background: var(--accent-color, #1e6edc);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.confirm-import-btn:disabled {
    opacity: 0.5;
    cursor: default;
    filter: none;
}

.cancel-import-btn {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: inherit;
    cursor: pointer;
}

.drawer-item.drawer-import {
    color: var(--text-primary);
}

@media (max-width: 520px) {

    /* On small screens, the drawer should remain full width so import is easy */
    .side-drawer.import-export {
        width: 100% !important;
        left: 0;
        right: 0;
    }

    .side-drawer.import-export+.drawer-backdrop {
        right: 100% !important;
    }
}

.notes-grid.trash-grid .note-card {
    position: relative;
}

/* Trash grid is always single column since the drawer is narrow */
.notes-grid.trash-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    column-count: unset;
}

.notes-grid.trash-grid .note-card {
    width: 100%;
    max-height: 120px;
    overflow: hidden;
}

.note-card .restore-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    top: auto;
    background: var(--accent-color, #1e6edc);
    color: #fff;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.note-card .restore-btn svg {
    opacity: 0.95;
    width: 14px;
    height: 14px;
}

.note-card .restore-btn:hover {
    filter: brightness(0.98);
}

/* Side-drawer header and close button */
.side-drawer .side-drawer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
}

.side-drawer .side-drawer-header h2 {
    margin: 0;
    font-size: 16px;
    flex: 1;
    text-align: left;
}

.side-drawer-close {
    background: transparent;
    border: none;
    padding: 8px;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.side-drawer-close:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Trash search wrap to align input and clear */
.trash-search-wrap {
    position: relative;
    width: 100%;
    display: block;
    /* allow inner input to take full width */
}

.trash-search {
    padding: 8px 10px;
    padding-right: 40px;
    /* reserve space for clear button */
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: inherit;
    width: 100%;
    box-sizing: border-box;
}

.trash-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.trash-search-clear svg {
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.trash-search-clear:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-50%) scale(1.06);
}

.trash-search-clear:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* arrival animation for restored item */
.note-card.arrival {
    transform-origin: 50% 50%;
    animation: arrivalAnim 0.52s ease;
}

@keyframes arrivalAnim {
    0% {
        transform: scale(0.92);
        opacity: 0.0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-empty-btn,
.cancel-empty-btn,
.empty-trash-in-drawer {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

/* Theme the primary destructive/restore actions to use accent */
.empty-trash-in-drawer,
.confirm-empty-btn {
    background: var(--accent-color, #1e6edc);
    color: #fff;
    border: none;
    box-shadow: 0 8px 20px rgba(30, 110, 220, 0.12);
}

.empty-trash-in-drawer:hover,
.confirm-empty-btn:hover {
    filter: brightness(0.96);
}

.cancel-empty-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Make delete button in editor more visible */
.note-header .delete-btn {
    background: #ff6b6b;
    color: #fff;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.note-header .delete-btn:hover {
    filter: brightness(0.96);
}

/* Title input wrapper - contains input and save indicator */
.note-title-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.note-title-wrapper .note-title-input {
    width: 100%;
    padding-right: 28px;
    /* Make room for the indicator */
}

/* Save indicator - positioned inside the title input on the right */
.save-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%) scale(0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #4ade80;
    opacity: 0;
    pointer-events: none;
}

.save-indicator.show {
    animation: saveFlash 2s ease forwards;
}

@keyframes saveFlash {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.7);
    }

    25% {
        opacity: 1;
        transform: translateY(-50%) scale(1.15);
    }

    50% {
        transform: translateY(-50%) scale(1);
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.9);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

/* Note Editor Styles */
.note-editor {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.note-header {
    padding: 12px 16px 12px 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Desktop ordering: back, title, tabs, delete */
.note-header .back-btn {
    order: 1;
}

.note-header .note-title-wrapper {
    order: 2;
    flex: 1;
    min-width: 0;
}

.note-header .note-tabs {
    order: 3;
}

.note-header .delete-btn {
    order: 4;
}

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

.back-btn:hover {
    background: var(--button-hover);
}

/* Tab Interface */
.note-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 2px;
    flex-shrink: 0;
}

.note-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 5px 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.note-tab:hover {
    color: var(--text-primary);
}

.note-tab.active {
    background: var(--bg-primary);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.note-title-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.note-title-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--input-bg);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

/* Color picker button in editor header */
.note-color-btn-editor {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    order: 4;
}

.note-color-btn-editor:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.note-color-btn-editor svg {
    color: var(--text-secondary);
}

.note-header .delete-btn {
    order: 5;
}

.note-textarea {
    flex: 1;
    background: var(--input-bg);
    border: none;
    color: var(--text-primary);
    padding: 20px 20px 20px 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    transition: all 0.2s ease;
}

.note-textarea:focus {
    outline: none;
    background: var(--bg-primary);
}

/* Checklist Editor */
.checklist-editor {
    overflow: hidden;
}

.checklist-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 20px 20px 8px;
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 4px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 6px 4px 6px;
    margin: -8px -6px -4px -6px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
    cursor: default;
    /* Prevent children from stretching */
    width: auto;
    min-width: 0;
    max-width: calc(100% + 12px);
    flex-wrap: nowrap;
}

.checklist-item:hover {
    border-color: var(--border-color);
}

/* Override inline styles on drag handles for compact spacing */
.checklist-item .drag-handle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    height: 18px !important;
    min-height: 18px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    cursor: grab;
    color: var(--text-disabled);
    transition: color 0.2s ease;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0;
    touch-action: none;
    /* Prevent scroll during drag on touch */
}

/* Make drag handle bigger on mobile for easier touch */
@media (max-width: 520px) {
    .checklist-item {
        gap: 16px;
        /* More space between elements on mobile */
    }

    .checklist-item .drag-handle {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
        margin-left: -6px !important;
        margin-right: -4px !important;
        margin-top: -6px !important;
        /* Raise up to align with checkbox */
    }

    .checklist-item .drag-handle svg {
        width: 18px;
        height: 22px;
    }

    .checklist-item input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
}

.checklist-item:active {
    cursor: grabbing;
}

.checklist-item:hover .drag-handle {
    color: var(--text-secondary);
}

.checklist-item .drag-handle svg {
    width: 14px;
    height: 14px;
    display: block;
    margin: 0 auto;
}


/* Drop animation for drag-over */
.drag-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--accent);
    border-radius: 8px;
    min-height: 32px;
    opacity: 0.7;
    margin: 2px 0;
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
    margin: 0;
}

.checklist-item input[type="text"],
.checklist-item textarea {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px dotted var(--border-color);
    color: var(--text-primary);
    font-size: 15px;
    padding: 0;
    font-family: inherit;
    line-height: 1.2;
    min-height: 18px;
    white-space: pre-wrap;
    word-wrap: break-word;
    resize: none;
    overflow: hidden;
}

.checklist-item textarea {
    field-sizing: content;
}

.checklist-item input[type="text"]:focus,
.checklist-item textarea:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.checklist-item input[type="checkbox"]:checked+input,
.checklist-item input[type="checkbox"]:checked+textarea {
    text-decoration: line-through;
    color: var(--text-disabled);
    opacity: 0.6;
}

.item-delete-btn {
    background: none;
    border: none;
    color: var(--text-disabled);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0;
    align-self: flex-start;
    margin-top: -6px;
    width: 28px;
    height: 28px;
}

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

.checklist-item:hover .item-delete-btn,
.checklist-item:focus-within .item-delete-btn {
    opacity: 1;
}

.item-delete-btn:hover {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
}

/* Send to another note button */
.item-send-btn {
    background: none;
    border: none;
    color: var(--text-disabled);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0;
    align-self: flex-start;
    margin-top: -6px;
    width: 28px;
    height: 28px;
}

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

.checklist-item:hover .item-send-btn,
.checklist-item:focus-within .item-send-btn {
    opacity: 1;
}

.item-send-btn:hover {
    background: rgba(30, 110, 220, 0.15);
    color: var(--accent-color, #1e6edc);
}

/* No special highlight on delete hover - item already has outline on hover */

.add-checklist-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 4px;
    margin-top: 8px;
    margin-left: 0;
    background: transparent;
    border: none;
    color: currentColor;
    opacity: 0.6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.add-checklist-item-btn:hover {
    background: rgba(128, 128, 128, 0.15);
    opacity: 1;
}

/* Item menu dropdown (replaces separate send/delete buttons) */
.item-menu-wrapper {
    position: relative;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: -4px;
}

.item-menu-btn {
    background: none;
    border: none;
    color: currentColor;
    opacity: 0.5;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    width: 24px;
    height: 24px;
}

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

/* Hide by default on desktop, show on hover only */
@media (min-width: 521px) {
    .item-menu-btn {
        opacity: 0;
    }

    .checklist-item:hover .item-menu-btn {
        opacity: 0.6;
    }

    .item-menu-btn:hover {
        opacity: 1;
    }
}

/* Always visible on mobile (no hover on touch) */
@media (max-width: 520px) {
    .item-menu-btn {
        opacity: 0.6;
    }
}

.item-menu-btn:hover {
    background: rgba(128, 128, 128, 0.15);
    opacity: 1;
}

.item-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    z-index: 100;
    display: none;
    overflow: hidden;
}

.item-menu-dropdown.open {
    display: block;
    animation: fadeIn 0.15s ease;
}

.item-menu-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease;
}

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

.item-menu-option svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.item-menu-option.item-delete-option:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.item-menu-option.item-delete-option:hover svg {
    color: #dc3545;
}


.checked-items {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.checked-header-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-disabled);
    background: none;
    border: none;
    padding: 6px 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    transition: color 0.15s ease;
}

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

.checked-header-toggle .chevron-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.checked-items.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.checked-items.collapsed .checked-items-list {
    display: none;
}

.checklist-item.checked {
    opacity: 0.6;
    background: transparent;
}

.checklist-item.checked input[type="text"] {
    text-decoration: line-through;
    color: var(--text-disabled);
}

/* ===========================================
   SEND TO MODAL - For sending checklist items to other notes
   =========================================== */
.send-to-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.15s ease;
}

.send-to-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 320px;
    max-width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease;
}

.send-to-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.send-to-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.send-to-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

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

.send-to-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.send-to-note-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.send-to-note-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    text-align: left;
    color: var(--text-primary);
    transition: all 0.15s ease;
    width: 100%;
}

.send-to-note-item:hover {
    background: var(--bg-tertiary);
}

.send-to-note-item .note-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.send-to-note-item .note-title {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.send-to-note-item .note-count {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Arrow pointing at each note */
.send-to-note-item .note-arrow {
    font-size: 18px;
    color: var(--accent-color, #1e6edc);
    flex-shrink: 0;
    font-weight: bold;
}

.send-to-note-item:hover .note-arrow {
    transform: translateX(3px);
    transition: transform 0.15s ease;
}

.send-to-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.send-to-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Move/Copy toggle button */
.send-to-copy-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-to-copy-toggle:hover {
    background: var(--bg-primary);
}

.send-to-copy-toggle .toggle-label {
    min-width: 40px;
    text-align: center;
}

.send-to-copy-toggle .toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--text-disabled);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s ease;
}

.send-to-copy-toggle .toggle-switch::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.send-to-copy-toggle.copy-mode .toggle-switch {
    background: var(--accent-color, #1e6edc);
}

.send-to-copy-toggle.copy-mode .toggle-switch::after {
    transform: translateX(16px);
}

/* ===========================================
   NOTE EDITOR COLOR STYLING
   Content areas only - header stays with theme
   =========================================== */

/* Dark text mode (for light backgrounds) - CONTENT AREA ONLY */
.note-editor.text-dark .note-textarea {
    color: #1a1a1a;
}

.note-editor.text-dark .note-textarea::placeholder {
    color: #666666;
}

.note-editor.text-dark .checklist-content {
    color: #1a1a1a;
}

/* Checklist items - dark text mode */
.note-editor.text-dark .checklist-item {
    border-color: transparent;
}

.note-editor.text-dark .checklist-item:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

.note-editor.text-dark .checklist-item .drag-handle {
    color: #666666;
}

.note-editor.text-dark .checklist-item:hover .drag-handle {
    color: #333333;
}

.note-editor.text-dark .checklist-item input[type="checkbox"] {
    accent-color: #333333;
}

.note-editor.text-dark .checklist-item textarea {
    color: #1a1a1a;
    border-bottom-color: rgba(0, 0, 0, 0.15);
}

.note-editor.text-dark .checklist-item textarea::placeholder {
    color: #666666;
}

.note-editor.text-dark .checklist-item textarea:focus {
    border-bottom-color: #333333;
}

.note-editor.text-dark .checklist-item.checked textarea {
    color: #555555;
}

.note-editor.text-dark .checked-items {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.note-editor.text-dark .checked-header-toggle {
    color: #333333 !important;
}

.note-editor.text-dark .checked-header-toggle svg {
    stroke: #333333 !important;
}

.note-editor.text-dark .checked-header-toggle span {
    color: #333333 !important;
}

/* Light text mode (for dark backgrounds) - CONTENT AREA ONLY */
.note-editor.text-light .note-textarea {
    color: #f5f5f5;
}

.note-editor.text-light .note-textarea::placeholder {
    color: #aaaaaa;
}

.note-editor.text-light .checklist-content {
    color: #f5f5f5;
}

/* Checklist items - light text mode */
.note-editor.text-light .checklist-item {
    border-color: transparent;
}

.note-editor.text-light .checklist-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.note-editor.text-light .checklist-item .drag-handle {
    color: #aaaaaa;
}

.note-editor.text-light .checklist-item:hover .drag-handle {
    color: #e0e0e0;
}

.note-editor.text-light .checklist-item input[type="checkbox"] {
    accent-color: #ffffff;
}

.note-editor.text-light .checklist-item textarea {
    color: #f5f5f5;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.note-editor.text-light .checklist-item textarea::placeholder {
    color: #aaaaaa;
}

.note-editor.text-light .checklist-item textarea:focus {
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.note-editor.text-light .checklist-item.checked textarea {
    color: #bbbbbb;
}

.note-editor.text-light .checked-items {
    border-top-color: rgba(255, 255, 255, 0.15);
}

.note-editor.text-light .checked-header-toggle {
    color: #f5f5f5 !important;
}

.note-editor.text-light .checked-header-toggle svg {
    stroke: #f5f5f5 !important;
}

.note-editor.text-light .checked-header-toggle span {
    color: #f5f5f5 !important;
}

/* Item menu button - dark text mode (for light backgrounds) */
.note-editor.text-dark .item-menu-btn {
    color: #333333 !important;
}

.note-editor.text-dark .item-menu-btn svg {
    fill: #333333 !important;
}

.note-editor.text-dark .item-menu-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Add checklist button - dark text mode */
.note-editor.text-dark .add-checklist-item-btn {
    color: #333333 !important;
}

.note-editor.text-dark .add-checklist-item-btn svg {
    stroke: #333333 !important;
}

.note-editor.text-dark .add-checklist-item-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Item menu button - light text mode (for dark backgrounds) */
.note-editor.text-light .item-menu-btn {
    color: #f5f5f5 !important;
}

.note-editor.text-light .item-menu-btn svg {
    fill: #f5f5f5 !important;
}

.note-editor.text-light .item-menu-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Add checklist button - light text mode */
.note-editor.text-light .add-checklist-item-btn {
    color: #f5f5f5 !important;
}

.note-editor.text-light .add-checklist-item-btn svg {
    stroke: #f5f5f5 !important;
}

.note-editor.text-light .add-checklist-item-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===========================================
   MOBILE OVERRIDES - Must be at the end!
   =========================================== */

/* Mobile: Main notes grid = 2 columns, Trash grid = 1 column */
@media (max-width: 520px) {

    /* Main notes grid: 2 columns on mobile */
    .notes-grid:not(.trash-grid) {
        display: block !important;
        column-count: 2 !important;
        column-gap: 12px !important;
    }

    /* Trash grid: 1 column on mobile */
    .notes-grid.trash-grid {
        display: block !important;
        column-count: 1 !important;
        column-gap: 12px !important;
    }
}