/* ============================================================
   PubForge – styles.css
   Layout, themes, forms, UI components
   ============================================================ */

/* ---- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@400;500&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* ---- CSS Custom Properties: Light Mode -------------------- */
:root {
  --primary:        rgb(71, 190, 185);
  --primary-dim:    rgba(71, 190, 185, 0.15);
  --primary-hover:  rgb(55, 168, 163);
  --text:           rgb(22, 6, 71);
  --text-muted:     #8b949e;
  --text-subtle:    #6e7681;
  --surface:        rgb(241, 241, 241);
  --surface-raised: #ffffff;
  --bg:             #ffffff;
  --border:         #e5e7eb;
  --border-focus:   rgb(71, 190, 185);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.14);
  --topbar-h:       52px;
  --panel-gap:      0px;
  --radius:         8px;
  --radius-sm:      5px;
  --transition:     0.18s ease;
  --font-ui:        'DM Sans', sans-serif;
  --font-mono:      'DM Mono', monospace;
  --font-display:   'DM Serif Display', serif;
  --danger:         #e53e3e;
  --danger-dim:     rgba(229, 62, 62, 0.1);
  --warning:        #d97706;
  --success:        #16a34a;
}

/* ---- CSS Custom Properties: Dark Mode --------------------- */
.dark {
  --primary:        rgb(71, 190, 185);
  --primary-dim:    rgba(71, 190, 185, 0.12);
  --primary-hover:  rgb(90, 208, 203);
  --text:           #c9d1d9;
  --text-muted:     #8b949e;
  --text-subtle:    #6e7681;
  --surface:        #161b22;
  --surface-raised: #1c2330;
  --bg:             #0d1117;
  --border:         #30363d;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.5);
}

/* ---- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ---- TOP BAR ---------------------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), transform 0.3s ease, opacity 0.3s ease;
}

.topbar.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

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

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}

.logo-mark {
  font-size: 1.4rem;
  color: var(--primary);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ---- BUTTONS ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  outline: none;
}

.btn:focus-visible { box-shadow: 0 0 0 3px var(--primary-dim); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #c53030; }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

.icon-btn { padding: 6px 8px; }
.icon-btn svg { display: block; }

/* Theme toggle icon visibility */
.dark .icon-sun { display: none; }
.dark .icon-moon { display: block; }
.icon-moon { display: none; }
.icon-sun { display: block; }

/* ---- FOCUS MODE EXIT BUTTON ------------------------------- */
.focus-exit-btn {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 200;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.focus-exit-btn:hover { color: var(--text); background: var(--surface); }
body.focus-mode .focus-exit-btn { display: flex; }

/* ---- MAIN CONTENT ----------------------------------------- */
.main-content {
  margin-top: var(--topbar-h);
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

body.focus-mode .main-content {
  margin-top: 0;
  height: 100vh;
}

/* ---- PANELS ----------------------------------------------- */
.panel {
  overflow-y: auto;
  height: 100%;
  transition: width 0.3s ease;
}

.panel-left {
  width: 60%;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.panel-right {
  width: 40%;
  background: var(--surface);
  transition: width 0.3s ease, opacity 0.3s ease;
}

body.focus-mode .panel-right {
  width: 0;
  overflow: hidden;
  opacity: 0;
}

body.focus-mode .panel-left {
  width: 100%;
  border-right: none;
}

/* ---- FORM CONTAINER --------------------------------------- */
.form-container {
  padding: 20px 28px 0;
}

/* ---- FORM SECTIONS (collapsible) -------------------------- */
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface-raised);
  transition: border-color var(--transition);
}

.form-section:focus-within { border-color: var(--border-focus); }

.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}
.section-toggle:hover { background: var(--surface); }

.section-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.optional-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-dim);
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: 6px;
  letter-spacing: 0;
  text-transform: none;
}

