/* ============================================================
   PDF Subscription Platform — Prototype Styles
   Design tokens reused from CuraUp's design system.
   ============================================================ */

:root {
  --periwinkle: #5B65DC;
  --navy: #132054;
  --pulse: #C30406;
  --ink-secondary: #5A6072;
  --surface: #FFFFFF;
  --surface-raised: #F4F5FC;
  --border: #E2E4F0;
  --border-strong: #8890BD;

  --font-display: "Poppins", system-ui, sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;

  --shadow-card: 0 4px 16px rgba(19, 32, 84, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--navy);
  background: var(--surface-raised);
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; color: var(--navy); }
h1 { font-size: 28px; font-weight: 600; line-height: 36px; }
h2 { font-size: 20px; font-weight: 600; line-height: 28px; }
p { margin: 0; line-height: 1.5; }

a { color: var(--periwinkle); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-secondary { color: var(--ink-secondary); }
.text-small { font-size: 14px; }
.text-label { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }

/* ---------- Prototype nav (not part of the app UI — for click-through only) ---------- */
.proto-nav {
  background: var(--navy);
  color: #fff;
  padding: 10px var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.proto-nav strong { font-family: var(--font-display); margin-right: var(--space-3); }
.proto-nav a { color: #C9CCF2; }
.proto-nav a.active { color: #fff; font-weight: 600; text-decoration: underline; }

/* ---------- Layout shells ---------- */
.app-shell { min-height: calc(100vh - 41px); display: flex; flex-direction: column; }
.center-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-3);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--periwinkle);
}

/* ---------- Form elements ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--navy); }
.field input, .field select {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--navy);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--periwinkle);
  outline-offset: 1px;
}
.field input::placeholder { color: var(--ink-secondary); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--periwinkle); color: #fff; }
.btn-primary:hover { background: #4b54c6; }
.btn-secondary { background: var(--surface); color: var(--navy); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-raised); }
.btn-block { width: 100%; }

/* ---------- Top nav (real app chrome) ---------- */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-nav .links { display: flex; gap: var(--space-4); align-items: center; }
.top-nav .links a { color: var(--navy); font-size: 14px; }
.top-nav .links a.muted { color: var(--ink-secondary); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--periwinkle);
}

/* ---------- Catalog grid ---------- */
.page-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); max-width: 1100px; }
.pdf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pdf-thumb {
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  height: 140px;
}
.status-available { color: var(--periwinkle); font-size: 14px; }
.status-locked { color: var(--ink-secondary); font-size: 14px; }

/* ---------- Plans ---------- */
.plans { display: flex; gap: var(--space-4); flex-wrap: wrap; justify-content: center; }
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.plan-card.highlight { border: 2px solid var(--periwinkle); }
.plan-price { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--periwinkle); }
.checkout-modal {
  margin-top: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: var(--space-4);
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-card);
}

