/* ============================================================
   ARDESO Docs — Design System & Complete Stylesheet
   Premium Dark-mode Documentation Hub
   ============================================================ */

/* --- Google Fonts (fallback via @import) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Custom Properties ──────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:      #060C1A;
  --bg-surface:   #0C1426;
  --bg-sidebar:   #080E1C;
  --bg-elevated:  #111B30;
  --bg-card:      rgba(255,255,255,0.04);
  --bg-input:     rgba(255,255,255,0.06);
  --bg-hover:     rgba(255,255,255,0.05);
  --bg-active:    rgba(99,102,241,0.15);

  --border:       rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.12);
  --border-focus: rgba(99,102,241,0.55);

  --accent:       #6366F1;
  --accent-light: #818CF8;
  --accent-dim:   rgba(99,102,241,0.18);
  --accent-glow:  rgba(99,102,241,0.35);
  --cyan:         #22D3EE;
  --cyan-dim:     rgba(34,211,238,0.15);

  --text-primary:   #EFF4FF;
  --text-secondary: #8B9CBF;
  --text-muted:     #4A5870;
  --text-code:      #A5B4FC;

  --success:  #10B981;
  --warning:  #F59E0B;
  --danger:   #EF4444;
  --danger-dim: rgba(239,68,68,0.12);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.45);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.25);

  /* Layout */
  --sidebar-w:    272px;
  --toc-w:        220px;
  --header-h:     58px;
  --admin-panel-w: 280px;

  /* Transitions */
  --t-fast:   all 0.15s ease;
  --t-normal: all 0.25s ease;
  --t-slow:   all 0.4s ease;
}

[data-theme="light"] {
  --bg-base:    #F0F4FF;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #E8EEF8;
  --bg-elevated:#FFFFFF;
  --bg-card:    rgba(0,0,0,0.03);
  --bg-input:   rgba(0,0,0,0.05);
  --bg-hover:   rgba(0,0,0,0.04);
  --bg-active:  rgba(99,102,241,0.09);

  --border:       rgba(0,0,0,0.09);
  --border-light: rgba(0,0,0,0.15);
  --border-focus: rgba(99,102,241,0.45);

  --accent-dim:  rgba(99,102,241,0.1);
  --cyan-dim:    rgba(34,211,238,0.1);

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-code:      #4F46E5;

  --shadow-xs: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.16);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.12);

  --danger-dim: rgba(239,68,68,0.08);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ── Layout Shell ────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────── */
#header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: calc(var(--sidebar-w) - 20px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: default;
}

.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.logo-badge {
  font-size: 10px; font-weight: 600;
  background: var(--accent-dim); color: var(--accent-light);
  padding: 2px 7px; border-radius: var(--r-full);
  border: 1px solid var(--accent);
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* Theme-aware logo swap */
/* Default (dark theme): show dark logo, hide light logo */
.logo-dark-img  { display: block !important; }
.logo-light-img { display: none !important; }

/* Light theme: hide dark logo, show light logo */
[data-theme="light"] .logo-dark-img  { display: none !important; }
[data-theme="light"] .logo-light-img { display: block !important; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: nowrap;
  overflow: hidden;
  max-width: 320px;
}
.breadcrumb-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-item.current { color: var(--text-secondary); font-weight: 500; }
.breadcrumb-item.clickable:hover { color: var(--accent-light); cursor: pointer; }
.breadcrumb-sep { opacity: 0.4; flex-shrink: 0; display: flex; align-items: center; }
.breadcrumb-sep svg { width: 12px; height: 12px; }

.header-center { flex: 1; display: flex; justify-content: center; }

/* Search Trigger */
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--t-fast);
  width: 100%; max-width: 480px;
  cursor: pointer;
}
.search-trigger:hover {
  border-color: var(--border-focus);
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 1px 6px; font-size: 11px;
  font-family: monospace; color: var(--text-muted);
}

.header-right {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}

/* ── Main Layout ─────────────────────────────────────────────── */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}

