/*
Theme Name: Online Notepad
Theme URI: https://example.com
Author: Online Notepad
Author URI: https://example.com
Description: A powerful online notepad WordPress theme with rich text editor, auto-save, dark mode, password-protected notes, pin, search, export/import, and an integrated blog. All notes stored locally in the browser for maximum privacy.
Version: 2.2
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: online-notepad
Tags: one-column, custom-colors, custom-menu, featured-images, blog
*/

/* Performance: Use will-change for animations */
.blog-card,
.note-item,
.tool-btn {
  will-change: transform;
}

/* Performance: Contain layout & paint on major sections */
#sidebar,
#editor,
#ai-panel,
#batch-action-bar,
.blog-content {
  contain: layout paint;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* ═══════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════ */
:root {
  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --background: #ffffff;
  --foreground: #171717;
  --card: #ffffff;
  --card-foreground: #171717;
  --popover: #ffffff;
  --popover-foreground: #171717;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --secondary: #f5f5f5;
  --secondary-foreground: #171717;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --destructive: #ef4444;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a3a3a3;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-900: #78350f;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --color-scheme: light;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03';
}

[data-theme="dark"] {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #171717;
  --card-foreground: #fafafa;
  --popover: #171717;
  --popover-foreground: #fafafa;
  --primary: #e5e5e5;
  --primary-foreground: #171717;
  --secondary: #262626;
  --secondary-foreground: #fafafa;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --accent: #262626;
  --accent-foreground: #fafafa;
  --destructive: #dc2626;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.15);
  --ring: #737373;
  --amber-400: #fbbf24;
  --color-scheme: dark;
}

html {
  transition: color-scheme 0.3s;
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: oklch(0.85 0.15 85);
  color: oklch(0.2 0.05 85);
}
[data-theme="dark"] ::selection {
  background: oklch(0.5 0.12 85);
  color: #fafafa;
}

a { color: var(--amber-600); text-decoration: none; }
[data-theme="dark"] a { color: var(--amber-400); }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════ */
#app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--background);
  contain: layout paint;
}

#app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════ */
#navbar {
  display: flex;
  align-items: center;
  height: 44px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  padding: 0 8px;
  user-select: none;
  gap: 6px;
}

#navbar .logo {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

#navbar .logo-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--amber-500), var(--orange-600));
  color: white;
}

#navbar .logo-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-feature-settings: 'cv02', 'cv03';
}

#navbar .nav-center {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}

#navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════
   TAB BAR
   ═══════════════════════════════════════════════════════════════ */
#tab-bar {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 245, 245, 0.2);
  padding: 0 8px;
}
[data-theme="dark"] #tab-bar {
  background: rgba(38, 38, 38, 0.2);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--foreground); }
.tab-btn.active {
  border-bottom-color: var(--amber-500);
  color: var(--amber-600);
}
[data-theme="dark"] .tab-btn.active { color: var(--amber-400); }
.tab-btn svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-ghost {
  background: transparent;
  color: var(--foreground);
  padding: 4px;
  border-radius: var(--radius);
}
.btn-ghost:hover { background: var(--accent); }

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 4px;
}
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon.sm { width: 24px; height: 24px; }
.btn-icon.sm svg { width: 12px; height: 12px; }
.btn-icon.lg { width: 44px; height: 44px; border-radius: 50%; }
.btn-icon.lg svg { width: 20px; height: 20px; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 6px 12px;
  height: 32px;
}
.btn-outline:hover { background: var(--accent); }

.btn-primary {
  background: linear-gradient(to right, var(--amber-500), var(--orange-500));
  color: white;
  padding: 4px 12px;
  height: 32px;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-primary:hover {
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
  background: linear-gradient(to right, var(--amber-600), var(--orange-600));
}

.btn-destructive {
  background: var(--destructive);
  color: white;
  padding: 6px 16px;
  height: 32px;
}
.btn-destructive:hover { opacity: 0.9; }

.btn-sm { height: 28px; font-size: 12px; padding: 4px 10px; }

/* ═══════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════ */
.input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(163, 163, 163, 0.15);
}
.input::placeholder { color: var(--muted-foreground); opacity: 0.5; }
.input-sm { height: 28px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
#sidebar {
  display: flex;
  flex-direction: column;
  width: 288px;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-right 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  transform: translateX(0);
  will-change: width, transform;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] #sidebar {
  background: rgba(23, 23, 23, 0.7);
  border-right-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
