/* style.css - Premium Styles for Standalone WYSIWYG Editor */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Light Theme Variables (Default) - High Contrast & Crisp Visuals */
  --bg-primary: #f1f5f9;      /* Slate-100 */
  --bg-secondary: #ffffff;    /* Pure white */
  --bg-tertiary: #e2e8f0;     /* Slate-200 */
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-color: #cbd5e1;    /* Slate-300 - High Contrast Border */
  --border-focus: #475569;    /* Slate-600 */
  --text-primary: #0f172a;    /* Slate-900 */
  --text-secondary: #334155;  /* Slate-700 - Highly readable secondary text */
  --text-muted: #64748b;      /* Slate-500 */
  --accent: #3730a3;          /* Indigo-800 - Enhanced Accessibility Contrast */
  --accent-hover: #1e1b4b;    /* Indigo-950 */
  --accent-glow: rgba(79, 70, 229, 0.15);
  --active-blue: #1d4ed8;     /* Blue-700 */
  --active-bg: #eff6ff;       /* Blue-50 */
  --success: #047857;         /* Emerald-700 */
  --success-bg: #ecfdf5;      /* Emerald-50 */
  --warning: #b45309;         /* Amber-700 */
  --error: #b91c1c;           /* Red-700 */
  --error-bg: #fef2f2;        /* Red-50 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --glass-blur: blur(12px);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  --editor-font: 'Outfit', sans-serif;
  --code-font: 'Fira Code', monospace;
}

[data-theme="dark"] {
  /* Dark Theme Variables - High Contrast Midnight Palette */
  --bg-primary: #070a13;      /* Deep midnight blue-black */
  --bg-secondary: #0f1524;    /* Slate-900 core panels */
  --bg-tertiary: #1b253b;     /* Slate-800 widgets */
  --bg-glass: rgba(15, 21, 36, 0.85);
  --border-color: #2b3954;    /* Lightened slate border for high contrast separation */
  --border-focus: #3b82f6;    /* Blue-500 focus indicator */
  --text-primary: #f8fafc;    /* Slate-50 - Crisp text */
  --text-secondary: #cbd5e1;  /* Slate-300 */
  --text-muted: #94a3b8;      /* Slate-400 */
  --accent: #818cf8;          /* Indigo-400 - High brightness for accessibility */
  --accent-hover: #a5b4fc;    /* Indigo-300 */
  --accent-glow: rgba(129, 140, 248, 0.25);
  --active-blue: #60a5fa;     /* Blue-400 */
  --active-bg: rgba(96, 165, 250, 0.15);
  --success: #34d399;         /* Emerald-400 */
  --success-bg: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;         /* Amber-400 */
  --error: #f87171;           /* Red-400 */
  --error-bg: rgba(248, 113, 113, 0.12);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--editor-font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* App Header Styling */
.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-section h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-section span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
}

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 10px var(--accent-glow);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Dropdown styling */
.select-wrapper {
  position: relative;
}

