/* ═══════════════════════════════════════════════════════════════════════════════
   xhalo-blog Admin – Design System v2
   Sidebar-based Information Architecture with dark theme
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Tokens ─────────────────────────────────────────────────────────── */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;

  /* Palette – dark mode */
  --bg-body:         #0e1117;
  --bg-sidebar:      #161b22;
  --bg-topbar:       #161b22;
  --bg-card:         rgba(22, 27, 34, 0.85);
  --bg-card-hover:   rgba(30, 37, 48, 0.95);
  --bg-inset:        rgba(13, 17, 23, 0.7);
  --bg-input:        rgba(22, 27, 34, 0.6);

  --border-color:    rgba(48, 54, 61, 0.7);
  --border-light:    rgba(48, 54, 61, 0.4);

  --text-primary:    #e6edf3;
  --text-secondary:  #8b949e;
  --text-muted:      #6e7681;

  --accent:          #58a6ff;
  --accent-hover:    #79bfff;
  --accent-subtle:   rgba(56, 139, 253, 0.15);

  --green:           #3fb950;
  --green-subtle:    rgba(46, 160, 67, 0.15);
  --yellow:          #d29922;
  --yellow-subtle:   rgba(187, 128, 9, 0.15);
  --red:             #f85149;
  --red-subtle:      rgba(248, 81, 73, 0.15);
  --purple:          #bc8cff;

  --radius-sm:       4px;
  --radius-md:       8px;
  --radius-lg:       12px;
  --radius-xl:       16px;

  --shadow-sm:       0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:       0 8px 24px rgba(0,0,0,0.5);

  --sidebar-width:   260px;
  --topbar-height:   56px;

  --transition:      0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font-sans);
  background: radial-gradient(ellipse at top right, #131924, #0e1117 75%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  overflow-y: hidden;
  height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  font-size: 1.4rem;
  color: var(--accent);
}

.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.sidebar-nav-btn:hover {
  background: rgba(56, 139, 253, 0.08);
  color: var(--text-primary);
  border-left-color: rgba(56, 139, 253, 0.3);
}

.sidebar-nav-btn.active {
  background: linear-gradient(90deg, rgba(56, 139, 253, 0.15) 0%, rgba(56, 139, 253, 0.02) 100%);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
}

.sidebar-version {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Main wrapper ───────────────────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  transition: margin-left var(--transition);
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.env-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--yellow);
  background: var(--yellow-subtle);
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.user-name.guest {
  color: var(--text-muted);
  font-style: italic;
}

.topbar-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.topbar-btn:hover {
  background: var(--red-subtle);
  color: var(--red);
  border-color: var(--red);
}