.chevron {
  color: var(--text-subtle);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.form-section.collapsed .chevron { transform: rotate(-90deg); }

.section-body {
  padding: 4px 16px 16px;
  display: block;
  transition: none;
}

.form-section.collapsed .section-body {
  display: none;
}

/* ---- FIELD GROUPS ----------------------------------------- */
.field-group { margin-bottom: 14px; }
.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.required { color: var(--primary); font-weight: 700; }
.field-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-subtle);
}

.field-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  resize: none;
}

.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.field-input::placeholder { color: var(--text-subtle); }

select.field-input { cursor: pointer; }

.field-textarea { min-height: 72px; }

/* Input wrapper for char count */
.input-wrapper { position: relative; }

.char-count {
  position: absolute;
  bottom: 7px;
  right: 10px;
  font-size: 0.72rem;
  color: var(--text-subtle);
  pointer-events: none;
  font-family: var(--font-mono);
  transition: color var(--transition);
}

.char-count.warn { color: var(--warning); }
.char-count.danger { color: var(--danger); }

/* Add padding-right on inputs/textareas inside .input-wrapper to avoid overlap */
.input-wrapper .field-input { padding-right: 52px; }
.input-wrapper .field-textarea { padding-bottom: 28px; }

/* Slug preview */
.slug-preview {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  word-break: break-all;
}
.slug-preview span { color: var(--primary); }

/* Image error */
.image-error {
  font-size: 0.76rem;
  color: var(--danger);
  margin-top: 4px;
  min-height: 16px;
}

.image-url-input.invalid { border-color: var(--danger) !important; }

/* Author photo row */
.author-photo-row { display: flex; align-items: center; gap: 10px; }
.author-photo-row .field-input { flex: 1; }

.author-photo-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.author-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- EDITOR CONTAINER ------------------------------------- */
.editor-container {
  margin: 16px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 8px;
  gap: 12px;
}

.editor-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.editor-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toggle switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  user-select: none;
}
.toggle-label input { display: none; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  background: var(--border);
  border-radius: 9px;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-label input:checked + .toggle-switch { background: var(--primary); }
.toggle-label input:checked + .toggle-switch::after { transform: translateX(16px); }

/* ---- EDITOR TOOLBAR --------------------------------------- */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.toolbar-btn {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  line-height: 1.4;
}
.toolbar-btn:hover { background: var(--surface-raised); color: var(--text); }
.toolbar-btn:active { background: var(--primary-dim); color: var(--primary); }

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

/* ---- EDITOR TEXTAREA -------------------------------------- */
.editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 340px;
  padding: 20px 28px;
  background: var(--bg);
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.75;
  resize: vertical;
  transition: background var(--transition), color var(--transition);
}
.editor-textarea::placeholder { color: var(--text-subtle); }

/* ---- EDITOR FOOTER ---------------------------------------- */
.editor-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.editor-stat {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

.editor-stat-right { margin-left: auto; }

/* ---- PREVIEW PANEL ---------------------------------------- */
.preview-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 0 16px;
  flex-shrink: 0;
}

.preview-tab {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.preview-tab:hover { color: var(--text); }
.preview-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.preview-content {
  flex: 1;
  overflow-y: auto;
}

.preview-pane { display: none; padding: 20px; }
.preview-pane.active { display: block; }

/* ---- WEBPAGE PREVIEW -------------------------------------- */
.webpage-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-ui);
}

.wp-banner-wrap {
  width: 100%;
  height: 180px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.wp-banner { width: 100%; height: 100%; object-fit: cover; display: block; }
.wp-banner-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-subtle);
  font-size: 0.8rem;
}

.wp-content { padding: 20px; }

.wp-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.wp-category {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-dim);
  padding: 2px 8px;
  border-radius: 20px;
}

.wp-read-time { font-size: 0.75rem; color: var(--text-subtle); }

.wp-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.wp-description { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }

.wp-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.wp-author-photo-wrap {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  font-size: 0.8rem;
  border: 1px solid var(--border);
}
.wp-author-photo { width: 100%; height: 100%; object-fit: cover; }
.wp-author-initials { font-weight: 600; font-size: 0.82rem; color: var(--primary); }

.wp-author-name { font-size: 0.84rem; font-weight: 600; color: var(--text); }
.wp-author-bio { font-size: 0.76rem; color: var(--text-subtle); }

