/**
 * Notes Tool - Complete Styles
 * Light/Dark Theme Support & Responsive
 */

/* ==================== CSS Variables ==================== */
.notes-container {
    --notes-primary: var(--primary-color, #6366f1);
    --notes-primary-rgb: var(--primary-rgb, 99, 102, 241);
    --notes-secondary: var(--secondary-color, #8b5cf6);
    --notes-bg: var(--card-bg-color, #ffffff);
    --notes-surface: var(--background-color, #f8fafc);
    --notes-text: var(--text-color, #1e293b);
    --notes-text-muted: #64748b;
    --notes-border: var(--border-color, #e2e8f0);
    --notes-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --notes-success: #10b981;
    --notes-warning: #f59e0b;
    --notes-danger: #ef4444;
    --notes-radius: 8px;
    --notes-radius-lg: 16px;
    --notes-transition: 0.2s ease;
    --sidebar-width: 280px;
    --list-width: 320px;
}

.dark-theme .notes-container {
    --notes-surface: #0f172a;
    --notes-bg: #1e293b;
    --notes-text: #f1f5f9;
    --notes-text-muted: #94a3b8;
    --notes-border: #334155;
}

/* ==================== Container ==================== */
.notes-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: var(--font-family, 'Inter', sans-serif);
    color: var(--notes-text);
}

/* ==================== Header ==================== */
.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(var(--notes-primary-rgb), 0.1), rgba(var(--notes-primary-rgb), 0.05));
    border-radius: var(--notes-radius-lg);
    border: 1px solid rgba(var(--notes-primary-rgb), 0.15);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--notes-primary), var(--notes-secondary));
    border-radius: var(--notes-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 24px rgba(var(--notes-primary-rgb), 0.35);
}

.header-text h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.header-text p {
    margin: 0.25rem 0 0;
    opacity: 0.7;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== Privacy Notice ==================== */
.notes-container .privacy-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--notes-radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.notes-container .privacy-notice i {
    color: var(--notes-success);
    font-size: 1.1rem;
}

/* ==================== Buttons ==================== */
.notes-container .btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--notes-border);
    background: var(--notes-bg);
    color: var(--notes-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--notes-transition);
}

.notes-container .btn-icon:hover {
    border-color: var(--notes-primary);
    color: var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.05);
}

.notes-container .btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--notes-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--notes-transition);
}

.notes-container .btn-icon-sm:hover {
    color: var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.1);
}

.notes-container .btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--notes-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--notes-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.notes-container .btn-primary {
    background: linear-gradient(135deg, var(--notes-primary), var(--notes-secondary));
    color: white;
}

.notes-container .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--notes-primary-rgb), 0.4);
}

.notes-container .btn-outline {
    background: transparent;
    border: 1px solid var(--notes-border);
    color: var(--notes-text);
}

.notes-container .btn-outline:hover {
    border-color: var(--notes-primary);
    color: var(--notes-primary);
}

.notes-container .btn-danger {
    background: var(--notes-danger);
    color: white;
}

.notes-container .btn-full {
    width: 100%;
    justify-content: center;
}

/* ==================== Main Layout ==================== */
.notes-main-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) var(--list-width) 1fr;
    gap: 1.5rem;
    min-height: 75vh;
}

/* ==================== Sidebar ==================== */
.notes-sidebar {
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: fit-content;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.sidebar-toggle-mobile {
    display: none;
}

.sidebar-search {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--notes-text-muted);
    font-size: 0.9rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    background: var(--notes-surface);
    color: var(--notes-text);
    font-size: 0.875rem;
    transition: var(--notes-transition);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--notes-primary);
    box-shadow: 0 0 0 3px rgba(var(--notes-primary-rgb), 0.1);
}

.btn-clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--notes-text-muted);
    cursor: pointer;
    padding: 4px;
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--notes-radius);
    color: var(--notes-text-muted);
    cursor: pointer;
    transition: var(--notes-transition);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(var(--notes-primary-rgb), 0.05);
    color: var(--notes-text);
}