.sidebar-tree {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-tree::-webkit-scrollbar { width: 4px; }
.sidebar-tree::-webkit-scrollbar-track { background: transparent; }
.sidebar-tree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-empty {
  padding: 24px 16px; text-align: center;
  font-size: 13px; color: var(--text-muted); line-height: 1.8;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

/* Category Node */
.cat-node { user-select: none; }

.cat-header {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 14px;
  cursor: pointer;
  transition: var(--t-fast);
  border-radius: 0;
  position: relative;
  min-height: 36px;
}
.cat-header:hover { background: var(--bg-hover); }
.cat-header.expanded { background: var(--bg-active); }

.cat-arrow { display: flex; align-items: center; flex-shrink: 0; color: var(--text-muted); }
.cat-arrow svg { width: 14px; height: 14px; }
.cat-icon { font-size: 15px; flex-shrink: 0; line-height: 1; }
.cat-title {
  flex: 1; font-size: 13px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cat-actions {
  display: none; align-items: center; gap: 2px;
  position: absolute; right: 8px;
}
.cat-header:hover .cat-actions { display: flex; }

.cat-action-btn {
  background: none; border: none; padding: 3px; border-radius: var(--r-xs);
  color: var(--text-muted); display: flex; align-items: center;
  transition: var(--t-fast);
}
.cat-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.cat-action-btn.danger:hover { background: var(--danger-dim); color: var(--danger); }
.cat-action-btn svg { width: 12px; height: 12px; }

.cat-children { }

/* Article Node */
.article-node {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 40px;
  cursor: pointer; transition: var(--t-fast);
  border-left: 2px solid transparent;
  font-size: 13px; color: var(--text-secondary);
}
.article-node:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.article-node.active {
  background: var(--bg-active);
  color: var(--accent-light);
  border-left-color: var(--accent);
  font-weight: 500;
}
.article-node-icon { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.6; }
.article-node-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Content Area ────────────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-base);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* ── Welcome Screen ──────────────────────────────────────────── */
.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  gap: 20px;
  padding: 40px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.welcome-icon { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 20px rgba(99,102,241,0.3)); }
.welcome-title {
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  max-width: 560px; line-height: 1.3;
}
.welcome-subtitle {
  font-size: 15px; color: var(--text-secondary); max-width: 440px; line-height: 1.7;
}

/* ── Article View ────────────────────────────────────────────── */
.article-view {
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 40px 80px;
  animation: fadeIn 0.3s ease;
}

.article-header { margin-bottom: 28px; }

.article-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  background: var(--accent-dim); color: var(--accent-light);
  padding: 3px 10px; border-radius: var(--r-full);
  border: 1px solid rgba(99,102,241,0.25);
}

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

.article-title {
  font-size: 32px; font-weight: 800; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary) 60%, var(--accent-light) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-info {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}

.article-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Tags */
.tag {
  display: inline-block;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 11px;
  padding: 2px 8px; border-radius: var(--r-full);
  font-weight: 500;
}
.tag-xs {
  display: inline-block;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 10px;
  padding: 1px 6px; border-radius: var(--r-full);
}

