/* ============================================================
   ContentFlow — Custom Design System
   Base: Bootstrap 5.3 dark theme
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --cf-bg:          #0a0a0f;
  --cf-bg-surface:  #13131a;
  --cf-bg-card:     #1a1a24;
  --cf-border:      rgba(255,255,255,.07);
  --cf-primary:     #6366f1;
  --cf-primary-rgb: 99,102,241;
  --cf-text:        #e2e2e8;
  --cf-muted:       #6b7280;
  --cf-sidebar-w:   240px;
  --cf-topbar-h:    60px;
  --cf-radius:      12px;
  --cf-radius-sm:   8px;
  --cf-shadow:      0 4px 24px rgba(0,0,0,.4);
  --cf-transition:  .18s ease;
}

/* ── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.cf-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cf-bg);
  color: var(--cf-text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography helpers ─────────────────────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.py-6   { padding-top: 5rem; padding-bottom: 5rem; }
.px-6   { padding-left: 3rem; padding-right: 3rem; }
.min-vh-75 { min-height: 75vh; }

.cf-gradient-text {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── App shell ──────────────────────────────────────────── */
.cf-app {
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.cf-sidebar {
  width: var(--cf-sidebar-w);
  min-height: 100vh;
  background: var(--cf-bg-surface);
  border-right: 1px solid var(--cf-border);
  position: sticky;
  top: 0;
  flex-shrink: 0;
  transition: transform var(--cf-transition);
  z-index: 200;
}

.cf-logo-icon {
  width: 32px;
  height: 32px;
  background: rgba(var(--cf-primary-rgb), .15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cf-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cf-muted);
  margin-bottom: 4px;
}

.cf-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--cf-radius-sm);
  color: var(--cf-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--cf-transition), color var(--cf-transition);
  text-decoration: none;
}

.cf-nav-link i { font-size: 15px; flex-shrink: 0; }

.cf-nav-link:hover {
  background: rgba(255,255,255,.05);
  color: var(--cf-text);
}

.cf-nav-link.active {
  background: rgba(var(--cf-primary-rgb), .15);
  color: var(--cf-primary);
}

.cf-avatar,
.cf-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  font-size: 13px;
}

/* ── Main area ──────────────────────────────────────────── */
.cf-main {
  background: var(--cf-bg);
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.cf-topbar {
  height: var(--cf-topbar-h);
  background: var(--cf-bg);
  border-bottom: 1px solid var(--cf-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cf-search-input {
  color: var(--cf-text) !important;
  font-size: 13.5px;
}

.cf-search-input::placeholder { color: var(--cf-muted); }
.cf-search-input:focus { box-shadow: none !important; outline: none; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--cf-border);
  transition: background var(--cf-transition);
}
.btn-icon:hover { background: rgba(255,255,255,.06); }

/* ── Content area ───────────────────────────────────────── */
.cf-content {
  padding: 0;
}

.cf-page-header {
  padding: 28px 32px 0;
  margin-bottom: 24px;
}

.cf-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.cf-page-subtitle {
  font-size: 13px;
  color: var(--cf-muted);
  margin: 4px 0 0;
}

/* ── Cards ──────────────────────────────────────────────── */
.cf-card {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius);
  overflow: hidden;
}

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

.cf-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.cf-card-body { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────────── */
.cf-stat-card {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--cf-transition), transform var(--cf-transition);
}

.cf-stat-card:hover {
  border-color: rgba(var(--cf-primary-rgb), .4);
  transform: translateY(-2px);
}

.cf-stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .06;
  background: var(--cf-primary);
  transform: translate(20px, -20px);
}

.cf-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.cf-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.cf-stat-label {
  font-size: 12px;
  color: var(--cf-muted);
  margin-top: 4px;
}

.cf-stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
}

/* ── Tables ─────────────────────────────────────────────── */
.cf-table {
  width: 100%;
  border-collapse: collapse;
}

.cf-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cf-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--cf-border);
  white-space: nowrap;
}

.cf-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--cf-text);
  font-size: 13.5px;
  vertical-align: middle;
}

.cf-table tbody tr:hover td { background: rgba(255,255,255,.025); }
.cf-table tbody tr:last-child td { border-bottom: none; }