.nav-item.active {
    background: rgba(var(--notes-primary-rgb), 0.1);
    color: var(--notes-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item span:first-of-type {
    flex: 1;
}

.nav-count {
    background: var(--notes-surface);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dark-theme .nav-count {
    background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Sections */
.sidebar-section {
    border-top: 1px solid var(--notes-border);
    padding-top: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-header h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--notes-text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Folders */
.folders-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--notes-radius);
    cursor: pointer;
    transition: var(--notes-transition);
    font-size: 0.875rem;
    color: var(--notes-text);
}

.folder-item:hover {
    background: rgba(var(--notes-primary-rgb), 0.05);
}

.folder-item.active {
    background: rgba(var(--notes-primary-rgb), 0.1);
}

.folder-item .folder-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.folder-item .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-item .folder-count {
    font-size: 0.75rem;
    color: var(--notes-text-muted);
}

.folder-item .folder-actions {
    display: none;
    gap: 0.25rem;
}

.folder-item:hover .folder-actions {
    display: flex;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-chip {
    padding: 0.25rem 0.75rem;
    background: rgba(var(--notes-primary-rgb), 0.1);
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--notes-primary);
    cursor: pointer;
    transition: var(--notes-transition);
}

.tag-chip:hover {
    background: rgba(var(--notes-primary-rgb), 0.2);
}

.tag-chip.active {
    background: var(--notes-primary);
    color: white;
}

/* Sidebar Stats */
.sidebar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--notes-border);
    margin-top: auto;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
}

.stat-item i {
    font-size: 1rem;
    color: var(--notes-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-item span {
    font-size: 1.25rem;
    font-weight: 700;
    display: block;
}

.stat-item label {
    font-size: 0.65rem;
    color: var(--notes-text-muted);
    text-transform: uppercase;
}

/* ==================== Notes List Panel ==================== */
.notes-list-panel {
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--notes-border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.list-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-header h3 i {
    color: var(--notes-primary);
}

.list-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Sort Dropdown */
.sort-dropdown {
    position: relative;
}

.btn-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--notes-surface);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    font-size: 0.8rem;
    color: var(--notes-text-muted);
    cursor: pointer;
}

.sort-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    padding: 0.5rem;
    min-width: 160px;
    box-shadow: var(--notes-shadow);
    z-index: 100;
    display: none;
}

.sort-menu.show {
    display: block;
}

.sort-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--notes-text);
    cursor: pointer;
    border-radius: 4px;
}

.sort-option:hover {
    background: rgba(var(--notes-primary-rgb), 0.1);
}

.sort-option.active {
    color: var(--notes-primary);
    font-weight: 600;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--notes-surface);
    border-radius: var(--notes-radius);
    padding: 0.25rem;
}

.view-btn {
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--notes-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}

.view-btn.active {
    background: var(--notes-bg);
    color: var(--notes-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Filters */
.list-filters {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--notes-border);
    display: none;
}

.list-filters.has-filters {
    display: block;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(var(--notes-primary-rgb), 0.1);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--notes-primary);
}

.filter-chip button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

/* Notes List */
.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.note-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--notes-surface);
    border: 1px solid transparent;
    border-radius: var(--notes-radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--notes-transition);
}

.dark-theme .note-card {
    background: rgba(255, 255, 255, 0.03);
}

.note-card:hover {
    border-color: rgba(var(--notes-primary-rgb), 0.3);
}

.note-card.active {
    border-color: var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.05);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.note-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-card-badges {
    display: flex;
    gap: 0.25rem;
}

.note-badge {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--notes-text-muted);
}

.note-badge.pinned {
    color: var(--notes-primary);
}

.note-badge.favorite {
    color: #f59e0b;
}

.note-badge.locked {
    color: var(--notes-danger);
}

.note-card-preview {
    font-size: 0.8rem;
    color: var(--notes-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--notes-text-muted);
}