/* ── Article Body (rendered content) ────────────────────────── */
.article-body {
  font-size: 15px; color: var(--text-secondary); line-height: 1.8;
}
.article-body h1, .article-body h2, .article-body h3 {
  color: var(--text-primary); font-weight: 700; margin: 28px 0 12px;
  scroll-margin-top: 80px;
}
.article-body h1 { font-size: 26px; }
.article-body h2 { font-size: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.article-body h3 { font-size: 17px; }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { margin: 12px 0 16px 24px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { color: var(--text-primary); font-weight: 600; }
.article-body em { color: var(--accent-light); }
.article-body a { color: var(--accent-light); border-bottom: 1px solid transparent; transition: var(--t-fast); }
.article-body a:hover { border-bottom-color: var(--accent-light); text-decoration: none; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px; margin: 16px 0;
  background: var(--accent-dim); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-secondary); font-style: italic;
}
.article-body img {
  max-width: 100%; border-radius: var(--r-md);
  margin: 16px 0; display: block;
  box-shadow: var(--shadow-md);
}
.article-body video {
  max-width: 100%; border-radius: var(--r-md);
  margin: 16px 0;
}
.article-body iframe {
  max-width: 100%; border-radius: var(--r-md); margin: 16px 0;
}
.article-body table {
  width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px;
}
.article-body th {
  background: var(--bg-elevated); color: var(--text-primary);
  padding: 10px 14px; text-align: left; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.article-body td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.article-body tr:last-child td { border-bottom: none; }
.article-body tr:hover td { background: var(--bg-hover); }
.article-body kbd,
.preview-content kbd,
.msg-bubble kbd,
.welcome-screen kbd {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, SF Pro Mono, Menlo, Monaco, Consolas, monospace;
  color: var(--text-primary);
  display: inline-block;
  line-height: 1.2;
  box-shadow: var(--shadow-xs);
  margin: 0 2px;
  vertical-align: baseline;
  font-weight: 500;
}
.article-body code,
.preview-content code,
.msg-bubble code,
.welcome-screen code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, SF Pro Mono, Menlo, Monaco, Consolas, monospace;
  color: var(--text-code);
  display: inline-block;
  line-height: 1.2;
  box-shadow: var(--shadow-xs);
  margin: 0 2px;
  vertical-align: baseline;
  font-weight: 500;
}
.article-body pre,
.preview-content pre,
.msg-bubble pre,
.welcome-screen pre {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, SF Pro Mono, Menlo, Monaco, Consolas, monospace;
  color: var(--text-primary);
  overflow-x: auto;
  margin: 14px 0;
}
.video-block { margin: 16px 0; }
.video-block video { max-width: 100%; border-radius: var(--r-md); }

/* ── TOC Panel ───────────────────────────────────────────────── */
.toc-panel {
  width: var(--toc-w); flex-shrink: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
  position: sticky; top: 0;
  height: calc(100vh - var(--header-h));
}
.toc-header {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.toc-nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.toc-link {
  display: block; font-size: 12px; color: var(--text-muted);
  padding: 4px 8px; border-radius: var(--r-sm);
  transition: var(--t-fast); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.toc-link:hover { color: var(--accent-light); background: var(--bg-hover); }
.toc-h1 { font-weight: 600; }
.toc-h2 { padding-left: 16px; }
.toc-h3 { padding-left: 28px; font-size: 11px; }
.toc-empty { font-size: 12px; color: var(--text-muted); padding: 0 16px; }

/* ── Editor View ─────────────────────────────────────────────── */
.editor-view {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.editor-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.editor-title-area { flex: 1; }
.editor-title-input {
  width: 100%;
  background: none; border: none; outline: none;
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  font-family: inherit;
  placeholder-color: var(--text-muted);
}
.editor-title-input::placeholder { color: var(--text-muted); }
.editor-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.editor-meta {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.editor-container {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}

.editor-pane {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* Quill Editor Overrides */
.ql-toolbar {
  background: var(--bg-elevated) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 16px !important;
  flex-shrink: 0;
}
.ql-toolbar .ql-stroke { stroke: var(--text-secondary) !important; }
.ql-toolbar .ql-fill  { fill: var(--text-secondary) !important; }
.ql-toolbar button:hover .ql-stroke, .ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent-light) !important; }
.ql-toolbar button:hover .ql-fill, .ql-toolbar button.ql-active .ql-fill   { fill: var(--accent-light) !important; }
.ql-toolbar select, .ql-picker-label { color: var(--text-secondary) !important; }
.ql-picker-options { background: var(--bg-elevated) !important; border: 1px solid var(--border) !important; }
.ql-picker-item { color: var(--text-primary) !important; }
.ql-picker-item:hover { color: var(--accent-light) !important; }
.ql-container {
  background: var(--bg-base) !important;
  border: none !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 15px !important;
  flex: 1;
  overflow-y: auto;
}
.ql-editor {
  color: var(--text-secondary) !important;
  line-height: 1.8 !important;
  padding: 28px 40px !important;
  max-width: 820px; margin: 0 auto;
  min-height: 400px;
}
.ql-editor.ql-blank::before { color: var(--text-muted) !important; font-style: normal !important; }
.ql-editor h1, .ql-editor h2, .ql-editor h3 { color: var(--text-primary) !important; }
.ql-editor blockquote {
  border-left: 3px solid var(--accent) !important;
  background: var(--accent-dim) !important;
  padding: 12px 20px !important; margin: 16px 0 !important;
  border-radius: 0 var(--r-sm) var(--r-sm) 0 !important;
  color: var(--text-secondary) !important;
}
.ql-editor img { max-width: 100%; border-radius: var(--r-md); }

/* Custom toolbar button */
#customVideoBtn, #customImgUrlBtn {
  background: none; border: none; padding: 3px 6px;
  display: flex; align-items: center; cursor: pointer;
  border-radius: var(--r-xs);
  transition: var(--t-fast);
  color: var(--text-secondary);
}
#customVideoBtn:hover, #customImgUrlBtn:hover { background: var(--bg-hover); color: var(--accent-light); }
#customVideoBtn svg, #customImgUrlBtn svg { width: 16px; height: 16px; }

/* Preview Pane */
.preview-pane {
  flex: 1; overflow-y: auto;
  padding: 28px 40px 60px;
  max-width: 820px; margin: 0 auto; width: 100%;
}
.preview-content { color: var(--text-secondary); line-height: 1.8; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, var(--accent), #4F46E5);
  color: #fff; border: none; border-radius: var(--r-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--t-fast);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--r-md); }
.btn-primary.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary.btn-full { width: 100%; justify-content: center; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: var(--r-sm);
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--t-fast);
}
.btn-outline:hover { border-color: var(--border-focus); color: var(--text-primary); background: var(--bg-hover); }
.btn-outline.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; color: var(--text-secondary);
  border-radius: var(--r-sm); padding: 9px 14px;
  font-size: 13px; cursor: pointer; transition: var(--t-fast);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost.btn-full { width: 100%; justify-content: center; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger); border-radius: var(--r-sm);
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--t-fast);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-danger.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none;
  border-radius: var(--r-sm); cursor: pointer;
  color: var(--text-secondary); transition: var(--t-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.is-admin { color: var(--accent-light); }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ── Form Controls ───────────────────────────────────────────── */
.text-input, .select-input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-primary);
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  width: 100%; transition: var(--t-fast); outline: none;
}
.text-input:focus, .select-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-hover);
}
.text-input::placeholder { color: var(--text-muted); }
.select-input { cursor: pointer; }
.select-input option { background: var(--bg-elevated); color: var(--text-primary); }