/* ── Content area ───────────────────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: auto;
}

.content-area > * {
  scroll-margin-top: 0;
}

/* ── Loading splash ─────────────────────────────────────────────────────────── */
.loading-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: var(--text-muted);
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: rgba(22, 27, 34, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: rgba(56, 139, 253, 0.45);
  box-shadow: 0 8px 32px rgba(56, 139, 253, 0.12);
  transform: translateY(-2px);
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

/* ── Status badges ──────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge[data-state="ok"]      { background: var(--green-subtle); color: var(--green); }
.status-badge[data-state="warning"] { background: var(--yellow-subtle); color: var(--yellow); }
.status-badge[data-state="error"]   { background: var(--red-subtle); color: var(--red); }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.alert strong {
  display: inline;
}

.alert-info    { background: rgba(56, 139, 253, 0.1); border-left: 4px solid var(--accent); color: var(--text-primary); box-shadow: 0 4px 12px rgba(56, 139, 253, 0.04); }
.alert-success { background: rgba(46, 160, 67, 0.1); border-left: 4px solid var(--green); color: var(--text-primary); box-shadow: 0 4px 12px rgba(46, 160, 67, 0.04); }
.alert-warning { background: rgba(187, 128, 9, 0.1); border-left: 4px solid var(--yellow); color: var(--text-primary); box-shadow: 0 4px 12px rgba(187, 128, 9, 0.04); }
.alert-error   { background: rgba(248, 81, 73, 0.1); border-left: 4px solid var(--red); color: var(--text-primary); box-shadow: 0 4px 12px rgba(248, 81, 73, 0.04); }

/* ── Meta grid (key-value pairs) ────────────────────────────────────────────── */
.meta-grid {
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.meta-row:last-child { border-bottom: none; }
.meta-row span:first-child { color: var(--text-secondary); }
.meta-row strong, .meta-row code { color: var(--text-primary); }

/* ── Dashboard grid ─────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.dashboard-grid .field-span-2 {
  grid-column: 1 / -1;
}

.stats-workspace h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.stats-workspace .lede {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px !important;
}

.stat-label,
.stat-note {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.stat-value {
  color: var(--text-primary);
  font-size: 1.85rem;
  line-height: 1;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.readiness-item {
  padding: 14px;
}

.readiness-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.item-title { font-size: 0.9rem; }
.item-desc  { font-size: 0.8rem; color: var(--text-secondary); }

.boundary-card .meta-grid { margin-top: 10px; }

.limitations-card .bullet-list {
  list-style: none;
  padding: 0;
}

.limitations-card .bullet-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.limitations-card .bullet-list li:last-child { border-bottom: none; }
.limitations-card .bullet-list li strong { color: var(--text-primary); }

.text-success { color: var(--green) !important; }
.text-danger  { color: var(--red) !important; }

/* ── Posts panel ────────────────────────────────────────────────────────────── */
.posts-panel { }

.posts-search-bar input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.posts-search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.posts-list-grid {
  display: grid;
  gap: 12px;
}

.post-card {
  cursor: default;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.post-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.post-title { font-size: 0.95rem; }

.post-meta-details {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.post-meta-details code {
  font-size: 0.78rem;
  background: var(--bg-inset);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

.post-actions {
  display: flex;
  gap: 8px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
button, .button-small {
  font-family: var(--font-sans);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.button-small {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
}

.button-small:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.button-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.button-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 20px;
  border-radius: var(--radius-md);
}

.button-secondary:hover {
  background: rgba(139, 148, 158, 0.08);
  color: var(--text-primary);
}

.button-danger {
  background: var(--red-subtle);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.button-danger:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.button-danger:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
}

/* ── Editor workspace ───────────────────────────────────────────────────────── */
.editor-workspace h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.editor-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tab-header-nav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  padding: 8px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.editor-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-fields-grid .field-span-2 {
  grid-column: 1 / -1;
}

.editor-fields-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.editor-fields-grid label span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.editor-fields-grid input,
.editor-fields-grid textarea {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.editor-fields-grid input:focus,
.editor-fields-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.editor-fields-grid textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.markdown-editor-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.markdown-editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.markdown-editor-layout.split {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
}

.markdown-input-pane {
  min-width: 0;
}

.markdown-live-preview {
  min-height: 360px;
  max-height: 620px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.markdown-live-preview > span,
.markdown-editor-status {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.vditor-host {
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.vditor-host .vditor {
  border: 0;
}

.markdown-rendered-body pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.markdown-rendered-body code {
  font-family: var(--font-mono);
}

.markdown-rendered-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.markdown-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-table th,
.markdown-table td {
  border: 1px solid var(--border-color);
  padding: 8px 10px;
}

.server-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.server-pagination-actions {
  display: inline-flex;
  gap: 8px;
}

.config-file-list,
.plugin-grid,
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.config-file,
.plugin-card,
.integration-card {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.config-preview {
  max-height: 260px;
  overflow: auto;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.editor-tab-content {
  min-height: 300px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14, 17, 23, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  z-index: 10;
  color: var(--text-secondary);
}

.editor-bottom-actions {
  margin-top: 24px;
}

.control-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 12px;
}

.control-group h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.control-help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Markdown preview ───────────────────────────────────────────────────────── */
.markdown-preview-container { padding: 24px; }
.markdown-preview-container h2 { font-size: 1.3rem; margin-bottom: 8px; }
.markdown-preview-container .post-meta { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 12px; display: flex; gap: 16px; }
.markdown-preview-container hr { border: none; border-top: 1px solid var(--border-color); margin: 16px 0; }
.markdown-rendered-body { line-height: 1.7; }

/* ── Diff view ──────────────────────────────────────────────────────────────── */
.diff-container p { margin-bottom: 12px; font-size: 0.85rem; color: var(--text-secondary); }
.diff-meta { display: flex; gap: 20px; margin-bottom: 12px; font-size: 0.85rem; }
.diff-code-view pre {
  background: var(--bg-inset);
  padding: 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-x: auto;
  max-height: 400px;
  line-height: 1.6;
}

/* ── Plan view ──────────────────────────────────────────────────────────────── */
.plan-container p { margin-bottom: 14px; font-size: 0.85rem; color: var(--text-secondary); }
.plan-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.plan-step:last-child { border-bottom: none; }
.step-num {
  flex-shrink: 0;
  background: var(--accent-subtle);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}
.step-details strong { display: block; }
.step-details span { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Media workspace ────────────────────────────────────────────────────────── */
.media-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }

.media-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.media-form-grid .field-span-2 { grid-column: 1 / -1; }

.media-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.media-form-grid label span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.media-form-grid input,
.media-form-grid textarea {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
}

.media-form-grid input:focus,
.media-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.media-output { margin-top: 20px; }

/* ── Menus workspace ────────────────────────────────────────────────────────── */
.menus-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }

.menu-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.menu-form-grid .field-span-2 { grid-column: 1 / -1; }

.menu-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu-form-grid label span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.menu-form-grid input,
.menu-form-grid textarea {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
}

.menu-form-grid input:focus,
.menu-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.menu-tree-output { margin-top: 20px; }

/* ── Publishing workspace ───────────────────────────────────────────────────── */
.publishing-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.publishing-workspace .lede { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }

.publishing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.publishing-grid .field-span-2 { grid-column: 1 / -1; }

.table-container { overflow-x: auto; }

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.table-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.table-toolbar span,
.table-count {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.table-toolbar input,
.table-toolbar select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
}

.adaptive-table-container {
  width: 100%;
  overflow-x: auto;
}

.data-table,
.adaptive-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: left;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.safety-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.safety-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.safety-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
}

.safety-table code {
  font-size: 0.78rem;
  background: var(--bg-inset);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Audit workspace ────────────────────────────────────────────────────────── */
.audit-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  align-items: center;
}

.audit-timestamp {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.audit-action { font-weight: 500; }

.audit-detail {
  color: var(--text-secondary);
  text-align: right;
}

/* ── Settings workspace ─────────────────────────────────────────────────────── */
.settings-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.settings-workspace .lede { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }

.settings-grid {
  display: grid;
  gap: 20px;
}

/* ── Toast notifications ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-info    { background: #1f3049; color: var(--accent); border: 1px solid var(--accent); }
.toast-success { background: #1a3325; color: var(--green); border: 1px solid var(--green); }
.toast-warning { background: #332b1a; color: var(--yellow); border: 1px solid var(--yellow); }
.toast-error   { background: #3d1a1a; color: var(--red); border: 1px solid var(--red); }

/* ── Info text ──────────────────────────────────────────────────────────────── */
.info-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Code elements ──────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-inset);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ── Responsive: collapsed sidebar on mobile ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar-menu-btn {
    display: block;
  }

  .content-area {
    padding: 20px 16px;
  }

  .editor-fields-grid {
    grid-template-columns: 1fr;
  }

  .table-toolbar,
  .markdown-editor-layout.split {
    grid-template-columns: 1fr;
  }

  .table-pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .media-form-grid,
  .menu-form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .publishing-grid {
    grid-template-columns: 1fr;
  }
}

/* sidebar-collapsed body class (toggled by hamburger) */
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
  margin-left: 0;
}

/* ── Smooth transitions ─────────────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Scrollbar styling ──────────────────────────────────────────────────────── */
::-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(--text-muted);
}

/* ── PR Link ────────────────────────────────────────────────────────────────── */
.pr-link {
  color: var(--accent);
  word-break: break-all;
}

/* ── Media layout grid ──────────────────────────────────────────────────────── */
.media-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.media-form-card label,
.media-preview-card label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.media-form-card label span,
.media-preview-card label span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.media-form-card input,
.media-form-card select {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
}

.media-form-card input:focus,
.media-form-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.snippet-pre {
  background: var(--bg-inset);
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-x: auto;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 768px) {
  .media-layout-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Menu layout grid ───────────────────────────────────────────────────────── */
.menu-workspace h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }

.menu-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.menu-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px !important;
  margin-bottom: 8px;
}

.menu-item-row .item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item-row .item-info span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.menu-list { margin-bottom: 10px; }

.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.inline-form label span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.inline-form input {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
}

.inline-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

@media (max-width: 768px) {
  .menu-layout-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Audit table ────────────────────────────────────────────────────────────── */
.audit-workspace .lede { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.audit-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.audit-table code {
  font-size: 0.78rem;
}

.text-center { text-align: center; }

/* ── Unauthenticated State Styling ─────────────────────────────────────────── */
body.unauthenticated {
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at top right, #131924, #080a0f 80%);
}

body.unauthenticated .sidebar {
  display: none !important;
}

body.unauthenticated .main-wrapper {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 500px !important;
  padding: 20px;
}

body.unauthenticated .topbar {
  display: none !important;
}

body.unauthenticated .content-area {
  padding: 0 !important;
}

/* Login Card styling */
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(88, 166, 255, 0.05);
  backdrop-filter: blur(10px);
}

.login-card-brand {
  margin-bottom: 24px;
}

.login-card-brand .brand-icon {
  font-size: 3rem;
  display: inline-block;
  margin-bottom: 8px;
  animation: pulse 2s infinite ease-in-out;
}

.login-card-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-card-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 30px;
}

.login-btn-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #24292f;
  color: white;
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

.login-btn-github:hover {
  background: #30363d;
  border-color: #8b949e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 8px rgba(88, 166, 255, 0.2);
}

.login-card-info {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-light);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: left;
}

.login-card-info p {
  margin-bottom: 8px;
}

.login-card-info p strong {
  color: var(--text-secondary);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 10px rgba(88, 166, 255, 0.4)); }
  100% { transform: scale(1); opacity: 0.8; }
}