.note-card-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.note-card-tag {
    padding: 0.125rem 0.5rem;
    background: rgba(var(--notes-primary-rgb), 0.1);
    border-radius: 50px;
    font-size: 0.7rem;
    color: var(--notes-primary);
}

/* Grid View */
.notes-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.notes-list.grid-view .note-card {
    height: 140px;
}

.notes-list.grid-view .note-card-preview {
    -webkit-line-clamp: 3;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    height: 100%;
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(var(--notes-primary-rgb), 0.1), rgba(var(--notes-primary-rgb), 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-state .empty-icon i {
    font-size: 2rem;
    color: var(--notes-primary);
}

.empty-state h4 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.empty-state p {
    color: var(--notes-text-muted);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
}

/* ==================== Editor Panel ==================== */
.notes-editor-panel {
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--notes-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.editor-title-section {
    flex: 1;
    min-width: 200px;
}

#note-title {
    width: 100%;
    padding: 0.5rem 0;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--notes-text);
    outline: none;
}

#note-title::placeholder {
    color: var(--notes-text-muted);
}

.editor-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--notes-text-muted);
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.editor-actions {
    display: flex;
    gap: 0.25rem;
}

.editor-actions .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    padding: 0.5rem;
    min-width: 180px;
    box-shadow: var(--notes-shadow);
    z-index: 100;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--notes-text);
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
}

.dropdown-menu button:hover {
    background: rgba(var(--notes-primary-rgb), 0.1);
}

.dropdown-menu button.danger {
    color: var(--notes-danger);
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--notes-border);
    margin: 0.5rem 0;
}

/* Editor Mode Toggle */
.editor-mode-toggle {
    display: flex;
    padding: 0.5rem 1.25rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--notes-border);
}

.mode-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-radius: var(--notes-radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--notes-text-muted);
    cursor: pointer;
    transition: var(--notes-transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-btn:hover {
    color: var(--notes-text);
}

.mode-btn.active {
    background: rgba(var(--notes-primary-rgb), 0.1);
    color: var(--notes-primary);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--notes-border);
    background: var(--notes-surface);
}

.dark-theme .editor-toolbar {
    background: rgba(0, 0, 0, 0.2);
}

.toolbar-group {
    display: flex;
    gap: 0.125rem;
}

.toolbar-divider {
    width: 1px;
    background: var(--notes-border);
    margin: 0 0.5rem;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--notes-text-muted);
    cursor: pointer;
    transition: var(--notes-transition);
    font-size: 0.9rem;
}

.toolbar-btn:hover {
    background: rgba(var(--notes-primary-rgb), 0.1);
    color: var(--notes-primary);
}

.toolbar-btn.active {
    background: rgba(var(--notes-primary-rgb), 0.15);
    color: var(--notes-primary);
}

.toolbar-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--notes-border);
    border-radius: 4px;
    background: var(--notes-bg);
    color: var(--notes-text);
    font-size: 0.8rem;
    cursor: pointer;
}

.color-indicator {
    width: 12px;
    height: 3px;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

.toolbar-btn.color-picker-trigger {
    position: relative;
}

/* Editor Content */
.editor-content-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-content {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
    min-height: 300px;
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--notes-text-muted);
    pointer-events: none;
}

.editor-content h1,
.editor-content h2,
.editor-content h3,
.editor-content h4 {
    margin: 1rem 0 0.5rem;
    font-weight: 700;
}

.editor-content h1 {
    font-size: 1.75rem;
}

.editor-content h2 {
    font-size: 1.5rem;
}

.editor-content h3 {
    font-size: 1.25rem;
}

.editor-content h4 {
    font-size: 1.1rem;
}

.editor-content p {
    margin: 0 0 1rem;
}

.editor-content ul,
.editor-content ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}

.editor-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.05);
    border-radius: 0 var(--notes-radius) var(--notes-radius) 0;
}