.form-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.mt-2 { margin-top: 10px; }
.error-msg { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Icon Sizes ──────────────────────────────────────────────── */
.icon-sm svg, .icon-sm { width: 15px; height: 15px; }
.icon-lg svg, .icon-lg { width: 22px; height: 22px; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(2, 5, 15, 0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.modal-overlay.visible { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  transform: translateY(-12px) scale(0.97);
  transition: transform 0.2s ease;
}
.modal-overlay.visible .modal { transform: translateY(0) scale(1); }
.modal.modal-lg { max-width: 560px; }

.modal-icon { font-size: 40px; text-align: center; margin-bottom: 14px; }
.modal-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

/* Export/Import tabs */
.export-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  flex: 1; padding: 8px; border: 1px solid var(--border);
  background: none; border-radius: var(--r-sm); font-size: 13px;
  color: var(--text-secondary); cursor: pointer; transition: var(--t-fast);
}
.tab-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-light); }
.tab-content { }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--r-lg);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: var(--t-fast); color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent-light); background: var(--accent-dim); }
.upload-zone svg { width: 40px; height: 40px; opacity: 0.7; }

/* Video preview area */
.video-preview-area {
  margin-top: 12px;
  border-radius: var(--r-md); overflow: hidden;
  background: #000;
}

/* ── Search Palette ──────────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(2, 5, 15, 0.75);
  backdrop-filter: blur(10px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.search-overlay.visible { opacity: 1; pointer-events: all; }

.search-palette {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  width: 100%; max-width: 660px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(-20px); transition: transform 0.25s ease;
}
.search-overlay.visible .search-palette { transform: translateY(0); }

.search-input-wrapper {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-icon svg { width: 18px; height: 18px; }
.search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 16px; color: var(--text-primary);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }
.search-esc {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 2px 8px;
  font-size: 11px; color: var(--text-muted); font-family: monospace;
}

.search-results { max-height: 460px; overflow-y: auto; padding: 8px; }
.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.search-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; gap: 10px;
  color: var(--text-muted);
}
.search-empty svg { width: 36px; height: 36px; opacity: 0.5; }
.search-empty p { font-size: 14px; text-align: center; }
.search-hint { font-size: 12px !important; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.search-hint kbd {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 3px; padding: 0 5px; font-size: 11px; font-family: monospace;
}

.search-results-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px 4px;
  font-size: 11px; color: var(--text-muted); font-weight: 500;
}
.search-term-badge {
  background: var(--accent-dim); color: var(--accent-light);
  padding: 1px 8px; border-radius: var(--r-full); font-size: 11px;
}

.search-result-item {
  padding: 12px 14px; border-radius: var(--r-md);
  cursor: pointer; transition: var(--t-fast); margin-bottom: 4px;
}
.search-result-item:hover, .search-result-item.selected {
  background: var(--bg-active); border-color: var(--accent);
}

.sri-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sri-title { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; }
.sri-cat { font-size: 11px; color: var(--text-muted); background: var(--bg-card); padding: 1px 8px; border-radius: var(--r-full); flex-shrink: 0; }
.sri-excerpt { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; }
.sri-tags { display: flex; gap: 4px; flex-wrap: wrap; }

mark {
  background: rgba(99,102,241,0.3); color: var(--accent-light);
  border-radius: 2px; padding: 0 2px;
}

/* ── Chat Assistant ───────────────────────────────────────────── */
.assistant-widget {
  position: fixed; bottom: 28px; right: 28px; z-index: 800;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}

