/* ── Overstory Drones Portal — design tokens match overstorydrones.com ───── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
  /* Dark backgrounds — navy-tinted to coordinate with the blue primary */
  --bg:           #08090f;
  --surface:      #0f1118;
  --surface2:     #161820;
  --border:       #1e2030;
  --border2:      #262840;

  /* Primary — matches main site oklch(0.55 0.18 240) */
  --primary:      #3d6fd4;
  --primary-h:    #3362c0;
  --primary-fg:   #ffffff;
  --primary-dim:  rgba(61, 111, 212, 0.12);
  --primary-ring: rgba(61, 111, 212, 0.30);

  /* Brand gradient — matches main site hero "from-sky-400 to-purple-400" */
  --grad-from:    #38BDF8;
  --grad-to:      #C084FC;

  /* Text */
  --text:         #e8eaed;
  --muted:        #8a9099;
  --muted2:       #52575f;

  /* Status — match main site's Tailwind palette */
  --warn:         #F59E0B;
  --warn-dim:     rgba(245, 158, 11, 0.12);
  --success:      #22C55E;
  --success-dim:  rgba(34, 197, 94, 0.12);
  --danger:       #EF4444;
  --danger-dim:   rgba(239, 68, 68, 0.10);

  /* Shape — matches main site --radius: 0.5rem */
  --radius:       0.5rem;
  --radius-lg:    0.75rem;
  --radius-xl:    1rem;
  --radius-2xl:   1.25rem;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Brand typography — exactly matches main site header ────────────────────── */
.brand-word-overstory { color: #fff; font-weight: 900; letter-spacing: -0.02em; }
.brand-word-drones {
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, var(--grad-from), var(--grad-to));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-full { font-size: 1.5rem; line-height: 1; }
.brand-tagline { font-size: 0.7rem; color: var(--muted2); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }

/* ── Navigation — matches main site sticky header ───────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;                           /* h-16 */
  border-bottom: 2px solid rgba(61,111,212,0.08);  /* border-primary/10 */
  background: rgba(8,9,15,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.logo-img     { height: 26px; width: auto; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.content { max-width: 1100px; margin: 0 auto; padding: 2.5rem 2rem; }

/* ── Inputs — matches main site shadcn Input component ─────────────────────── */
input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
select { cursor: pointer; }
select option { background: var(--surface2); }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.375rem;
  line-height: 1;
}
.field { margin-bottom: 1.125rem; }
.field:last-child { margin-bottom: 0; }

/* ── Buttons — matches main site Button component ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:hover   { opacity: 0.9; text-decoration: none; }
.btn:active  { opacity: 0.78; transform: scale(0.99); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(61,111,212,0.2);
}
.btn-primary:hover { background: var(--primary-h); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: var(--danger-dim); }

.btn-sm   { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg   { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Cards — matches main site Card component ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

/* ── Status badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: block;
}
.badge-processing { background: var(--warn-dim);    color: var(--warn);    }
.badge-ready      { background: var(--primary-dim); color: var(--grad-from); }
.badge-delivered  { background: var(--success-dim); color: var(--success); }

/* ── Admin badge ─────────────────────────────────────────────────────────────── */
.admin-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--primary-dim);
  color: var(--grad-from);
  border: 1px solid rgba(56,189,248,0.2);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table  { width: 100%; border-collapse: collapse; font-size: 0.875rem; background: var(--surface); }
th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted2);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface2);
}
td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.025); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  background: none; border: none; color: var(--muted2); cursor: pointer;
  font-size: 1.375rem; line-height: 1; padding: 0; transition: color 0.15s;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.625rem; justify-content: flex-end; align-items: center; }

/* ── Stats row ───────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
}
.stat-card .num {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: 0.3rem;
  letter-spacing: -0.03em;
}
.stat-card .stat-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted2); }
.stat-card.highlight .num { background: linear-gradient(135deg, var(--grad-from), var(--grad-to)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ── Tabs — matches main site tab patterns ───────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; gap: 0; overflow-x: auto; }
.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--grad-from); border-bottom-color: var(--grad-from); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section header ──────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.section-header h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 { font-size: 1.625rem; font-weight: 900; letter-spacing: -0.03em; color: #fff; }
.page-header p  { color: var(--muted); font-size: 0.875rem; margin-top: 2px; }

/* ── Project cards — matches main site card components ───────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 1.375rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.15s;
}
.project-card:hover {
  border-color: var(--border2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 0px var(--primary);
  transform: translateY(-2px);
}
.project-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 8px 32px rgba(61,111,212,0.15);
  transform: translateY(-2px);
}
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; gap: 10px; }
.project-card h3  { font-size: 0.9375rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: #fff; }
.project-meta     { font-size: 0.75rem; color: var(--muted); display: flex; flex-direction: column; gap: 3px; margin-top: 0.625rem; }

/* ── Project detail panel ────────────────────────────────────────────────────── */
.project-detail {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}
.project-detail-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.project-detail-header h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; color: #fff; }

/* ── Sections inside project detail ─────────────────────────────────────────── */
.video-section,
.files-section,
.feedback-section { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.feedback-section { border-bottom: none; }

.video-section h4,
.files-section h4,
.feedback-section h4 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 0.875rem;
}

video {
  width: 100%;
  max-height: 400px;
  background: #000;
  border-radius: var(--radius-lg);
  display: block;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.file-row:last-child { border-bottom: none; }
.file-row-name { flex: 1; min-width: 0; }
.file-row-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; }
.file-row-meta { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  /* Subtle gradient to match main site hero feel */
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(61,111,212,0.18) 0%, transparent 70%);
}
.login-card { width: 100%; max-width: 380px; }

.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand .brand-full { font-size: 1.75rem; }
.login-brand .divider {
  width: 2.5rem; height: 2px;
  background: linear-gradient(to right, var(--grad-from), var(--grad-to));
  margin: 0.75rem auto;
  border-radius: 1px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.login-panel h2 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: #fff;
  margin-bottom: 1.25rem;
}

.login-error {
  background: var(--danger-dim);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 0.8125rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.125rem;
  display: none;
}

/* ── Upload area ─────────────────────────────────────────────────────────────── */
.upload-area {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: block;
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-dim); color: var(--text); }
.upload-area input { display: none; }

.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 2px;
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  display: none;
}
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--grad-from), var(--grad-to)); transition: width 0.2s; width: 0%; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: var(--muted); font-size: 0.875rem; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 320px;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.error   { border-color: rgba(239,68,68,0.35); color: #fca5a5; }
.toast.success { border-color: rgba(34,197,94,0.3);  color: #86efac; }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-muted2  { color: var(--muted2); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; font-size: 0.8125rem; }
.flex         { display: flex; }
.gap-2        { gap: 0.625rem; }
.items-center { align-items: center; }
.mt-2         { margin-top: 0.75rem; }
.mt-3         { margin-top: 1.25rem; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 0 1rem; }
  .content { padding: 1.5rem 1rem; }
  .login-panel { padding: 1.5rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .project-detail-header { flex-direction: column; align-items: flex-start; }
  .modal { border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; position: fixed; bottom: 0; max-width: 100%; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar-left .brand-full { font-size: 1.25rem; }
}