.editor-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--notes-radius);
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    position: relative;
}

.editor-content code {
    background: rgba(var(--notes-primary-rgb), 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.editor-content pre code {
    background: none;
    padding: 0;
}

.editor-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.editor-content th,
.editor-content td {
    border: 1px solid var(--notes-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.editor-content th {
    background: var(--notes-surface);
    font-weight: 600;
}

.editor-content a {
    color: var(--notes-primary);
    text-decoration: underline;
}

/* Checklist */
.editor-content .checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.editor-content .checklist-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--notes-border);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-content .checklist-checkbox.checked {
    background: var(--notes-primary);
    border-color: var(--notes-primary);
    color: white;
}

.editor-content .checklist-text {
    flex: 1;
}

.editor-content .checklist-item.completed .checklist-text {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Code Block Header */
.code-block-wrapper {
    position: relative;
    margin: 1rem 0;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #0f172a;
    border-radius: var(--notes-radius) var(--notes-radius) 0 0;
}

.code-block-lang {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
}

.code-block-copy {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.code-block-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.code-block-wrapper pre {
    margin: 0;
    border-radius: 0 0 var(--notes-radius) var(--notes-radius);
}

/* Markdown Wrapper */
.markdown-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
}

.markdown-editor-column,
.markdown-preview-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.markdown-editor-column {
    border-right: 1px solid var(--notes-border);
}

.column-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--notes-text-muted);
    text-transform: uppercase;
    background: var(--notes-surface);
    border-bottom: 1px solid var(--notes-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#markdown-editor {
    flex: 1;
    resize: none;
    border: none;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: var(--notes-bg);
    color: var(--notes-text);
    outline: none;
}

.markdown-preview {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Tags Input */
.editor-tags {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--notes-border);
}

.tags-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    position: relative;
}

.tags-input-wrapper>i {
    color: var(--notes-text-muted);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(var(--notes-primary-rgb), 0.1);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--notes-primary);
}

.tag-item button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

.tag-item button:hover {
    opacity: 1;
}

#tag-input {
    flex: 1;
    min-width: 100px;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--notes-text);
    outline: none;
    padding: 0.25rem 0;
}

.tags-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    padding: 0.5rem;
    box-shadow: var(--notes-shadow);
    z-index: 100;
    margin-top: 0.25rem;
}

.tags-suggestions button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--notes-text);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
}

.tags-suggestions button:hover {
    background: rgba(var(--notes-primary-rgb), 0.1);
}

/* Folder Select */
.editor-folder {
    padding: 0.5rem 1.25rem;
    border-top: 1px solid var(--notes-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-folder>i {
    color: var(--notes-text-muted);
}

.editor-folder select {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    background: var(--notes-bg);
    color: var(--notes-text);
    font-size: 0.85rem;
}

/* No Note Selected */
.no-note-selected {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--notes-bg);
    z-index: 10;
}

/* ==================== Modals ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--notes-bg);
    border-radius: var(--notes-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-sm .modal-content,
.modal-content.modal-sm {
    max-width: 400px;
}

.modal-lg .modal-content,
.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--notes-border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h3 i {
    color: var(--notes-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--notes-text-muted);
    cursor: pointer;
    border-radius: 50%;
}

.modal-close:hover {
    background: rgba(var(--notes-primary-rgb), 0.1);
    color: var(--notes-text);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--notes-border);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--notes-text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    background: var(--notes-surface);
    color: var(--notes-text);
    font-size: 0.9rem;
    transition: var(--notes-transition);
}

.dark-theme .form-group input,
.dark-theme .form-group textarea,
.dark-theme .form-group select {
    background: rgba(255, 255, 255, 0.05);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--notes-primary);
    box-shadow: 0 0 0 3px rgba(var(--notes-primary-rgb), 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Color Options */
.color-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--notes-transition);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--notes-text);
    box-shadow: 0 0 0 2px var(--notes-bg);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--notes-border);
    border-radius: 24px;
    transition: var(--notes-transition);
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--notes-transition);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--notes-primary);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.setting-row:not(:last-child) {
    border-bottom: 1px solid var(--notes-border);
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--notes-text);
}