.wp-divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.wp-body { font-size: 0.9rem; }

/* ---- SERP PREVIEW ----------------------------------------- */
.serp-preview { max-width: 600px; }

.serp-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.serp-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.serp-favicon {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.serp-favicon-circle {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.serp-site-name { font-size: 0.78rem; color: var(--text); }
.serp-url { font-size: 0.78rem; color: var(--text-subtle); margin-bottom: 4px; font-family: var(--font-mono); }
.serp-title { font-size: 1.1rem; color: #1a73e8; margin-bottom: 4px; cursor: pointer; }
.dark .serp-title { color: #7ab4f5; }
.serp-title:hover { text-decoration: underline; }
.serp-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

/* ---- SOCIAL PREVIEW --------------------------------------- */
.social-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 10px;
}

.social-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-raised);
}

.social-card-img-wrap {
  width: 100%;
  height: 140px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.social-card-img { width: 100%; height: 100%; object-fit: cover; }
.social-card-img-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.social-card-body { padding: 12px 14px; }

.social-card-domain { font-size: 0.72rem; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.social-card-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.social-card-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }

/* Facebook card style */
.social-card-body-fb { border-top: 1px solid var(--border); background: var(--surface); }
.social-card-domain-fb { font-size: 0.7rem; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.social-card-title-fb { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.social-card-desc-fb { font-size: 0.76rem; color: var(--text-muted); }

/* ---- TOAST NOTIFICATION ----------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: var(--shadow-md);
  max-width: 90vw;
  white-space: normal;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast.toast-success {
  background: var(--success);
  color: #fff;
}

/* ---- MODALS ----------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}

.modal-wide { max-width: 740px; }
.modal-sm { max-width: 380px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.paypal-modal-body{
  display: block;
  text-align: center;
  padding: 20px 24px 0px;
}

.paypal-modal-price-header {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.paypal-modal-price {
  font-size: 3rem;
  color: var(--text);
  margin-bottom: -15.5px;
}

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

.modal-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--text); }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface); color: var(--text); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

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

/* Markdown help grid */
.md-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.md-help-col {
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border);
}
.md-help-syntax, .md-help-result {
  padding: 8px 10px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.md-help-syntax {
  font-family: var(--font-mono);
  color: var(--primary);
  background: var(--surface);
}

.spinner {
  margin: auto;
}

/* Publish JSON output */
.publish-json {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  max-height: 420px;
  overflow-y: auto;
}

/* ---- VALIDATION HIGHLIGHTS -------------------------------- */
.field-input.error { border-color: var(--danger) !important; }
.field-input.error:focus { box-shadow: 0 0 0 3px var(--danger-dim); }

/* ---- RESPONSIVE ------------------------------------------- */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .panel { width: 100% !important; height: auto; overflow: visible; }
  .panel-left { border-right: none; border-bottom: 1px solid var(--border); }
  .panel-right { width: 100% !important; }

  body.focus-mode .panel-right { display: none; }
  body.focus-mode .panel-left { width: 100% !important; }

  .topbar { padding: 0 14px; }
  .topbar-right { gap: 4px; }
  .btn-ghost:not(.icon-btn) { display: none; }

  .form-container { padding: 14px 16px 0; }
  .editor-toolbar { padding: 6px 16px; }
  .editor-textarea { padding: 16px; min-height: 260px; }
  .editor-footer { padding: 8px 16px; }
  .editor-header { padding: 10px 16px 6px; }
}

@media (max-width: 480px) {
  .logo-text { display: none; }
  .editor-stat:not(.editor-stat-right):nth-child(n+3) { display: none; }
}

/* ---- SCROLLBARS ------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ---- SELECTION -------------------------------------------- */
::selection { background: var(--primary-dim); color: var(--primary); }

/* ---- AUTO-SAVE INDICATOR ---------------------------------- */
.autosave-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.3s;
}
.autosave-dot.active { opacity: 1; animation: pulse-dot 1s ease 2; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}