#sidebar.collapsed {
  width: 56px;
  border-right-color: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
[data-theme="dark"] #sidebar.collapsed {
  border-right-color: rgba(255, 255, 255, 0.06);
}

/* Icon rail - visible when sidebar is collapsed */
.sidebar-icon-rail {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}
#sidebar.collapsed .sidebar-icon-rail {
  display: flex;
}
#sidebar.collapsed .sidebar-header h2,
#sidebar.collapsed .sidebar-actions,
#sidebar.collapsed .notes-list,
#sidebar.collapsed .sidebar-footer,
#sidebar.collapsed .sidebar-header .btn-icon {
  display: none;
}
#sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 8px 4px;
}
.rail-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.rail-btn:hover {
  background: var(--accent);
  color: var(--foreground);
}
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  background: var(--foreground);
  color: var(--background);
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  opacity: 1;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.search-wrapper {
  position: relative;
}
.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.search-wrapper .search-icon svg { width: 14px; height: 14px; }
.search-wrapper .input { padding-left: 32px; padding-right: 28px; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 2px;
}
.search-clear:hover { color: var(--foreground); }
.search-clear svg { width: 12px; height: 12px; }

/* ─── Notes List ──────────────────────────────────────────── */
.notes-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.notes-list::-webkit-scrollbar { width: 4px; }
.notes-list::-webkit-scrollbar-track { background: transparent; }
.notes-list::-webkit-scrollbar-thumb { 
  background: rgba(0,0,0,0.15); 
  border-radius: 4px;
  transition: background 0.2s;
}
.notes-list::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
[data-theme="dark"] .notes-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
[data-theme="dark"] .notes-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.notes-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}

/* ─── Note Item - Improved UI ───────────────────────────────────────────── */
.note-item {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  content-visibility: auto;
  contain-intrinsic-size: 0 72px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.note-item:hover {
  background: var(--accent);
  border-color: rgba(0,0,0,0.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transform: translateX(2px);
}
.note-item.active {
  background: rgba(245, 158, 11, 0.06);
  border-color: transparent;
  border-left-color: var(--amber-500);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}
[data-theme="dark"] .note-item.active {
  border-left-color: var(--amber-400);
  background: rgba(251, 191, 36, 0.05);
}

.note-item-inner {
  padding: 10px 12px;
}
.note-item.compact .note-item-inner { padding: 7px 12px; }

.note-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.note-title {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--foreground);
}
.note-title.empty {
  color: var(--muted-foreground);
  font-style: italic;
}
.note-item.active .note-title { color: var(--amber-700); }
[data-theme="dark"] .note-item.active .note-title { color: var(--amber-300); }

.note-badges {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-item:hover .note-badges { opacity: 1; }
.note-badges svg { width: 12px; height: 12px; color: var(--amber-500); }

.note-preview {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}

.note-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.note-date {
  font-size: 10px;
  color: rgba(115, 115, 115, 0.6);
}
[data-theme="dark"] .note-date { color: rgba(163, 163, 163, 0.6); }

.note-actions {
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-item:hover .note-actions { opacity: 1; }
.note-action-btn {
  padding: 2px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background 0.15s;
}
.note-action-btn:hover { background: var(--muted); }
.note-action-btn svg { width: 12px; height: 12px; }
.note-action-btn.delete:hover { background: rgba(239, 68, 68, 0.1); color: var(--destructive); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
  text-align: center;
}
.sidebar-footer p {
  font-size: 10px;
  color: var(--muted-foreground);
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════
   BATCH ACTION BAR (Multi-select)
   ═══════════════════════════════════════════════════════════════ */
#batch-action-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: rgba(245, 158, 11, 0.05);
  font-size: 12px;
  font-weight: 500;
  color: var(--amber-600);
}
[data-theme="dark"] #batch-action-bar {
  color: var(--amber-400);
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.batch-export-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 100px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
[data-theme="dark"] .batch-export-menu {
  background: rgba(23, 23, 23, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Multi-select checkbox on notes */
.note-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border);
  background: var(--background);
  cursor: pointer;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.note-checkbox.checked {
  background: var(--amber-500);
  border-color: var(--amber-500);
}
.note-checkbox.checked::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}
.multi-select-active .note-checkbox {
  display: flex;
}

.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
}
.sidebar-empty p {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* ═══════════════════════════════════════════════════════════════
   EDITOR
   ═══════════════════════════════════════════════════════════════ */
#editor-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  background: var(--background);
}

.editor-title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  flex-shrink: 0;
}
.editor-title-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  outline: none;
}
.editor-title-input::placeholder { color: var(--muted-foreground); opacity: 0.4; }
.editor-title-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ─── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 245, 245, 0.3);
  padding: 4px 8px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