.settings-section h4 i {
    color: var(--notes-primary);
}

/* Export Options */
.export-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--notes-surface);
    border: 2px solid var(--notes-border);
    border-radius: var(--notes-radius);
    cursor: pointer;
    transition: var(--notes-transition);
}

.dark-theme .export-option {
    background: rgba(255, 255, 255, 0.03);
}

.export-option:hover {
    border-color: var(--notes-primary);
}

.export-option i {
    font-size: 1.5rem;
    color: var(--notes-primary);
}

.export-option span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--notes-border);
    border-radius: var(--notes-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--notes-transition);
}

.file-upload-area:hover {
    border-color: var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.02);
}

.file-upload-area i {
    font-size: 2rem;
    color: var(--notes-primary);
    margin-bottom: 0.75rem;
    display: block;
}

.file-upload-area p {
    margin: 0 0 0.25rem;
    font-weight: 500;
}

.file-upload-area span {
    font-size: 0.8rem;
    color: var(--notes-text-muted);
}

/* Backup Section */
.backup-section,
.restore-section {
    padding: 1rem 0;
}

.backup-section h4,
.restore-section h4 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.backup-section p,
.restore-section p {
    font-size: 0.85rem;
    color: var(--notes-text-muted);
    margin: 0 0 1rem;
}

.backup-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--notes-text-muted);
}

/* Versions */
.versions-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    min-height: 400px;
}

.versions-list {
    border-right: 1px solid var(--notes-border);
    padding-right: 1rem;
    overflow-y: auto;
}

.version-item {
    padding: 0.75rem;
    cursor: pointer;
    border-radius: var(--notes-radius);
    margin-bottom: 0.5rem;
    transition: var(--notes-transition);
}

.version-item:hover {
    background: rgba(var(--notes-primary-rgb), 0.05);
}

.version-item.active {
    background: rgba(var(--notes-primary-rgb), 0.1);
}

.version-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--notes-text);
}

.version-time {
    font-size: 0.75rem;
    color: var(--notes-text-muted);
}

.version-preview {
    padding: 1rem;
    background: var(--notes-surface);
    border-radius: var(--notes-radius);
    overflow-y: auto;
}

.dark-theme .version-preview {
    background: rgba(255, 255, 255, 0.03);
}

/* Help Tabs */
.help-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--notes-border);
    padding-bottom: 0.75rem;
}

.help-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--notes-text-muted);
    cursor: pointer;
    border-radius: var(--notes-radius);
}

.help-tab:hover {
    color: var(--notes-text);
}

.help-tab.active {
    background: rgba(var(--notes-primary-rgb), 0.1);
    color: var(--notes-primary);
}

.help-panel {
    display: none;
}

.help-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Shortcuts Grid */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shortcut-item kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--notes-surface);
    border: 1px solid var(--notes-border);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    box-shadow: 0 2px 0 var(--notes-border);
}

.shortcut-item span {
    font-size: 0.85rem;
    color: var(--notes-text-muted);
}

/* Features List */
.features-list {
    display: grid;
    gap: 1rem;
}

.feature-item {
    display: flex;
    gap: 1rem;
}

.feature-item>i {
    color: var(--notes-success);
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-item h5 {
    font-size: 0.95rem;
    margin: 0 0 0.25rem;
}

.feature-item p {
    font-size: 0.85rem;
    color: var(--notes-text-muted);
    margin: 0;
}

/* Tips List */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--notes-border);
    font-size: 0.9rem;
}

.tips-list li:last-child {
    border-bottom: none;
}

.tips-list i {
    color: var(--notes-warning);
    flex-shrink: 0;
}

/* Folders Select List */
.folders-select-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.folder-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--notes-surface);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    cursor: pointer;
    transition: var(--notes-transition);
    font-size: 0.9rem;
}

