/* =========================================================
   VideoVault — Industrial Utilitarian Design System
   Palette: Near-black base · Warm amber accent · Slate grays
   Fonts:   Syne (headings) · DM Mono (data/labels)
   ========================================================= */

:root {
  --bg:          #0e0e0e;
  --surface:     #161616;
  --surface-2:   #1e1e1e;
  --surface-3:   #262626;
  --border:      #2e2e2e;
  --border-light:#3a3a3a;

  --text:        #e8e4dc;
  --text-muted:  #888;
  --text-dim:    #555;

  --amber:       #f5a623;
  --amber-soft:  #f5a62322;
  --amber-dim:   #c4841a;

  --green:       #4caf7d;
  --green-soft:  #4caf7d22;
  --red:         #e05252;
  --red-soft:    #e0525222;

  --radius:      6px;
  --sidebar-w:   220px;
  --font-head:   'Syne', sans-serif;
  --font-mono:   'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }


/* =========================================================
   AUTH / LOGIN PAGE
   ========================================================= */

.auth-page {
  display: flex;
  min-height: 100vh;
}

.auth-card {
  width: 420px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.logo-icon {
  font-size: 22px;
  color: var(--amber);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.auth-heading {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 28px;
  color: var(--text);
}

.auth-form { display: flex; flex-direction: column; gap: 20px; }

.auth-deco {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  padding: 40px;
}

.deco-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
}

.deco-text {
  position: relative;
  font-family: var(--font-head);
  font-size: 48px;
  font-weight: 800;
  color: var(--surface-2);
  line-height: 1.15;
  max-width: 400px;
  word-break: break-word;
}


/* =========================================================
   SHARED FORM ELEMENTS
   ========================================================= */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.field-group input,
.field-group select,
.field-group textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}

.field-group input:focus,
.field-group select:focus {
  border-color: var(--amber);
}

.field-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.optional { color: var(--text-dim); }


/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--amber);
  color: #000;
}
.btn-primary:hover { background: var(--amber-dim); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; }


/* =========================================================
   ADMIN SHELL (sidebar + main)
   ========================================================= */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none !important;
  transition: all .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber)44;
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-badge {
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.logout-btn {
  font-size: 12px;
  color: var(--text-dim);
}
.logout-btn:hover { color: var(--red); text-decoration: none !important; }


/* ── Main area ── */

.admin-main {
  flex: 1;
  padding: 32px 36px;
  min-width: 0;
  overflow-x: auto;
}

.admin-topbar {
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
}


/* =========================================================
   FLASH MESSAGES
   ========================================================= */

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
}

.flash-success { background: var(--green-soft);  border-color: var(--green); color: var(--green); }
.flash-danger  { background: var(--red-soft);    border-color: var(--red);   color: var(--red); }
.flash-warning { background: var(--amber-soft);  border-color: var(--amber); color: var(--amber); }
.flash-info    { background: var(--surface-3);   border-color: var(--border);color: var(--text-muted); }


/* =========================================================
   DASHBOARD STATS
   ========================================================= */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-card.accent-green { border-top: 2px solid var(--green); }
.stat-card.accent-amber { border-top: 2px solid var(--amber); }

.stat-value {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 6px;
}


/* =========================================================
   TABLE CARD
   ========================================================= */

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.row-used td { color: var(--text-muted); }

.mono { font-family: var(--font-mono); }
.small { font-size: 11px; }
.center { text-align: center; }


/* ── Token chip ── */

.token-chip {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: default;
  white-space: nowrap;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--amber);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  opacity: 0.7;
  transition: opacity .1s;
}
.copy-btn:hover { opacity: 1; }
.copy-btn.copied { color: var(--green); }


/* ── Badges ── */

.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.badge-pending { background: var(--green-soft);  color: var(--green); border: 1px solid var(--green)44; }
.badge-used    { background: var(--surface-3);   color: var(--text-dim); border: 1px solid var(--border); }


/* ── Action buttons ── */

.actions-cell { display: flex; gap: 6px; }

.action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all .12s;
  line-height: 1;
  font-family: var(--font-mono);
}
.action-btn:hover { border-color: var(--text-muted); color: var(--text); }
.action-delete:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.action-reset:hover  { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }


/* ── Empty state ── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .3; }
.empty-state a { color: var(--amber); }


/* =========================================================
   FORM CARD (create link / admin forms)
   ========================================================= */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.admin-form { display: flex; flex-direction: column; gap: 20px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* Token preview */
.token-preview-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preview-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.preview-value {
  font-size: 14px;
  color: var(--amber);
  word-break: break-all;
}

/* Split layout (admins page) */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.you-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber)44;
}


/* =========================================================
   UPLOAD PAGE (public)
   ========================================================= */

.upload-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
  position: relative;
}

.upload-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.2;
  pointer-events: none;
}

.upload-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  position: relative;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  width: 100%;
  max-width: 560px;
  position: relative;
  box-shadow: 0 24px 80px #00000066;
}

.upload-header { margin-bottom: 28px; }

.upload-header h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 8px;
}

.upload-label {
  font-size: 13px;
  color: var(--amber);
  margin-bottom: 4px;
}

.upload-note {
  font-size: 12px;
  color: var(--text-dim);
}


/* ── Drop zone ── */

.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 20px;
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 32px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.drop-primary {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}
.drop-link { color: var(--amber); }

.drop-secondary {
  font-size: 12px;
  color: var(--text-dim);
}

.file-chosen {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.file-icon { font-size: 20px; color: var(--amber); }
.file-name { font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.file-size { font-size: 11px; color: var(--text-dim); white-space: nowrap; }


/* ── Progress ── */

.progress-wrap {
  margin-bottom: 20px;
}

.progress-bar-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
  width: 0;
  transition: width .2s;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.btn-upload:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* =========================================================
   STATUS PAGE (success / error)
   ========================================================= */

.status-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 60px 48px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.status-icon {
  font-size: 40px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-family: var(--font-mono);
}

.status-success {
  background: var(--green-soft);
  color: var(--green);
  border: 2px solid var(--green)66;
}

.status-error {
  background: var(--red-soft);
  color: var(--red);
  border: 2px solid var(--red)66;
}

.status-card h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 12px;
}

.status-msg { font-size: 14px; margin-bottom: 8px; }
.status-sub { font-size: 12px; color: var(--text-dim); }


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
  .split-layout { grid-template-columns: 1fr; }
  .form-grid    { grid-template-columns: 1fr; }
  .stat-row     { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .auth-page     { flex-direction: column; }
  .auth-card     { width: 100%; padding: 40px 28px; border-right: none; }
  .auth-deco     { display: none; }
  .admin-shell   { flex-direction: column; }
  .sidebar       { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .sidebar-nav   { flex-direction: row; flex-wrap: wrap; }
  .admin-main    { padding: 20px; }
  .upload-card   { padding: 24px; }
}