[data-theme="dark"] .toolbar { background: rgba(38, 38, 38, 0.3); }
.toolbar::-webkit-scrollbar { height: 0; }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  opacity: 0.4;
  flex-shrink: 0;
}

/* Toolbar Group Labels */
.toolbar-group-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  opacity: 0.5;
  padding: 0 4px;
  white-space: nowrap;
  align-self: center;
  flex-shrink: 0;
  display: none;
}
@media (min-width: 768px) {
  .toolbar-group-label { display: inline; }
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}
.tool-btn:hover { 
  background: var(--accent); 
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.tool-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.tool-btn:disabled { opacity: 0.4; pointer-events: none; }
.tool-btn.active { 
  background: var(--accent); 
  color: var(--accent-foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}
.tool-btn.popover-open { 
  background: var(--accent); 
  color: var(--accent-foreground);
  box-shadow: inset 0 0 0 1px var(--ring), 0 2px 4px rgba(0,0,0,0.08);
}
.tool-btn svg { width: 14px; height: 14px; }

.tool-btn-text {
  width: auto;
  padding: 0 6px;
  font-size: 12px;
  color: var(--muted-foreground);
  gap: 4px;
  display: flex;
  align-items: center;
}
.tool-btn-text:hover { color: var(--foreground); }

/* Tooltip */
.tool-btn[data-tooltip]:hover::after,
.tool-btn[data-tooltip]:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: 4px 8px;
  background: var(--foreground);
  color: var(--background);
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tool-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* AI Magic Button */
.ai-magic-btn {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(249,115,22,0.1));
  color: var(--amber-600) !important;
}
[data-theme="dark"] .ai-magic-btn {
  background: linear-gradient(135deg, rgba(251,191,36,0.1), rgba(249,115,22,0.1));
  color: var(--amber-400) !important;
}
.ai-magic-btn:hover {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(249,115,22,0.2)) !important;
}

/* AI Magic Dropdown Menu */
.ai-magic-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 200px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  animation: fadeIn 0.1s;
}
[data-theme="dark"] .ai-magic-menu {
  background: rgba(23, 23, 23, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Color palette popover */
.color-palette {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  width: 176px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
[data-theme="dark"] .color-palette { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.color-palette-title {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.color-swatch:hover { 
  transform: scale(1.15); 
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.color-swatch:active {
  transform: scale(1.05);
}
.color-swatch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}
.color-swatch:active::after {
  width: 100%;
  height: 100%;
}
.color-swatch-none {
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%),
                    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%);
  background-size: 6px 6px;
  background-position: 0 0, 3px 3px;
  background-color: transparent;
  border: 2px dashed rgba(0,0,0,0.2);
}

/* Link input popover */
.link-input-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  width: 256px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
[data-theme="dark"] .link-input-popover { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.link-input-row {
  display: flex;
  gap: 6px;
}

/* ─── Heading dropdown ────────────────────────────────────── */
.heading-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: 160px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
[data-theme="dark"] .heading-dropdown { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.heading-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--foreground);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.heading-dropdown-item:hover { 
  background: var(--accent); 
  color: var(--accent-foreground);
  transform: translateX(2px);
}
.heading-dropdown-item:active {
  transform: translateX(2px) scale(0.98);
}
.heading-dropdown-item svg { 
  width: 14px; 
  height: 14px;
  flex-shrink: 0;
}
.heading-dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}
.heading-dropdown-item:hover::before {
  transform: scaleY(1);
}

/* ─── Editor Body ─────────────────────────────────────────── */
.editor-body {
  position: relative;
  flex: 1;
  min-height: 0;
}

#editor-content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 20px 24px;
  outline: none;
  line-height: 1.7;
  contain: layout style paint;
  will-change: contents;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
  -webkit-overflow-scrolling: touch;
}
[data-theme="dark"] #editor-content {
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#editor-content::-webkit-scrollbar { width: 6px; }
#editor-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
[data-theme="dark"] #editor-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

#editor-content:focus { outline: none; }

#editor-content h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; margin-top: 24px; }
#editor-content h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; margin-top: 16px; }
#editor-content h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; margin-top: 12px; }
#editor-content p { margin-bottom: 8px; line-height: 1.7; }
#editor-content ul { margin-bottom: 8px; padding-left: 24px; list-style-type: disc; }
#editor-content ol { margin-bottom: 8px; padding-left: 24px; list-style-type: decimal; }
#editor-content li { margin-bottom: 4px; line-height: 1.6; }
#editor-content a { color: var(--amber-600); text-decoration: underline; }
[data-theme="dark"] #editor-content a { color: var(--amber-400); }
#editor-content pre {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 12px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  overflow-x: auto;
  margin: 8px 0;
}
#editor-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.editor-placeholder {
  position: absolute;
  inset: 0;
  display: none !important;  /* Hidden - user requested removal */
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.editor-placeholder p {
  font-size: 14px;
  color: var(--muted-foreground);
  opacity: 0.3;
  user-select: none;
}

/* Editor empty state (no note selected) */
#editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  background: var(--background);
}
#editor-empty .empty-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--muted);
}
#editor-empty .empty-icon svg { width: 32px; height: 32px; color: var(--muted-foreground); opacity: 0.4; }
#editor-empty p { font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
#editor-empty .empty-hint { font-size: 12px; color: var(--muted-foreground); opacity: 0.6; margin-top: -8px; }