.assistant-toggle {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #4F46E5);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 0 rgba(99,102,241,0.4);
  cursor: pointer; transition: var(--t-fast);
  animation: pulseRing 3s ease-in-out infinite;
  position: relative;
}
.assistant-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.assistant-toggle.active { animation: none; background: linear-gradient(135deg, #4F46E5, var(--accent)); }
.assistant-toggle svg { width: 24px; height: 24px; color: #fff; }

.assistant-badge {
  position: absolute; top: 0; right: 0;
  width: 14px; height: 14px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg-base);
}

.assistant-panel {
  width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.assistant-panel.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.assistant-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #4F46E5 100%);
}
.assistant-info { display: flex; align-items: center; gap: 10px; }
.assistant-avatar {
  width: 36px; height: 36px; background: rgba(255,255,255,0.2);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.assistant-name { font-size: 14px; font-weight: 600; color: #fff; }
.assistant-status { font-size: 11px; color: rgba(255,255,255,0.75); }
.assistant-header .btn-icon { color: rgba(255,255,255,0.8); }
.assistant-header .btn-icon:hover { background: rgba(255,255,255,0.1); color: #fff; }

.assistant-messages {
  height: 320px; overflow-y: auto;
  padding: 16px 14px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  background: var(--bg-base);
}
.assistant-messages::-webkit-scrollbar { width: 4px; }
.assistant-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Messages */
.msg { display: flex; gap: 8px; }
.msg-user { flex-direction: row-reverse; }

.msg-avatar-wrap .msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-dim); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.msg-body { display: flex; flex-direction: column; gap: 4px; max-width: 85%; }

.msg-bubble {
  padding: 10px 13px; border-radius: var(--r-lg);
  font-size: 13px; line-height: 1.6;
  max-width: 100%;
}
.msg-user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), #4F46E5);
  color: #fff;
  border-radius: var(--r-lg) var(--r-sm) var(--r-lg) var(--r-lg);
  align-self: flex-end;
}
.msg-bot .msg-bubble {
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-lg);
}
.msg-bubble blockquote {
  border-left: 2px solid var(--accent);
  padding: 6px 12px; margin: 8px 0;
  background: var(--accent-dim); border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 12px; color: var(--text-secondary);
}
.msg-time { font-size: 10px; color: var(--text-muted); align-self: flex-end; }

/* Typing dots */
.msg-typing {
  display: flex; align-items: center; gap: 4px; padding: 12px 16px;
}
.msg-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Message links */
.msg-links { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.msg-link-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 10px;
  font-size: 12px; color: var(--accent-light); cursor: pointer;
  transition: var(--t-fast); text-align: left;
  font-family: inherit;
}
.msg-link-btn:hover { background: var(--bg-active); border-color: var(--accent); }
.msg-link-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.msg-link-btn span { flex: 1; text-align: left; }

/* Suggestions */
.assistant-suggestions {
  padding: 10px 14px; display: flex; gap: 6px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.suggestion-chip {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 5px 12px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: var(--t-fast); font-family: inherit;
  white-space: nowrap;
}
.suggestion-chip:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-light); }

/* Assistant input */
.assistant-input-area {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.assistant-input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 8px 14px;
  font-size: 13px; color: var(--text-primary); outline: none;
  font-family: inherit; transition: var(--t-fast);
}
.assistant-input:focus { border-color: var(--border-focus); }
.assistant-input::placeholder { color: var(--text-muted); }

