/* ========================================
   FV Admin — Styles
   Reuses site design tokens
   ======================================== */

:root {
  --bg: #141618;
  --bg-alt: #1A1D20;
  --surface: #1F2225;
  --surface-hover: #262A2D;
  --text: #EDEAE6;
  --text-secondary: #9B9690;
  --accent: #3AAFAF;
  --accent-hover: #4DC4C4;
  --accent-soft: #2A8A8A;
  --accent-bg: rgba(58, 175, 175, 0.08);
  --border: #2A2D30;
  --border-light: #222528;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration: 0.2s;
  --sidebar-w: 240px;
  --header-h: 56px;
  --danger: #E05555;
  --danger-hover: #C94444;
  --success: #4CAF50;
  --warning: #F5A623;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- App Layout ---- */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  padding: 24px 32px;
}

/* ---- Sidebar ---- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.brand-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.sidebar-nav {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 16px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ---- Header ---- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

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

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.page-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all var(--duration) var(--ease);
}

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

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  font-family: inherit;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Stats Grid ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card.accent {
  border-color: var(--accent-soft);
  background: var(--accent-bg);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.accent .stat-value { color: var(--accent); }

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-link {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* ---- Panels ---- */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.panel.full-width {
  grid-column: 1 / -1;
}

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

.panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.panel-body {
  padding: 16px 20px;
}

/* ---- Tables ---- */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--surface-hover); }

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-running, .badge-publishing { background: rgba(58, 175, 175, 0.15); color: var(--accent); }
.badge-completed, .badge-published { background: rgba(76, 175, 80, 0.15); color: var(--success); }
.badge-failed { background: rgba(224, 85, 85, 0.15); color: var(--danger); }
.badge-queued, .badge-scheduled { background: rgba(245, 166, 35, 0.15); color: var(--warning); }
.badge-draft, .badge-pending, .badge-suggested { background: rgba(155, 150, 144, 0.15); color: var(--text-secondary); }
.badge-approved, .badge-review { background: rgba(58, 175, 175, 0.15); color: var(--accent); }
.badge-rejected { background: rgba(224, 85, 85, 0.15); color: var(--danger); }

/* ---- Queue List ---- */

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.queue-date {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 90px;
}

.queue-title { font-size: 13px; }

/* ---- Empty State ---- */

.empty-state {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color var(--duration) var(--ease);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* ---- Alerts ---- */

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(224, 85, 85, 0.1);
  border: 1px solid rgba(224, 85, 85, 0.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: var(--success);
}

/* ---- Login Page ---- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand .brand-mark {
  width: 48px;
  height: 48px;
  font-size: 18px;
  margin: 0 auto 12px;
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.login-brand p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Content List ---- */

.content-list {
  display: flex;
  flex-direction: column;
}

.content-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration) var(--ease);
}

.content-item:hover { background: var(--surface-hover); }

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

.content-item-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.content-item-actions {
  display: flex;
  gap: 6px;
  margin-left: 12px;
}

/* ---- Editor ---- */

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 500px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
}

.editor-panel h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.editor-textarea {
  flex: 1;
  min-height: 400px;
}

.editor-preview {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}

.editor-preview h1, .editor-preview h2, .editor-preview h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.editor-preview h1:first-child { margin-top: 0; }

.editor-preview p {
  color: var(--text-secondary);
  margin-bottom: 1em;
}

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

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

/* ---- Toolbar ---- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

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

/* ---- Feed Items ---- */

.feed-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.feed-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.feed-item-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.feed-item-score {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.feed-item-source {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.feed-item-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ---- Settings ---- */

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.settings-section h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-row:last-child { border-bottom: none; }

.settings-label {
  font-size: 13px;
  font-weight: 500;
}

.settings-value {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--duration) var(--ease);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-main { margin-left: 0; }

  .sidebar-toggle { display: block; }

  .app-content { padding: 16px; }

  .editor-layout { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .app-header { padding: 0 16px; }
}