/* ═══════════════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════════════ */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: rgba(245, 245, 245, 0.3);
  padding: 0 12px;
  font-size: 11px;
  color: var(--muted-foreground);
  user-select: none;
}
[data-theme="dark"] #status-bar { background: rgba(38, 38, 38, 0.3); }

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-sep {
  color: var(--border);
}

.status-saved { color: var(--emerald-600); }
[data-theme="dark"] .status-saved { color: var(--emerald-500); }
.status-saving { color: var(--amber-600); }
[data-theme="dark"] .status-saving { color: var(--amber-400); }
.status-unsaved { color: var(--orange-500); }

.status-icon { display: inline-flex; vertical-align: middle; margin-right: 4px; }
.status-icon svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════
   FLOATING ACTION BUTTON
   ═══════════════════════════════════════════════════════════════ */
#fab {
  position: fixed;
  bottom: 36px;
  right: 24px;
  z-index: 30;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(to right, var(--amber-500), var(--orange-500));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#fab:hover {
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
  transform: scale(1.08);
  background: linear-gradient(to right, var(--amber-600), var(--orange-600));
}
#fab:active {
  transform: scale(0.95);
}
#fab svg { width: 22px; height: 22px; transition: transform 0.2s; }

/* FAB Ripple Effect */
.fab-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: fab-ripple-anim 0.6s ease-out;
  pointer-events: none;
}
@keyframes fab-ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   AI ASSISTANT PANEL
   ═══════════════════════════════════════════════════════════════ */
#ai-panel {
  position: fixed;
  top: 44px;
  right: 0;
  width: 360px;
  height: calc(100vh - 72px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
  z-index: 40;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s ease-out;
}
[data-theme="dark"] #ai-panel {
  background: rgba(23, 23, 23, 0.85);
  border-left-color: rgba(255, 255, 255, 0.06);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-welcome {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ai-suggested-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}
.ai-prompt-chip {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-prompt-chip:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--amber-500);
  color: var(--amber-600);
}
.ai-panel-input {
  position: relative;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
/* AI Chat Bubbles */
.ai-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 90%;
  animation: fadeIn 0.2s;
}
.ai-msg-user {
  background: linear-gradient(135deg, var(--amber-500), var(--orange-500));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-msg-assistant {
  background: var(--muted);
  color: var(--foreground);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg-assistant .ai-insert-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--amber-600);
  cursor: pointer;
  transition: all 0.15s;
}
.ai-msg-assistant .ai-insert-btn:hover {
  background: rgba(245, 158, 11, 0.1);
}
.ai-loading {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  align-self: flex-start;
}
.ai-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-foreground);
  animation: ai-bounce 1.4s infinite both;
}
.ai-loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   AI CONTEXT MENU (text selection floating toolbar)
   ═══════════════════════════════════════════════════════════════ */
