/* ============================================
   SiteForge - Website HTML Editor
   ============================================ */

:root {
  /* OxWeb Palette — charcoal, sage green, warm orange */
  --bg-primary: #1a1a1a;
  --bg-secondary: #222222;
  --bg-tertiary: #2c2c2c;
  --bg-hover: #333333;
  --bg-active: #3a3a3a;
  --border-color: #3d3d3d;
  --border-light: #4a4a4a;
  --text-primary: #e8e4de;
  --text-secondary: #a8a198;
  --text-muted: #6b6560;
  --accent: #7a8c6e;
  --accent-hover: #8fa17f;
  --accent-soft: rgba(122, 140, 110, 0.18);
  --accent-bright: #96a889;
  --cta: #d4802a;
  --cta-hover: #e8922f;
  --cta-soft: rgba(212, 128, 42, 0.15);
  --success: #7a8c6e;
  --warning: #d4802a;
  --danger: #c45c4a;
  --danger-soft: rgba(196, 92, 74, 0.15);
  --panel-width: 320px;
  --topbar-height: 52px;
  --radius: 6px;
  --radius-sm: 4px;
  --transition: 150ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

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

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 12px;
  z-index: 100;
  position: relative;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 600px;
}

.url-bar input {
  flex: 1;
  height: 34px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.url-bar input:focus {
  border-color: var(--accent);
}

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

.viewport-controls {
  display: flex;
  gap: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 2px;
}

.viewport-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all var(--transition);
}

.viewport-btn:hover { color: var(--text-secondary); }
.viewport-btn.active {
  background: var(--bg-active);
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

.btn-accent {
  background: linear-gradient(135deg, var(--cta), #c06a1a);
  border-color: transparent;
  color: #fff;
}
.btn-accent:hover { background: linear-gradient(135deg, var(--cta-hover), var(--cta)); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 6px; border: none; background: none; color: var(--text-secondary); }
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); border-radius: var(--radius); }

.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }

/* ============================================
   MAIN LAYOUT
   ============================================ */
.main-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - var(--pages-bar-height, 0px));
}

/* ============================================
   EDITOR PANEL
   ============================================ */
.editor-panel {
  width: var(--panel-width);
  min-width: 260px;
  max-width: 500px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.panel-resize-handle {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 50;
}

.panel-resize-handle:hover,
.panel-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.5;
}

/* ---- Panel Tabs ---- */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.panel-tab:hover { color: var(--text-secondary); }
.panel-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Panel Content ---- */
.panel-content {
  display: none;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 20px;
}

.panel-content.active { display: flex; }

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

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.section-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.section-header.collapsible:hover { color: var(--text-primary); }
.section-header.collapsible.collapsed svg { transform: rotate(-90deg); }

.section-body { display: flex; flex-direction: column; gap: 8px; }
.section-body.collapsed { display: none; }

/* ---- Controls ---- */
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group.half { flex: 1; min-width: 0; }

.control-row { display: flex; gap: 8px; }

.control-group label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.control-input, .control-select {
  height: 30px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.control-input:focus, .control-select:focus {
  border-color: var(--accent);
}

.control-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235f6580' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.input-with-unit {
  display: flex;
  gap: 0;
}

.input-with-unit .control-input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  flex: 1;
  min-width: 0;
}

.unit-select {
  height: 30px;
  background: var(--bg-active);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  text-align: center;
}

/* ---- Color Input ---- */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-input {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: 2px; }

.color-hex { flex: 1; }

/* ---- Button Groups ---- */
.btn-group {
  display: flex;
  gap: 0;
}

.btn-group-item {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-group-item:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group-item:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group-item + .btn-group-item { border-left: none; }
.btn-group-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-group-item.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-group-item.active + .btn-group-item { border-left-color: var(--accent); }

/* ---- Spacing Box ---- */
.spacing-box {
  position: relative;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 22px 30px;
  background: var(--bg-tertiary);
}

.spacing-inner {
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 22px 30px;
  position: relative;
  background: rgba(59, 130, 246, 0.05);
}

.spacing-center {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.spacing-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spacing-input {
  position: absolute;
  width: 36px;
  height: 20px;
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--text-secondary);
  font-size: 10px;
  outline: none;
}

.spacing-input:hover { border-color: var(--border-light); }
.spacing-input:focus { border-color: var(--accent); background: var(--bg-primary); color: var(--text-primary); }

.spacing-input.top { top: 2px; left: 50%; transform: translateX(-50%); }
.spacing-input.right { right: 2px; top: 50%; transform: translateY(-50%); }
.spacing-input.bottom { bottom: 2px; left: 50%; transform: translateX(-50%); }
.spacing-input.left { left: 2px; top: 50%; transform: translateY(-50%); }

/* ---- Color Palettes ---- */
.palette-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.palette-row {
  display: flex;
  gap: 3px;
  cursor: pointer;
  padding: 3px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.palette-row:hover { background: var(--bg-hover); }

.palette-swatch {
  flex: 1;
  height: 22px;
  border-radius: 3px;
}

.palette-swatch:first-child { border-radius: 3px 0 0 3px; }
.palette-swatch:last-child { border-radius: 0 3px 3px 0; }

/* ---- Range ---- */
.control-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}

.control-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  min-width: 30px;
  display: inline-block;
}