/* ── Status badges ──────────────────────────────────────── */
.cf-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.cf-badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.cf-badge-draft     { background: rgba(107,114,128,.15); color: #9ca3af; }
.cf-badge-approved  { background: rgba(34,197,94,.12);   color: #22c55e; }
.cf-badge-published { background: rgba(99,102,241,.15);  color: #818cf8; }
.cf-badge-scheduled { background: rgba(251,146,60,.12);  color: #fb923c; }
.cf-badge-failed    { background: rgba(239,68,68,.12);   color: #f87171; }
.cf-badge-active    { background: rgba(34,197,94,.12);   color: #22c55e; }
.cf-badge-paused    { background: rgba(251,146,60,.12);  color: #fb923c; }
.cf-badge-error     { background: rgba(239,68,68,.12);   color: #f87171; }
.cf-badge-review    { background: rgba(251,191,36,.12);  color: #fbbf24; }
.cf-badge-processing{ background: rgba(59,130,246,.12); color: #60a5fa; }
.cf-badge-rejected  { background: rgba(239,68,68,.12);   color: #f87171; }
.cf-badge-pending   { background: rgba(148,163,184,.12); color: #94a3b8; }
.cf-badge-publishing{ background: rgba(59,130,246,.12);  color: #60a5fa; }
.cf-badge-cancelled { background: rgba(107,114,128,.15); color: #9ca3af; }
.cf-badge-new       { background: rgba(59,130,246,.12);  color: #60a5fa; }
.cf-badge-processed { background: rgba(34,197,94,.12);   color: #22c55e; }

/* ── Review UI ─────────────────────────────────────────── */
.review-card { transition: transform .15s ease, box-shadow .15s ease; }
.review-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.review-card-img { width: 100%; height: 160px; object-fit: cover; display: block; }
.review-card-img--empty { height: 160px; background: rgba(255,255,255,.03); }
.review-cover-img { max-height: 360px; object-fit: cover; border-radius: 0 0 12px 12px; }
.cf-review-tabs .nav-link { color: var(--cf-text-muted); border: none; }
.cf-review-tabs .nav-link.active { color: #fff; background: rgba(var(--cf-primary-rgb), .15); border-radius: 8px; }
.review-content-view { color: #e5e7eb; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.review-snippet { background: #fff; color: #202124; border-radius: 8px; padding: 14px 16px; }
.review-snippet-title { color: #1a0dab; font-size: 18px; line-height: 1.3; margin-bottom: 4px; }
.review-snippet-desc { color: #4d5156; font-size: 13px; line-height: 1.5; }
.cf-review-sidebar { position: relative; }
.cf-review-actions { position: sticky; top: 88px; }
.review-edit-mode .review-editable { display: block !important; }
.review-edit-mode .review-content-view[data-field] { display: none !important; }

/* ── Sidebar mobile ─────────────────────────────────────── */
@media (max-width: 1199px) {
  .cf-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .cf-sidebar.cf-sidebar--open { transform: translateX(0); }
}

/* ── Public pages ───────────────────────────────────────── */
.cf-public-nav {
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cf-border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.cf-hero {
  background: var(--cf-bg);
  padding-top: 0;
}

.cf-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
}

.cf-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(var(--cf-primary-rgb), .1);
  border: 1px solid rgba(var(--cf-primary-rgb), .25);
  color: #818cf8;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.cf-dashboard-preview {
  perspective: 1200px;
}

.cf-preview-card {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  border-radius: 16px;
  box-shadow: var(--cf-shadow), 0 0 60px rgba(99,102,241,.08);
  transform: rotateY(-6deg) rotateX(3deg);
  transition: transform .4s ease;
}
.cf-preview-card:hover { transform: rotateY(0) rotateX(0); }

.cf-preview-dot { width: 8px; height: 8px; }

.cf-feature-card {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  transition: border-color var(--cf-transition), transform var(--cf-transition);
}
.cf-feature-card:hover {
  border-color: rgba(var(--cf-primary-rgb), .35);
  transform: translateY(-4px);
}

.cf-feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--cf-primary-rgb), .1);
}

.cf-flow-step {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  min-width: 120px;
}

.cf-flow-icon {
  width: 48px; height: 48px;
  background: rgba(255,255,255,.05);
}

.cf-cta-section {
  background: linear-gradient(135deg, rgba(99,102,241,.08) 0%, rgba(139,92,246,.05) 100%);
  border-top: 1px solid var(--cf-border);
  border-bottom: 1px solid var(--cf-border);
}

.cf-footer {
  background: var(--cf-bg-surface);
}

/* ── Auth pages ─────────────────────────────────────────── */
.cf-auth-page {
  min-height: 100vh;
  background: var(--cf-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.cf-auth-card {
  background: var(--cf-bg-surface);
  border: 1px solid var(--cf-border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--cf-shadow);
}

.cf-auth-card--wide { max-width: 480px; }

.cf-auth-brand {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.cf-auth-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: .5rem;
}

.cf-auth-subtitle {
  color: #9ca3af;
  margin-bottom: 1.5rem;
}

.cf-auth-footnote {
  color: #9ca3af;
  margin: 1.25rem 0 0;
  text-align: center;
}

.cf-auth-link {
  color: #a5b4fc;
  text-decoration: none;
}

.cf-auth-link:hover { color: #c7d2fe; }

.cf-auth-check {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: #cbd5e1;
  cursor: pointer;
}

.cf-auth-check input {
  width: 16px;
  height: 16px;
}

.cf-auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  background:
    radial-gradient(circle at top left, rgba(99,102,241,.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(6,182,212,.12), transparent 28%),
    var(--cf-bg);
}

.cf-auth-split__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.cf-auth-split__aside {
  border-left: 1px solid var(--cf-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)),
    linear-gradient(135deg, #0f172a 0%, #111827 55%, #0b1120 100%);
  position: relative;
  overflow: hidden;
}

.cf-auth-split__aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: .25;
}

.cf-auth-hero {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #f8fafc;
}

.cf-auth-hero h2 {
  font-size: 2.5rem;
  line-height: 1.05;
  font-weight: 700;
  max-width: 12ch;
  margin-bottom: 1rem;
}

.cf-auth-hero p {
  color: #cbd5e1;
  max-width: 42ch;
  margin-bottom: 2rem;
}

.cf-auth-hero__badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: .45rem .8rem;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: #c7d2fe;
  background: rgba(99,102,241,.16);
  margin-bottom: 1rem;
}

.cf-auth-hero__panel {
  display: grid;
  gap: 1rem;
  max-width: 520px;
}

.cf-auth-hero__panel div {
  background: rgba(15,23,42,.6);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  backdrop-filter: blur(10px);
}

.cf-auth-hero__panel strong {
  display: block;
  margin-bottom: .25rem;
  font-size: .95rem;
}

.cf-auth-hero__panel span { color: #94a3b8; }

/* ── Forms ──────────────────────────────────────────────── */
.form-control, .form-select {
  background: rgba(255,255,255,.04) !important;
  border: 1px solid var(--cf-border) !important;
  color: var(--cf-text) !important;
  border-radius: var(--cf-radius-sm) !important;
  padding: 9px 13px;
  transition: border-color var(--cf-transition), box-shadow var(--cf-transition);
}

.form-control:focus, .form-select:focus {
  border-color: rgba(var(--cf-primary-rgb), .5) !important;
  box-shadow: 0 0 0 3px rgba(var(--cf-primary-rgb), .1) !important;
  background: rgba(255,255,255,.06) !important;
}

.form-control::placeholder { color: var(--cf-muted) !important; }
.form-label { font-size: 13px; font-weight: 500; color: var(--cf-text); margin-bottom: 6px; }
.form-control.is-invalid { border-color: rgba(239,68,68,.55) !important; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--cf-primary) !important;
  border-color: var(--cf-primary) !important;
  font-weight: 500;
  transition: opacity var(--cf-transition), transform var(--cf-transition);
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

.btn-outline-secondary {
  border-color: var(--cf-border) !important;
  color: var(--cf-text) !important;
  font-weight: 500;
}
.btn-outline-secondary:hover {
  background: rgba(255,255,255,.06) !important;
  border-color: rgba(255,255,255,.15) !important;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination .page-link {
  background: var(--cf-bg-card);
  border-color: var(--cf-border);
  color: var(--cf-muted);
}
.pagination .page-item.active .page-link {
  background: var(--cf-primary);
  border-color: var(--cf-primary);
  color: #fff;
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.2); color: #86efac; }
.alert-danger   { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.2); color: #fca5a5; }
.alert-warning  { background: rgba(251,146,60,.1); border-color: rgba(251,146,60,.2); color: #fdba74; }
.alert-info     { background: rgba(99,102,241,.1); border-color: rgba(99,102,241,.2); color: #a5b4fc; }

.cf-settings-tabs {
  border-bottom: 1px solid var(--cf-border);
}

.cf-settings-tabs .nav-link {
  border: 0;
  color: var(--cf-muted);
  background: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.cf-settings-tabs .nav-link.active,
.cf-settings-tabs .nav-link:hover {
  color: #fff;
  background: transparent;
  border-color: var(--cf-primary);
}

.source-type-card {
  transition: border-color var(--cf-transition), transform var(--cf-transition), background var(--cf-transition);
}

.source-type-card:hover,
.source-type-card--active {
  border-color: rgba(var(--cf-primary-rgb), .45) !important;
  background: rgba(var(--cf-primary-rgb), .08) !important;
  transform: translateY(-2px);
}

/* ── Empty state ─────────────────────────────────────────── */
.cf-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--cf-muted);
}
.cf-empty-icon { font-size: 48px; opacity: .3; margin-bottom: 16px; }
.cf-empty-title { font-size: 16px; font-weight: 600; color: var(--cf-text); margin-bottom: 8px; }
.cf-empty-text { font-size: 13px; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown-menu-dark {
  background: var(--cf-bg-card) !important;
  border: 1px solid var(--cf-border) !important;
  border-radius: var(--cf-radius-sm);
  box-shadow: var(--cf-shadow);
  padding: 6px;
}
.dropdown-item {
  border-radius: 6px;
  font-size: 13.5px;
  padding: 8px 12px;
  color: var(--cf-text);
}
.dropdown-item:hover { background: rgba(255,255,255,.07); color: #fff; }

/* ── Progress / loading ──────────────────────────────────── */
.cf-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: cf-shimmer 1.5s infinite;
  border-radius: 4px;
}

.cf-clickable-row { cursor: pointer; }
.cf-clickable-row:hover { background: rgba(255,255,255,.04); }

@keyframes cf-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Tooltip ─────────────────────────────────────────────── */
.tooltip-inner {
  background: var(--cf-bg-card);
  border: 1px solid var(--cf-border);
  color: var(--cf-text);
  font-size: 12px;
}

@media (max-width: 1199px) {
  .cf-auth-split { grid-template-columns: 1fr; }
  .cf-auth-split__aside { display: none; }
}