#ai-context-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.15s;
}
[data-theme="dark"] #ai-context-menu {
  background: rgba(23, 23, 23, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.ai-ctx-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--foreground);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-ctx-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber-600);
}
[data-theme="dark"] .ai-ctx-btn:hover { color: var(--amber-400); }
.ai-ctx-btn svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   DIALOGS / MODALS
   ═══════════════════════════════════════════════════════════════ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}
.dialog-overlay.hidden { display: none; }

.dialog {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-width: 448px;
  width: calc(100% - 32px);
  animation: slideUp 0.15s;
}
[data-theme="dark"] .dialog {
  background: rgba(23, 23, 23, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.dialog-sm { max-width: 384px; }

/* Centered modal for important confirmations */
.dialog-centered {
  animation: slideUpCenter 0.25s ease-out;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
}
@keyframes slideUpCenter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-header h3 { font-size: 14px; font-weight: 600; }
.dialog-header-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dialog-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.1);
}
.dialog-icon svg { width: 16px; height: 16px; color: var(--amber-600); }
[data-theme="dark"] .dialog-icon svg { color: var(--amber-400); }

.dialog-body {
  padding: 16px 20px;
}
.dialog-body p {
  font-size: 13px;
  color: var(--foreground);
  line-height: 1.5;
}
.dialog-body .dialog-desc {
  font-size: 12px;
  color: var(--muted-foreground);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.form-group {
  margin-bottom: 12px;
}
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--foreground);
}
.form-error {
  font-size: 12px;
  color: var(--destructive);
  margin-top: 4px;
}

/* ─── Settings Dialog ─────────────────────────────────────── */
.settings-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
[data-theme="dark"] .settings-scroll { scrollbar-color: rgba(255,255,255,0.15) transparent; }

.settings-section {
  margin-bottom: 20px;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Theme cards */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--foreground);
}
.theme-card:hover { background: var(--accent); }
.theme-card.active {
  border-color: var(--amber-500);
  background: rgba(245, 158, 11, 0.05);
  color: var(--amber-600);
}
[data-theme="dark"] .theme-card.active { color: var(--amber-400); }
.theme-card svg { width: 16px; height: 16px; }
.theme-card span { font-size: 12px; font-weight: 500; }

/* Font size slider */
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.slider-value {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber-500);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber-500);
  border: none;
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted-foreground);
  opacity: 0.6;
  margin-top: 4px;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toggle-label-group { }
.toggle-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.toggle-desc { font-size: 11px; color: var(--muted-foreground); opacity: 0.7; margin-top: 2px; }

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--input);
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch.on { background: var(--amber-500); }
.switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.switch.on::after { transform: translateX(18px); }

/* Data management buttons */
.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-info {
  text-align: center;
  padding: 8px 0;
}
.settings-info p { font-size: 11px; color: var(--muted-foreground); }
.settings-info .version { opacity: 0.6; margin-top: 2px; }

/* ─── About Dialog ────────────────────────────────────────── */
.about-title {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding: 0 0 4px 0;
}
.about-title .gradient-text {
  background: linear-gradient(to right, var(--amber-500), var(--orange-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.about-title .version { font-weight: 400; font-size: 13px; color: var(--muted-foreground); margin-left: 6px; }
.about-content { text-align: center; font-size: 12px; color: var(--muted-foreground); line-height: 1.6; }
.about-content .feature-box, .about-content .shortcut-box {
  background: rgba(245, 245, 245, 0.5);
  border-radius: var(--radius);
  padding: 10px;
  text-align: left;
  margin: 10px 0;
}
[data-theme="dark"] .about-content .feature-box,
[data-theme="dark"] .about-content .shortcut-box {
  background: rgba(38, 38, 38, 0.5);
}
.about-content .box-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}
.about-content ul { padding-left: 16px; }
.about-content li { margin-bottom: 2px; font-size: 12px; }
.about-content kbd {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--muted);
  font-size: 10px;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.about-privacy {
  font-size: 10px;
  color: var(--muted-foreground);
  opacity: 0.5;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   DROPDOWN MENUS (navbar)
   ═══════════════════════════════════════════════════════════════ */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 192px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  animation: fadeIn 0.1s;
}
[data-theme="dark"] .dropdown-menu {
  background: rgba(23, 23, 23, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown-menu.wide { min-width: 240px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--foreground);
  transition: background 0.1s;
  text-align: left;
}
.dropdown-item:hover { background: var(--accent); }
.dropdown-item.active { background: var(--accent); }
.dropdown-item.destructive { color: var(--destructive); }
.dropdown-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.dropdown-item .shortcut {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted-foreground);
}

.dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 48px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--foreground);
  color: var(--background);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideUp 0.2s;
  pointer-events: auto;
  max-width: 320px;
}
.toast.destructive { background: var(--destructive); color: white; }