/* ---- Element Info ---- */
.element-info-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.element-tag {
  font-family: 'Source Code Pro', monospace;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.element-classes {
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ---- Element Tree ---- */
.element-tree {
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
}

.tree-placeholder {
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  text-align: center;
  padding: 20px;
}

.tree-node {
  padding: 3px 4px 3px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tree-node:hover { background: var(--bg-hover); }
.tree-node.selected { background: var(--accent-soft); color: var(--accent); }

.tree-toggle {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 10px;
}

.tree-children { padding-left: 16px; }

/* ---- Quick Actions ---- */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ---- Library ---- */
.library-search {
  margin-bottom: 10px;
}

.library-categories {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.library-category {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.library-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-tertiary);
  transition: background var(--transition);
}

.library-category-header:hover { background: var(--bg-hover); }

.library-items {
  display: none;
  padding: 6px;
  gap: 4px;
  flex-direction: column;
}

.library-items.open { display: flex; }

.library-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background var(--transition);
  border: 1px solid transparent;
}

.library-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.library-item-preview {
  width: 44px;
  height: 32px;
  border-radius: 3px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow: hidden;
}

.library-item-info {
  flex: 1;
  min-width: 0;
}

.library-item-name {
  font-weight: 500;
  color: var(--text-primary);
}

.library-item-desc {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Themes ---- */
.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.theme-card:hover {
  border-color: var(--cta);
  background: var(--bg-tertiary);
}

.theme-card.active {
  border-color: var(--cta);
  background: var(--cta-soft);
}

.theme-preview {
  display: flex;
  gap: 3px;
  margin-bottom: 8px;
  height: 24px;
}

.theme-swatch {
  flex: 1;
  border-radius: 3px;
}

.theme-name {
  font-size: 12px;
  font-weight: 500;
}

.theme-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ---- Code Editor ---- */
.code-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.code-editor {
  width: 100%;
  min-height: 150px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text-primary);
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.code-editor:focus { border-color: var(--accent); }
.code-editor-lg { min-height: 400px; }

/* ============================================
   PREVIEW AREA
   ============================================ */
.preview-area {
  flex: 1;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-empty {
  text-align: center;
  padding: 40px;
  max-width: 480px;
}

.empty-icon {
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.5;
}

.preview-empty h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.preview-empty p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.empty-tips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.tip {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.tip strong { color: var(--cta); }

/* ---- Preview Frame ---- */
.preview-frame-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  transition: padding 0.3s ease;
}

.preview-frame-container.viewport-tablet {
  padding: 20px;
}

.preview-frame-container.viewport-mobile {
  padding: 20px;
}

.preview-frame-container.viewport-tablet #previewFrame {
  max-width: 768px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.preview-frame-container.viewport-mobile #previewFrame {
  max-width: 375px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-lg { width: 800px; }

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

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

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

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

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

/* ---- Export Options ---- */
.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.export-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}

.export-option:hover {
  border-color: var(--cta);
  background: var(--cta-soft);
}

.export-option svg { color: var(--cta); width: 32px; height: 32px; }
.export-title { font-weight: 500; font-size: 15px; }
.export-desc { font-size: 12px; color: var(--text-secondary); }

/* ============================================
   LOADING & TOAST
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 2000;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--cta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

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

/* ============================================
   IFRAME INJECTION STYLES (for element highlighting)
   ============================================ */
/* These are injected into the iframe, see app.js */

/* ============================================
   DRAG PREVIEW
   ============================================ */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  border-radius: var(--radius);
  white-space: nowrap;
  opacity: 0.9;
}

/* ============================================
   PAGES BAR
   ============================================ */
:root {
  --pages-bar-height: 36px;
}

.pages-bar {
  height: var(--pages-bar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  flex-shrink: 0;
}

.pages-tabs-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
}

.pages-tabs-scroll::-webkit-scrollbar { height: 0; }

.pages-tabs {
  display: flex;
  gap: 2px;
  white-space: nowrap;
}

.page-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  max-width: 160px;
}

.page-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.page-tab.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.page-tab .page-tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-tab .page-tab-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
}

.page-tab:hover .page-tab-close,
.page-tab.active .page-tab-close { display: flex; }
.page-tab .page-tab-close:hover { background: var(--danger-soft); color: var(--danger); }

.pages-add {
  flex-shrink: 0;
  gap: 4px;
  font-size: 10px;
  padding: 4px 8px;
  opacity: 0.7;
}

.pages-add:hover { opacity: 1; }

/* ============================================
   CSS CLASS MANAGER
   ============================================ */
.class-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 24px;
}

.class-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
  color: var(--text-primary);
  cursor: default;
}

.class-tag .class-tag-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  padding: 0 1px;
  border-radius: 2px;
}

.class-tag .class-tag-remove:hover {
  color: var(--danger);
}

.class-empty {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0;
}