.dark-theme .folder-select-item {
    background: rgba(255, 255, 255, 0.03);
}

.folder-select-item:hover {
    border-color: var(--notes-primary);
}

.folder-select-item.selected {
    border-color: var(--notes-primary);
    background: rgba(var(--notes-primary-rgb), 0.05);
}

/* Color Picker Popup */
.color-picker-popup {
    position: absolute;
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    padding: 0.75rem;
    box-shadow: var(--notes-shadow);
    z-index: 200;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

.color-grid button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--notes-transition);
}

.color-grid button:hover {
    transform: scale(1.15);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--notes-bg);
    border: 1px solid var(--notes-border);
    border-radius: var(--notes-radius);
    box-shadow: var(--notes-shadow);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--notes-success);
}

.toast.error {
    border-left: 4px solid var(--notes-danger);
}

.toast.warning {
    border-left: 4px solid var(--notes-warning);
}

.toast.info {
    border-left: 4px solid var(--notes-primary);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i {
    color: var(--notes-success);
}

.toast.error i {
    color: var(--notes-danger);
}

.toast.warning i {
    color: var(--notes-warning);
}

.toast.info i {
    color: var(--notes-primary);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--notes-text-muted);
}

/* Focus Mode */
.notes-container.focus-mode .notes-header,
.notes-container.focus-mode .privacy-notice,
.notes-container.focus-mode .notes-sidebar,
.notes-container.focus-mode .notes-list-panel {
    display: none;
}

.notes-container.focus-mode .notes-main-layout {
    grid-template-columns: 1fr;
}

.notes-container.focus-mode .notes-editor-panel {
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - 100px);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1200px) {
    .notes-main-layout {
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    .notes-list-panel {
        display: none;
    }

    .notes-list-panel.show {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 500;
        margin: 1rem;
        border-radius: var(--notes-radius-lg);
    }
}

@media (max-width: 900px) {
    .notes-main-layout {
        grid-template-columns: 1fr;
    }

    .notes-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 600;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-radius: 0;
        max-height: 100vh;
    }

    .notes-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle-mobile {
        display: flex;
        position: fixed;
        left: 1rem;
        top: 90px;
        z-index: 500;
        width: 40px;
        height: 40px;
        background: var(--notes-bg);
        border: 1px solid var(--notes-border);
        border-radius: var(--notes-radius);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--notes-shadow);
    }

    .notes-editor-panel {
        min-height: 500px;
    }

    .markdown-wrapper {
        grid-template-columns: 1fr;
    }

    .markdown-editor-column {
        border-right: none;
        border-bottom: 1px solid var(--notes-border);
        max-height: 300px;
    }

    .versions-layout {
        grid-template-columns: 1fr;
    }

    .versions-list {
        border-right: none;
        border-bottom: 1px solid var(--notes-border);
        padding-right: 0;
        padding-bottom: 1rem;
        max-height: 200px;
    }
}

@media (max-width: 600px) {
    .notes-container {
        padding: 1rem;
    }

    .notes-header {
        padding: 1rem;
    }

    .header-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .header-text h2 {
        font-size: 1.25rem;
    }

    .editor-toolbar {
        padding: 0.5rem;
        gap: 0.125rem;
    }

    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .toolbar-divider {
        margin: 0 0.25rem;
    }

    .shortcuts-grid {
        grid-template-columns: 1fr;
    }

    .export-options {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 0.5rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .toast {
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    .notes-container {
        padding: 0;
    }

    .notes-header,
    .privacy-notice,
    .notes-sidebar,
    .notes-list-panel,
    .editor-toolbar,
    .editor-header,
    .editor-mode-toggle,
    .editor-tags,
    .editor-folder {
        display: none !important;
    }

    .notes-main-layout {
        display: block;
    }

    .notes-editor-panel {
        border: none;
        box-shadow: none;
    }

    .editor-content {
        padding: 0;
    }
}