/* ═══════════════════════════════════════════════════════════════
   BLOG PAGE
   ═══════════════════════════════════════════════════════════════ */
#blog-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: var(--background);
}

.blog-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  background: rgba(245, 245, 245, 0.2);
}
[data-theme="dark"] .blog-header { background: rgba(38, 38, 38, 0.2); }
.blog-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.blog-header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.blog-header .blog-desc { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }

.blog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.cat-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover {
  background: rgba(245, 158, 11, 0.05);
  color: var(--amber-600);
  border-color: var(--amber-500);
}
[data-theme="dark"] .cat-btn:hover { color: var(--amber-400); }
.cat-btn.active {
  background: var(--amber-500);
  color: white;
  border-color: var(--amber-500);
}

.blog-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
[data-theme="dark"] .blog-content { scrollbar-color: rgba(255,255,255,0.15) transparent; }
.blog-content::-webkit-scrollbar { width: 6px; }
.blog-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
[data-theme="dark"] .blog-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* Blog Grid - 4 Column Responsive */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
}
@media (min-width: 640px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Blog Card */
.blog-card {
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(229, 229, 229, 0.5);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  content-visibility: auto;
  contain-intrinsic-size: 0 320px;
}
[data-theme="dark"] .blog-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(23, 23, 23, 0.8);
}
.blog-card:hover {
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  border-color: rgba(229, 229, 229, 0.8);
  transform: translateY(-4px);
}
[data-theme="dark"] .blog-card:hover {
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.blog-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-card:hover .blog-card-img img { transform: scale(1.08); }
.blog-card-placeholder {
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 245, 0.5);
}
[data-theme="dark"] .blog-card-placeholder { background: rgba(38, 38, 38, 0.5); }
.blog-card-placeholder svg { width: 24px; height: 24px; color: var(--muted-foreground); opacity: 0.3; }

.blog-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.blog-card-cat {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber-600);
  font-size: 10px;
  font-weight: 500;
  align-self: flex-start;
}
[data-theme="dark"] .blog-card-cat { color: var(--amber-400); }

.blog-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}
.blog-card:hover .blog-card-title { color: var(--amber-600); }
[data-theme="dark"] .blog-card:hover .blog-card-title { color: var(--amber-400); }

.blog-card-excerpt {
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  gap: 8px;
}
.blog-card-author {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.author-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-400), var(--amber-600));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.author-name {
  font-size: 11px;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blog-card-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.blog-card-reading-time {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: rgba(115, 115, 115, 0.6);
}
[data-theme="dark"] .blog-card-reading-time { color: rgba(163, 163, 163, 0.6); }
.blog-card-reading-time svg { width: 10px; height: 10px; }
.blog-card-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(115, 115, 115, 0.6);
}
[data-theme="dark"] .blog-card-date { color: rgba(163, 163, 163, 0.6); }
.blog-card-date svg { width: 10px; height: 10px; }

/* Blog Empty */
.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 16px;
  text-align: center;
}
.blog-empty .empty-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(245, 245, 245, 0.5);
  margin-bottom: 12px;
}
[data-theme="dark"] .blog-empty .empty-icon { background: rgba(38, 38, 38, 0.5); }
.blog-empty .empty-icon svg { width: 24px; height: 24px; color: var(--muted-foreground); opacity: 0.4; }
.blog-empty p { font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.blog-empty .hint { font-size: 12px; color: var(--muted-foreground); opacity: 0.6; margin-top: 4px; }

/* Blog Pagination */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.page-btn:hover:not(:disabled) { background: var(--accent); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-btn.active {
  background: var(--amber-500);
  color: white;
  border-color: var(--amber-500);
}
.page-btn svg { width: 14px; height: 14px; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, rgba(245,245,245,0.5) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   SINGLE POST
   ═══════════════════════════════════════════════════════════════ */
#single-post {
  max-width: 768px;
  margin: 0 auto;
  padding: 32px 24px;
  contain: layout paint;
}

.single-post-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  font-size: 12px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--foreground);
  margin-bottom: 16px;
  margin-left: -8px;
  transition: background 0.15s;
}
.single-post-back:hover { background: var(--accent); }
.single-post-back svg { width: 14px; height: 14px; }