.class-add-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.class-add-row .control-input {
  flex: 1;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
}

/* ============================================
   BREAKPOINT INDICATOR
   ============================================ */
.breakpoint-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.breakpoint-indicator svg {
  flex-shrink: 0;
}

.breakpoint-indicator.tablet {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.08);
}

.breakpoint-indicator.mobile {
  color: var(--cta);
  background: var(--cta-soft);
}

/* ============================================
   CODE EDITOR SMALL
   ============================================ */
.code-editor-sm {
  min-height: 80px;
  font-size: 11px;
}

/* ============================================
   PAGE RENAME INPUT
   ============================================ */
.page-rename-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  padding: 2px 6px;
  outline: none;
  width: 100px;
}

/* ============================================
   PAGE CONTEXT MENU
   ============================================ */
.page-context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 5000;
  padding: 4px;
  min-width: 140px;
}

.page-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.page-context-menu button:hover {
  background: var(--bg-hover);
}

.page-context-menu button.danger {
  color: var(--danger);
}

.page-context-menu button.danger:hover {
  background: var(--danger-soft);
}

/* ============================================
   ANIMATION PRESETS
   ============================================ */
.animation-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ============================================
   FORM BUILDER
   ============================================ */
.form-builder-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

/* ============================================
   DESIGN TOKENS
   ============================================ */
.tokens-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.token-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
}

.token-item .token-name {
  color: var(--accent);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-item .token-value {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-item .token-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.token-item .token-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 2px;
  border-radius: 2px;
  flex-shrink: 0;
  background: none;
  border: none;
}

.token-item .token-remove:hover { color: var(--danger); }

/* ============================================
   AUDIT RESULTS
   ============================================ */
.audit-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.4;
}

.audit-item.pass { background: rgba(34,197,94,0.08); color: var(--success); }
.audit-item.warn { background: rgba(245,158,11,0.08); color: var(--warning); }
.audit-item.fail { background: var(--danger-soft); color: var(--danger); }
.audit-item.info { background: var(--accent-soft); color: var(--accent); }

.audit-icon {
  flex-shrink: 0;
  font-size: 12px;
}

.audit-score {
  text-align: center;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
}

.audit-score.good { background: rgba(34,197,94,0.1); color: var(--success); }
.audit-score.ok { background: rgba(245,158,11,0.1); color: var(--warning); }
.audit-score.bad { background: var(--danger-soft); color: var(--danger); }

/* ============================================
   PAGE TEMPLATES
   ============================================ */
.template-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.template-card:hover {
  border-color: var(--cta);
  background: var(--bg-tertiary);
}

.template-card .template-name {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 2px;
}

.template-card .template-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ============================================
   EXPORT GRID 3 COLUMNS
   ============================================ */
.export-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ============================================
   WP STATUS
   ============================================ */
.wp-status { min-height: 16px; }

/* ============================================
   BREADCRUMB NAV
   ============================================ */
.element-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  margin-bottom: 6px;
  min-height: 18px;
}

.breadcrumb-item {
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 2px;
  transition: all var(--transition);
}

.breadcrumb-item:hover { color: var(--cta); background: var(--cta-soft); }
.breadcrumb-sep { font-size: 8px; color: var(--border-light); }

/* ============================================
   SHORTCUTS MODAL
   ============================================ */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.shortcut-item:last-child { border-bottom: none; }

.shortcut-item kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  color: var(--cta);
  min-width: 80px;
  text-align: center;
}

/* ============================================
   SNAPSHOTS LIST
   ============================================ */
.snapshots-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 350px;
  overflow-y: auto;
}

.snapshot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 12px;
}

.snapshot-item .snapshot-name { font-weight: 500; }
.snapshot-item .snapshot-date { font-size: 10px; color: var(--text-muted); }

.snapshot-item .snapshot-actions-btns {
  display: flex;
  gap: 4px;
}

/* ============================================
   TREE CONTROLS
   ============================================ */
.tree-controls { display: flex; gap: 2px; }

.btn-xs {
  font-size: 11px;
  padding: 2px 6px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-xs:hover { color: var(--text-primary); }

/* ============================================
   CONTEXT MENU
   ============================================ */
.sf-context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 5000;
  padding: 4px;
  min-width: 160px;
}

.sf-context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.sf-context-menu button:hover { background: var(--bg-hover); }
.sf-context-menu button.danger { color: var(--danger); }
.sf-context-menu button.danger:hover { background: var(--danger-soft); }
.sf-context-menu .menu-separator { height: 1px; background: var(--border-color); margin: 4px 0; }
.sf-context-menu .menu-shortcut { margin-left: auto; color: var(--text-muted); font-size: 10px; }

/* ============================================
   GRADIENT PREVIEW
   ============================================ */
.gradient-builder { display: flex; flex-direction: column; }

/* ============================================
   FONT PREVIEW
   ============================================ */
.control-select option[data-font] { font-size: 13px; }

/* ============================================
   MULTI-SELECT INDICATOR
   ============================================ */
.multi-select-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--cta-soft);
  color: var(--cta);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
}
