/* Dashboard — Clone Tracker */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --bg: #0d0d12;
  --bg-surface: #141419;
  --bg-elevated: #1a1a22;
  --bg-hover: #20202a;
  --fg: #eeedf4;
  --fg-muted: #7e7c8f;
  --fg-dim: #4a4858;
  --accent: #c084fc;
  --accent-dim: #7c3aed;
  --accent-glow: rgba(192,132,252,0.12);
  --green: #10b981;
  --amber: #f59e0b;
  --indigo: #818cf8;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.1);
  --radius: 10px;
  --sidebar-w: 220px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.brand-mark {
  font-size: 1.1rem;
  color: var(--accent);
}

.brand-name {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-elevated); color: var(--fg); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.small { font-size: 0.8rem; }

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1100px;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 0.15rem;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  color: #0d0d12;
  border: none;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  padding: 0.55rem 1.1rem;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover { background: var(--bg-elevated); color: var(--fg); }

.btn-danger {
  padding: 0.55rem 1.1rem;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.stat-chip:hover { border-color: var(--border-hover); background: var(--bg-elevated); }
.stat-chip.active { border-color: var(--accent); background: var(--accent-glow); }

.stat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--fg);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ── TABLE ── */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.project-table thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.project-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}

.project-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.88rem;
}

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

.project-table tbody tr {
  transition: background 0.12s;
}

.project-table tbody tr:hover { background: var(--bg-hover); }

/* ── STATUS BADGE ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s;
}

.status-badge:hover { opacity: 0.8; }

.status-badge.filming_scheduled {
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.2);
}

.status-badge.clone_in_training {
  background: rgba(129,140,248,0.12);
  color: #a5b4fc;
  border: 1px solid rgba(129,140,248,0.2);
}

.status-badge.videos_in_production {
  background: rgba(192,132,252,0.12);
  color: #d8b4fe;
  border: 1px solid rgba(192,132,252,0.2);
}

.status-badge.delivered {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}

/* ── ROW ACTIONS ── */
.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}

.project-table tbody tr:hover .row-actions { opacity: 1; }

.action-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.action-btn:hover { background: var(--bg-elevated); color: var(--fg); border-color: var(--border-hover); }
.action-btn.delete:hover { background: rgba(239,68,68,0.1); color: #f87171; border-color: rgba(239,68,68,0.2); }

/* ── LOADING / EMPTY ── */
.loading-row td {
  text-align: center;
  padding: 3rem;
  color: var(--fg-muted);
}

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

.empty-state {
  text-align: center;
  padding: 5rem 2rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--fg-dim);
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--fg-muted);
}

.empty-state p {
  color: var(--fg-dim);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.hidden { display: none !important; }

/* ── CLIENT NAME ── */
.client-name {
  font-weight: 600;
  color: var(--fg);
}

.notes-cell {
  color: var(--fg-muted);
  font-size: 0.82rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell {
  color: var(--fg-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.email-cell {
  color: var(--fg-muted);
  font-size: 0.82rem;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
}

.modal-sm {
  max-width: 360px;
}

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

.modal-header h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.2rem;
  font-weight: 400;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--fg); }

.modal-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.delete-msg {
  padding: 1rem 1.5rem;
  color: var(--fg-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.delete-msg strong { color: var(--fg); }

/* ── FORM ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.req { color: var(--accent); }

.form-group input,
.form-group textarea {
  padding: 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--fg-dim);
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

.form-group select {
  width: 100%;
  padding: 0.6rem 2rem 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.form-group select:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
}

/* ── STATUS CYCLE TOOLTIP ── */
.status-next-hint {
  font-size: 0.65rem;
  color: var(--fg-dim);
  display: block;
  margin-top: 2px;
  text-align: center;
}

/* ── NAV BADGE ── */
.nav-badge {
  background: var(--accent);
  color: #0d0d12;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: auto;
  min-width: 18px;
  text-align: center;
}

/* ── LOGOUT BUTTON (styled as nav-item) ── */
.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  font-family: inherit;
  text-align: left;
  width: 100%;
}

/* ── APPLICATION DETAIL ── */
.app-detail-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
.app-detail-field {
  margin-bottom: 16px;
}
.app-detail-field dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 4px;
}
.app-detail-field dd {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
}
.app-detail-field dd.empty { color: var(--fg-dim); font-style: italic; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.25rem; }
  .topbar { flex-wrap: wrap; gap: 1rem; }
  .project-table th:nth-child(4),
  .project-table td:nth-child(4),
  .project-table th:nth-child(5),
  .project-table td:nth-child(5) { display: none; }
  .row-actions { opacity: 1; }
}