/* ---------- PDF Viewer ---------- */
.viewer-bar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.viewer-bar .doc-title { font-weight: 600; }
.viewer-bar .meta { color: #D6D9F5; font-size: 13px; }
.viewer-canvas {
  flex: 1;
  background: #E6E7EE;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.viewer-page {
  background: var(--surface);
  width: 100%;
  max-width: 620px;
  min-height: 70vh;
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  padding: 40px;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.watermark {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 22px;
  color: rgba(19, 32, 84, 0.08);
  white-space: nowrap;
  pointer-events: none;
}
.viewer-note {
  margin-top: var(--space-4);
  font-size: 13px;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  max-width: 620px;
}

/* ---------- Admin layout ---------- */
.admin-shell { display: flex; min-height: calc(100vh - 41px); }
.admin-sidebar {
  background: var(--navy);
  width: 220px;
  flex-shrink: 0;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-sidebar .logo { color: #fff; margin-bottom: var(--space-4); }
.admin-sidebar a {
  color: #fff;
  opacity: 0.75;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
}
.admin-sidebar a.active { opacity: 1; background: rgba(255,255,255,0.12); font-weight: 600; }
.admin-main { flex: 1; padding: 36px 40px; display: flex; flex-direction: column; gap: var(--space-4); }
.admin-header { display: flex; justify-content: space-between; align-items: center; max-width: 1140px; }

table.admin-table {
  width: 100%;
  max-width: 1140px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
table.admin-table th { color: var(--ink-secondary); font-weight: 600; font-size: 13px; }
table.admin-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.badge-active { background: rgba(91,101,220,0.14); color: var(--periwinkle); }
.badge-cancelled { background: rgba(195,4,6,0.10); color: var(--pulse); }
.badge-draft { background: rgba(90,96,114,0.12); color: var(--ink-secondary); }

/* ---------- Modals ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(19, 32, 84, 0.45);
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(19,32,84,0.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) 0;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink-secondary);
  line-height: 1;
  padding: 4px;
}
.modal-body { padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.modal-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.field textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--navy);
  resize: vertical;
  min-height: 72px;
}
.field .hint { font-size: 12px; color: var(--ink-secondary); }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  padding: 28px var(--space-3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--periwinkle); }
.dropzone .dz-icon { font-size: 28px; }
.dropzone .dz-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.dropzone .dz-sub { font-size: 12px; color: var(--ink-secondary); }
.dropzone input[type="file"] { display: none; }

.file-chosen {
  display: none;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
}
.file-chosen.show { display: flex; }
.file-chosen .remove-file { color: var(--pulse); cursor: pointer; font-weight: 600; }

.thumb-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.thumb-preview {
  width: 64px;
  height: 84px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-destructive { background: var(--pulse); color: #fff; }
.btn-destructive:hover { background: #a30304; }

.confirm-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(195,4,6,0.10);
  color: var(--pulse);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin: 0 auto;
}
.confirm-target {
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

.upload-progress {
  display: none;
  flex-direction: column;
  gap: 6px;
}
.upload-progress.show { display: flex; }
.upload-progress-track {
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 62%;
  background: var(--periwinkle);
  border-radius: 4px;
}

/* ---------- Status page: plan, toggle, invoices ---------- */
.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.status-row { display: flex; justify-content: space-between; align-items: center; }
.status-row + .status-row { border-top: 1px solid var(--border); padding-top: var(--space-3); }
.plan-pill {
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(91,101,220,0.14);
  color: var(--periwinkle);
  width: fit-content;
}
.toggle {
  position: relative;
  width: 40px; height: 22px;
  background: var(--border-strong);
  border-radius: 20px;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.15s ease;
}
.toggle.on { background: var(--periwinkle); }
.toggle.on::after { left: 20px; }
.invoice-list { display: flex; flex-direction: column; gap: 0; }
.invoice-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.invoice-row:last-child { border-bottom: none; }
.cancel-banner {
  display: none;
  background: rgba(195,4,6,0.06);
  border: 1px solid rgba(195,4,6,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: 13px;
  color: var(--navy);
}
.cancel-banner.show { display: block; }

/* ---------- Filter bar (admin tables) ---------- */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  max-width: 1140px;
  flex-wrap: wrap;
}
.filter-bar input[type="text"], .filter-bar select {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--navy);
}
.filter-bar input[type="text"] { min-width: 220px; }

/* ---------- Verification / info screens ---------- */
.info-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(91,101,220,0.12);
  color: var(--periwinkle);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto;
}

/* ---------- Audit log ---------- */
.audit-row td { vertical-align: top; }
.audit-diff {
  font-size: 12px;
  color: var(--ink-secondary);
  background: var(--surface-raised);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 4px;
  font-family: monospace;
}

/* ---------- Guided demo bar ---------- */
.demo-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  position: sticky;
  top: 41px;
  z-index: 90;
}
.demo-step { font-size: 12px; font-weight: 600; color: var(--periwinkle); white-space: nowrap; }
.demo-progress { flex: 1; height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 80px; }
.demo-progress-fill { height: 100%; background: var(--periwinkle); border-radius: 4px; }
.demo-actions { display: flex; gap: 8px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- Demo cover / end screens ---------- */
.demo-hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px var(--space-3) 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.demo-hero .eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--periwinkle);
}
.demo-hero h1 { font-size: 34px; line-height: 42px; }
.demo-persona {
  margin-top: var(--space-2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  font-size: 13px;
}
.demo-persona .avatar { width: 28px; height: 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .top-nav, .admin-header { padding-left: var(--space-3); padding-right: var(--space-3); flex-wrap: wrap; gap: var(--space-2); }
  .page-body { padding: var(--space-3); }
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 14px 16px; align-items: center; }
  .admin-sidebar .logo { margin-bottom: 0; margin-right: var(--space-3); white-space: nowrap; }
  .admin-main { padding: 20px; }
  table.admin-table { display: block; overflow-x: auto; white-space: nowrap; }
  .plans { flex-direction: column; align-items: center; }
  .modal { max-width: 100%; }
  .filter-bar { width: 100%; }
  .filter-bar input[type="text"] { min-width: 0; flex: 1; }
  .status-card { max-width: 100%; }
  .demo-bar { position: static; }
  .demo-actions { width: 100%; justify-content: space-between; }
}