.btn-send {
  width: 36px; height: 36px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #4F46E5);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--t-fast);
  box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-send:hover { transform: scale(1.08); }
.btn-send svg { width: 16px; height: 16px; color: #fff; }

/* ── Admin Sidebar (slide-in) ─────────────────────────────────── */
.admin-sidebar {
  position: fixed; top: var(--header-h); right: 0;
  width: var(--admin-panel-w); height: calc(100vh - var(--header-h));
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-light);
  z-index: 500;
  transform: translateX(100%); transition: transform 0.28s ease;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.admin-sidebar.visible { transform: translateX(0); }

.admin-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar-header h3 { font-size: 15px; font-weight: 700; }
.admin-sidebar-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 20px; }

.admin-section { display: flex; flex-direction: column; gap: 6px; }
.admin-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 4px;
}
.admin-action-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 14px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: var(--t-fast); font-family: inherit;
  text-align: left;
}
.admin-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.admin-action-btn svg { width: 16px; height: 16px; }

/* ── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r-lg); padding: 12px 18px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--cyan); }
.toast-icon { font-size: 16px; }
.toast-msg { }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRing {
  0%   { box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 0 rgba(99,102,241,0.4); }
  70%  { box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 14px rgba(99,102,241,0); }
  100% { box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 0 rgba(99,102,241,0); }
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Scrollbars (global) ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Floating Media Formatter Toolbar ────────────────────────── */
.media-format-toolbar {
  position: absolute;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.15s ease-out;
  pointer-events: auto;
}
.media-format-toolbar .toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}
.media-format-toolbar .toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.media-format-toolbar input[type="range"] {
  -webkit-appearance: none;
  width: 90px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--border-light);
  outline: none;
  cursor: pointer;
}
.media-format-toolbar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.15s ease;
}
.media-format-toolbar input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
#mediaWidthLabel {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
  font-family: ui-monospace, monospace;
}
.media-format-toolbar .toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.media-format-toolbar .toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--t-fast);
}
.media-format-toolbar .toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.media-format-toolbar .toolbar-btn.active {
  background: var(--bg-active);
  color: var(--accent-light);
  border-color: var(--accent-dim);
}
.media-format-toolbar .toolbar-btn svg {
  width: 14px;
  height: 14px;
}
.media-format-toolbar .btn-danger-text {
  color: var(--danger);
}
.media-format-toolbar .btn-danger-text:hover {
  background: var(--danger-dim);
  color: #FF5A5A;
}

/* ── Editor Active Media Indication ─────────────────────────── */
.ql-editor img, .ql-editor video {
  cursor: pointer;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}
.ql-editor img.active-media, .ql-editor video.active-media {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-glow);
}

/* ── Canvas Image Editor Styles ───────────────────────────────── */
#imageEditorCanvas {
  background-image: 
    linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%), 
    linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%), 
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  border: 1px dashed rgba(255,255,255,0.15);
}

[data-theme="light"] #imageEditorCanvas {
  background-image: 
    linear-gradient(45deg, rgba(0,0,0,0.03) 25%, transparent 25%), 
    linear-gradient(-45deg, rgba(0,0,0,0.03) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.03) 75%), 
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.03) 75%);
}

.admin-action-btn.active {
  background: var(--bg-active);
  color: var(--accent-light);
  border-color: var(--accent);
}

/* Ensure cropped images and videos covered nicely */
.article-body img[style*="aspect-ratio"], 
.article-body video[style*="aspect-ratio"],
.preview-content img[style*="aspect-ratio"], 
.preview-content video[style*="aspect-ratio"],
.ql-editor img[style*="aspect-ratio"], 
.ql-editor video[style*="aspect-ratio"],
.ql-editor .video-wrapper[style*="aspect-ratio"] video,
.article-body .video-wrapper[style*="aspect-ratio"] video,
.preview-content .video-wrapper[style*="aspect-ratio"] video {
  object-fit: cover;
}

/* Custom Video Wrapper and Play Button Overlay */
.video-wrapper {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
}
.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  margin: 0 !important;
}
.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.video-wrapper:hover .video-play-overlay {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--accent);
  box-shadow: 0 6px 24px var(--accent-glow);
  border-color: var(--accent-light);
}
.video-wrapper.playing .video-play-overlay {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  pointer-events: none;
}

/* Ensure active state outline maps to the video wrapper inside editor */
.ql-editor .video-wrapper.active-media {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-glow);
}

/* Visual Grab feedback during visual crop panning */
.ql-editor img.active-media,
.ql-editor .video-wrapper.active-media video {
  cursor: grab !important;
}
.ql-editor img.active-media:active,
.ql-editor .video-wrapper.active-media:active video {
  cursor: grabbing !important;
}
