/* ================================================
   Adapted Solutions Digital Visibility Platform
   Design System
   ================================================ */

:root {
  --sidebar-bg: #0d1117;
  --sidebar-hover: #161b22;
  --sidebar-active: #1c2333;
  --gold: #c4a35a;
  --gold-hover: #d4b36a;
  --gold-dim: rgba(196, 163, 90, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --content-bg: #f8f9fa;
  --card-bg: #ffffff;
  --card-border: #e1e4e8;
  --danger: #f85149;
  --success: #3fb950;
  --warning: #d29922;
  --info: #58a6ff;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --font-mono: 'DM Mono', 'SF Mono', 'Fira Code', monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: var(--font-sans);
  background: var(--content-bg);
  color: #24292f;
  min-height: 100vh;
}

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-transform: uppercase;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--gold);
  border-left-color: var(--gold);
}

.nav-badge {
  margin-left: auto;
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}

.nav-back:hover { color: var(--gold); }

/* ── Main Content ── */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 24px 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #24292f;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

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

/* ── Client Card ── */
.client-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}

.client-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gold);
}

.client-card-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.client-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.client-card-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-badge {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
}

.score-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.score-delta {
  font-size: 12px;
  font-weight: 600;
}

.score-delta.positive { color: var(--success); }
.score-delta.negative { color: var(--danger); }

.client-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: #000;
}

.btn-primary:hover { background: var(--gold-hover); }

.btn-secondary {
  background: transparent;
  color: #24292f;
  border: 1px solid var(--card-border);
}

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

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

.btn-danger:hover { opacity: 0.9; }

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

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

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
}

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

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 2px solid var(--card-border);
}

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

tr:hover td { background: rgba(0,0,0,0.02); }

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

textarea.form-control { min-height: 80px; resize: vertical; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e7681' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Badges / Tags ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-rva { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-alp { background: rgba(136,87,224,0.15); color: #8857e0; }
.badge-active { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-inactive { background: rgba(139,148,158,0.15); color: var(--text-secondary); }
.badge-draft { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-published { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-running { background: rgba(88,166,255,0.15); color: var(--info); }
.badge-complete { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-failed { background: rgba(248,81,73,0.15); color: var(--danger); }
.badge-new { background: var(--gold-dim); color: var(--gold); }

/* ── Toggle ── */
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 10px;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--success);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

/* ── Stars ── */
.stars {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 2px;
}

/* ── Brand Switcher ── */
.brand-switcher {
  padding: 8px 16px;
  margin: 4px 12px;
}

.brand-switcher select {
  width: 100%;
  padding: 6px 10px;
  background: var(--sidebar-hover);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}

/* ── Filter Tabs ── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

/* ── Keyword Chips ── */
.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.keyword-chip {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(196,163,90,0.1);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  transition: all 0.15s;
}

.keyword-chip:hover,
.keyword-chip.selected {
  background: var(--gold);
  color: #000;
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ── Checklist ── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--card-border);
}

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

.checklist-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.checklist-content { flex: 1; }

.checklist-title {
  font-size: 14px;
  font-weight: 600;
}

.checklist-title.completed {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.checklist-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.checklist-why {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #866d2d;
}

.priority-high { border-left: 3px solid var(--danger); padding-left: 12px; }
.priority-medium { border-left: 3px solid var(--warning); padding-left: 12px; }
.priority-low { border-left: 3px solid var(--info); padding-left: 12px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #24292f;
}

/* ── Login Page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--sidebar-bg);
}

.login-box {
  width: 380px;
  padding: 40px;
  text-align: center;
}

.login-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-title {
  font-size: 20px;
  color: white;
  margin-bottom: 32px;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--sidebar-hover);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-input:focus {
  outline: none;
  border-color: var(--gold);
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover { background: var(--gold-hover); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: white;
  z-index: 300;
  animation: slideIn 0.3s;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: static; height: auto; }
  .main-content { margin-left: 0; padding: 16px; }
  .card-grid { grid-template-columns: 1fr; }
}