.single-post-card {
  border-radius: 16px;
  border: 1px solid rgba(229, 229, 229, 0.5);
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}
[data-theme="dark"] .single-post-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(23, 23, 23, 0.8);
}

.single-post-featured {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.single-post-featured img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.single-post-body {
  padding: 24px;
}
.single-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.single-post-cat {
  padding: 2px 10px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber-600);
  font-size: 12px;
}
[data-theme="dark"] .single-post-cat { color: var(--amber-400); }
.single-post-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.single-post-date svg { width: 12px; height: 12px; }

.single-post-reading-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.single-post-reading-time svg { width: 12px; height: 12px; }

.single-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: rgba(245, 245, 245, 0.5);
}
[data-theme="dark"] .single-post-author { background: rgba(38, 38, 38, 0.5); }
.author-badge-lg {
  width: 32px;
  height: 32px;
  font-size: 14px;
}
.single-post-author-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}
.single-post-author-label {
  display: block;
  font-size: 10px;
  color: var(--muted-foreground);
}

.single-post-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .single-post-title { font-size: 28px; }
}

.single-post-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--foreground);
}
.single-post-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
}
.single-post-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.single-post-content p {
  margin-bottom: 0.75rem;
}
.single-post-content ul {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  list-style-type: disc;
}
.single-post-content li {
  margin-bottom: 0.25rem;
  line-height: 1.6;
}
.single-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   RELATED POSTS
   ═══════════════════════════════════════════════════════════════ */
.related-posts {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.related-posts-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--foreground);
}
.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) {
  .related-posts-grid {
    grid-template-columns: 1fr;
  }
}
.related-post-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none;
  color: var(--foreground);
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.6);
}
[data-theme="dark"] .related-post-card { background: rgba(23, 23, 23, 0.6); }
.related-post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: rgba(229, 229, 229, 0.8);
}
[data-theme="dark"] .related-post-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.related-post-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.related-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.related-post-card:hover .related-post-thumb img { transform: scale(1.05); }
.related-post-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.related-post-cat {
  font-size: 10px;
  font-weight: 500;
  color: var(--amber-600);
}
[data-theme="dark"] .related-post-cat { color: var(--amber-400); }
.related-post-heading {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}
.related-post-card:hover .related-post-heading { color: var(--amber-600); }
[data-theme="dark"] .related-post-card:hover .related-post-heading { color: var(--amber-400); }
.related-post-date {
  font-size: 10px;
  color: var(--muted-foreground);
}

/* ═══════════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════════ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--amber-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-text { font-size: 14px; color: var(--muted-foreground); }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    top: 44px;
    left: 0;
    z-index: 50;
    width: 280px;
    height: calc(100vh - 44px);
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }
  [data-theme="dark"] #sidebar {
    box-shadow: 4px 0 16px rgba(0,0,0,0.3);
  }
  #sidebar:not(.collapsed) {
    transform: translateX(0);
  }
  #sidebar.collapsed {
    width: 280px;
    box-shadow: none;
    transform: translateX(-100%);
  }
  .note-item { contain-intrinsic-size: 0 72px; }
  .logo-text { display: none; }
  .nav-center .menu-text { display: none; }
  .nav-right .about-text { display: none; }
  #fab { bottom: 40px; right: 16px; }
  .blog-header-search { display: none; }
  .editor-title-bar { padding: 8px 12px; }
  #editor-content { padding: 16px; }
}

@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   TOUCH PERFORMANCE
   ═══════════════════════════════════════════════════════════════ */
.overflow-y-auto, .notes-list, .blog-content, #editor-content {
  touch-action: pan-y;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR OVERLAY (mobile)
   ═══════════════════════════════════════════════════════════════ */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
}

/* ═══════════════════════════════════════════════════════════════
   WORDPRESS OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
.wp-block-image img {
  max-width: 100%;
  height: auto;
}
.aligncenter {
  display: block;
  margin: 1rem auto;
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY: REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