.select-dropdown {
  appearance: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.select-dropdown:hover {
  border-color: var(--border-focus);
}

.select-wrapper::after {
  content: '▼';
  font-size: 0.6rem;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* Theme Toggle Segmented Control */
.theme-segmented-control {
  display: flex;
  background-color: var(--bg-tertiary);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  user-select: none;
}

.theme-tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-tab-btn.active {
  background-color: var(--bg-secondary);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-tab-btn.active {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.theme-tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-tab-btn:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Layout Workspace */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  overflow-y: auto;
}

.sidebar-collapsed {
  width: 0;
  overflow: hidden;
  border-right: none;
}

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

.sidebar-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Template Grid list */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background-color: var(--bg-primary);
}

.template-card:hover {
  border-color: var(--accent);
  background-color: var(--bg-secondary);
  transform: translateY(-1px);
}

.template-card-icon {
  background-color: var(--bg-tertiary);
  color: var(--accent);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-card-info h3 {
  font-size: 0.85rem;
  font-weight: 600;
}

.template-card-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Document Outline */
.document-outline {
  max-height: 250px;
  overflow-y: auto;
}

.outline-item {
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

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

.outline-h1 { font-weight: 600; padding-left: 8px; color: var(--text-primary); }
.outline-h2 { padding-left: 16px; }
.outline-h3 { padding-left: 24px; font-style: italic; }
.outline-h4 { padding-left: 32px; font-size: 0.75rem; }

/* Stats Panel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-box {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Editor Main Workspace */
.editor-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Formatting Toolbar */
.toolbar-container {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  z-index: 5;
  user-select: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

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

.toolbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.toolbar-btn:hover {
  background-color: var(--border-focus);
  color: var(--text-primary);
}

.toolbar-btn.active {
  background-color: var(--active-bg);
  color: var(--active-blue);
}

.toolbar-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.25px;
}

/* Font styles dropdowns in toolbar */
.toolbar-select {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 20px 4px 8px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Color Picker styles */
.color-picker-wrapper {
  position: relative;
}

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

.color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  margin-top: 10px;
}

/* Double Pane Editor Views */
.panes-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-secondary);
  transition: width var(--transition-normal);
}

/* Divider Split dragbar */
.split-divider {
  width: 8px;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  cursor: col-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: background-color var(--transition-fast);
}

.split-divider:hover, .split-divider.dragging {
  background-color: var(--border-focus);
}

.split-divider::after {
  content: '┊';
  color: var(--text-secondary);
  font-size: 1.2rem;
  font-weight: bold;
}

.pane-header {
  padding: 8px 16px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

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

/* View Mode Toggles */
.view-toggles {
  display: flex;
  background-color: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.view-toggle-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background-color: var(--bg-secondary);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Rich Text WYSIWYG Editor */
.wysiwyg-editor {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  outline: none;
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 1rem;
  min-height: 100%;
}

.wysiwyg-editor:focus {
  background-color: var(--bg-secondary);
}

/* Stylings for rendered content inside WYSIWYG editor & preview */
.wysiwyg-editor p {
  margin-bottom: 16px;
}

.wysiwyg-editor h1, .wysiwyg-editor h2, .wysiwyg-editor h3, 
.wysiwyg-editor h4, .wysiwyg-editor h5, .wysiwyg-editor h6 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.wysiwyg-editor h1 { font-size: 2.25rem; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.wysiwyg-editor h2 { font-size: 1.75rem; }
.wysiwyg-editor h3 { font-size: 1.35rem; }
.wysiwyg-editor h4 { font-size: 1.15rem; }

.wysiwyg-editor ul, .wysiwyg-editor ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.wysiwyg-editor li {
  margin-bottom: 6px;
}

.wysiwyg-editor blockquote {
  border-left: 4px solid var(--accent);
  padding: 10px 20px;
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
  font-style: italic;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.wysiwyg-editor pre {
  background-color: var(--bg-tertiary);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--code-font);
  font-size: 0.9rem;
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.wysiwyg-editor code {
  font-family: var(--code-font);
  background-color: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.wysiwyg-editor pre code {
  padding: 0;
  background-color: transparent;
  font-size: inherit;
}

.wysiwyg-editor table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.wysiwyg-editor table th, .wysiwyg-editor table td {
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  text-align: left;
}

.wysiwyg-editor table th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
}

.wysiwyg-editor img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.wysiwyg-editor img:hover {
  outline: 2px solid var(--accent);
}

.wysiwyg-editor a {
  color: var(--accent);
  text-decoration: underline;
}

.wysiwyg-editor hr {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 24px 0;
}

/* Source Code Editor View */
.code-editor-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.code-textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  padding: 16px 20px 16px 60px;
  font-family: var(--code-font);
  font-size: 0.85rem;
  line-height: 1.5;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
}

/* Custom Line Numbers */
.line-numbers {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 12px;
  user-select: none;
  color: var(--text-muted);
  font-family: var(--code-font);
  font-size: 0.85rem;
  line-height: 1.5;
  background-color: var(--bg-tertiary);
  border-right: 1px solid var(--border-color);
  height: 100%;
  overflow: hidden;
}

.line-number {
  height: 1.5em;
}

/* Status Bar Footer */
.status-bar {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 5;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-path {
  font-family: var(--code-font);
  font-size: 0.7rem;
  color: var(--accent);
}

.status-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-bullet.success {
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-bullet.saving {
  background-color: var(--warning);
  animation: pulse 1s infinite alternate;
}

/* Modal Popup Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: var(--glass-blur);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 450px;
  max-width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* File Upload Dropzone */
.file-dropzone {
  border: 2px dashed var(--border-color);
  padding: 24px;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-primary);
  transition: all var(--transition-fast);
}

.file-dropzone:hover, .file-dropzone.dragover {
  border-color: var(--accent);
  background-color: var(--active-bg);
}

.file-dropzone svg {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.file-dropzone p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Interactive Table Creator Grid Selection */
.table-grid-creator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.grid-matrix {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  grid-template-rows: repeat(10, 18px);
  gap: 4px;
}

.grid-cell {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.grid-cell.highlighted {
  background-color: var(--accent-glow);
  border-color: var(--accent);
}

.grid-cell.selected {
  background-color: var(--accent);
  border-color: var(--accent);
}

.grid-size-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-primary);
}

/* Floating Quick Formatting Bar */
.floating-format-bar {
  position: absolute;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  gap: 2px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.floating-format-bar.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-format-bar .toolbar-btn {
  background-color: transparent;
}

.floating-format-bar .toolbar-btn:hover {
  background-color: var(--bg-tertiary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
/* Responsive video and iframe styling in editor */
.wysiwyg-editor iframe,
.wysiwyg-editor video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.media-tab-pane {
  animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Media Tabs Override */
.modal .view-toggle-btn {
  background: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.modal .view-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
}
[data-theme="dark"] .modal .view-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Export Dropdown Position Override */
#dropdown-export-menu {
  display: block;
}

#dropdown-export-menu .modal {
  transform: none;
}

/* Utility Animations */
@keyframes pulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Editor Placeholder */
.wysiwyg-editor:empty::before {
  content: "Start typing your HTML document...";
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive adjust */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 61px;
    height: calc(100vh - 61px - 32px);
    z-index: 15;
    box-shadow: var(--shadow-xl);
  }
  
  .panes-wrapper {
    flex-direction: column;
  }
  
  .split-divider {
    display: none;
  }
  
  .pane {
    width: 100% !important;
    height: 50% !important;
  }
}

/* Find & Replace Panel Styling */
.find-replace-panel {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.find-replace-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.find-field-group {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  max-width: 480px;
}

.find-field-group .input-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.find-input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  font-family: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.find-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.match-count {
  position: absolute;
  right: 64px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  background-color: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
}

.find-nav-buttons {
  position: absolute;
  right: 6px;
  display: flex;
  gap: 2px;
}

.find-nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.find-nav-btn svg {
  width: 14px;
  height: 14px;
}

.find-options-group {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  cursor: pointer;
  accent-color: var(--accent);
}

.find-close-group {
  margin-left: auto;
}

.btn-close-find {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.btn-close-find:hover {
  color: var(--error);
}

.replace-row {
  border-top: 1px dashed var(--border-color);
  padding-top: 6px;
}

.replace-action-buttons {
  position: absolute;
  right: 6px;
  display: flex;
  gap: 4px;
}

.btn-replace {
  padding: 3px 8px !important;
  font-size: 0.75rem !important;
  height: 24px !important;
}

/* Emoji Picker Popover Styling */
.emoji-popover {
  position: absolute;
  width: 280px;
  background-color: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  animation: popIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.emoji-picker-header {
  padding: 10px 10px 6px 10px;
  border-bottom: 1px solid var(--border-color);
}

.emoji-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.emoji-search-wrapper svg {
  position: absolute;
  left: 8px;
  color: var(--text-muted);
}

.emoji-search-wrapper input {
  width: 100%;
  padding: 6px 10px 6px 26px;
  font-family: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
}

.emoji-search-wrapper input:focus {
  border-color: var(--accent);
}

.emoji-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 4px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.emoji-picker-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.emoji-tab {
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.5;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.emoji-tab:hover {
  opacity: 0.8;
  background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .emoji-tab:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.emoji-tab.active {
  opacity: 1;
  border-bottom-color: var(--accent);
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.emoji-cell {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  user-select: none;
}

.emoji-cell:hover {
  background-color: var(--bg-tertiary);
  transform: scale(1.15);
  box-shadow: 0 0 6px var(--accent-glow);
}

.emoji-picker-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  user-select: none;
}

.emoji-preview-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.emoji-shortcut-tip {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: right;
}

/* Predefined Code Snippets Syntax Highlighting */
.wysiwyg-editor pre {
  position: relative;
}

.code-kw {
  color: #818cf8; /* Light Indigo */
  font-weight: 600;
}

[data-theme="light"] .code-kw {
  color: #3730a3; /* Indigo-800 */
}

.code-str {
  color: #34d399; /* Emerald-400 */
}

[data-theme="light"] .code-str {
  color: #047857; /* Emerald-700 */
}

.code-num {
  color: #fbbf24; /* Amber-400 */
}

[data-theme="light"] .code-num {
  color: #b45309; /* Amber-700 */
}

.code-com {
  color: #64748b; /* Slate-500 */
  font-style: italic;
}

[data-theme="light"] .code-com {
  color: #94a3b8; /* Slate-400 */
}

.code-func {
  color: #60a5fa; /* Blue-400 */
  font-weight: 500;
}

[data-theme="light"] .code-func {
  color: #1d4ed8; /* Blue-700 */
}

.code-tag {
  color: #f87171; /* Red-400 */
}

[data-theme="light"] .code-tag {
  color: #b91c1c; /* Red-700 */
}

.code-attr {
  color: #f59e0b; /* Amber-500 */
}

[data-theme="light"] .code-attr {
  color: #d97706; /* Amber-600 */
}
