/* CRUX AI v3 — Quantisage-branded */

:root {
  --deep-blue: #1D0C86;
  --light: #F8F7FF;
  --mid-gray: #8B88A8;
  --light-gray: #E8E6F5;
  --purple: #A100FF;
  --cyan: #00D4FF;
  --emerald: #50C878;
  --danger: #E63946;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 12, 134, 0.05), 0 4px 12px rgba(29, 12, 134, 0.06);
  --shadow-lg: 0 4px 12px rgba(29, 12, 134, 0.08), 0 12px 32px rgba(29, 12, 134, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--deep-blue);
  background: var(--light);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

/* ---- Layout ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---- Nav ---- */
.nav {
  background: white;
  border-bottom: 1px solid var(--light-gray);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 50;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  font-weight: 800; font-size: 18px;
  color: var(--deep-blue);
  flex-shrink: 0;
  min-width: 0;
}
.brand:hover { text-decoration: none; }
/* Logo aspect ratio: source is 2498x409 = ~6.1:1.
   At 36px tall, width is ~220px — fits comfortably in nav. */
.brand-logo {
  height: 36px;
  width: auto;
  max-width: 240px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-divider {
  width: 1px; height: 24px; background: var(--light-gray);
  flex-shrink: 0;
}
.brand-product {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--deep-blue);
  white-space: nowrap;
}
.brand-product .accent {
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a { color: var(--deep-blue); font-weight: 500; font-size: 14px; }
.nav-links a:hover { color: var(--purple); text-decoration: none; }
.nav-links a.btn { color: white; }
.nav-links a.btn-ghost { color: var(--deep-blue); }
.nav-links a.btn-ghost:hover { color: var(--purple); }

/* On narrow screens, hide the product divider+name to save space */
@media (max-width: 600px) {
  .brand-divider, .brand-product { display: none; }
  .brand-logo { height: 32px; max-width: 200px; }
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 72px 0 40px;
}
.hero h1 {
  font-size: 48px; font-weight: 800; margin: 0 0 16px;
  letter-spacing: -0.02em; line-height: 1.1;
}
.hero h1 .accent {
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: 18px; color: var(--mid-gray); margin: 0 auto 36px; max-width: 600px; }

/* ---- Card ---- */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--light-gray);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-lg { padding: 32px; box-shadow: var(--shadow-lg); }

/* ---- Forms ---- */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--deep-blue);
  background: white;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%231D0C86' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 40px;
  cursor: pointer;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(161, 0, 255, 0.1);
}
.input-lg { padding: 16px 18px; font-size: 16px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  border: none; border-radius: var(--radius);
  cursor: pointer; transition: transform .1s, box-shadow .15s, background .15s;
  text-decoration: none !important;
  color: white;
}
.btn:hover { color: white; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary       { background: var(--deep-blue); color: white; }
.btn-primary:hover { background: var(--purple);    color: white; }
.btn-accent {
  background: linear-gradient(135deg, var(--purple), var(--deep-blue));
  color: white;
}
.btn-accent:hover  { transform: translateY(-1px); box-shadow: var(--shadow-lg); color: white; }
.btn-ghost         { background: white; color: var(--deep-blue); border: 1px solid var(--light-gray); }
.btn-ghost:hover   { border-color: var(--purple); color: var(--purple); }
.btn-danger        { background: var(--danger); color: white; }
.btn-danger:hover  { background: #c1272f; color: white; }
.btn-lg            { padding: 16px 28px; font-size: 16px; }
.btn-sm            { padding: 8px 14px;  font-size: 13px; }
.btn-block         { width: 100%; }

.label { display: block; font-size: 13px; font-weight: 600; color: var(--deep-blue); margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.label-row .label { margin-bottom: 0; }
.help  { font-size: 12px; color: var(--mid-gray); margin-top: 6px; line-height: 1.5; }

/* ---- Composite: dashboard transcribe form (NEW v3 stacked layout) ---- */
.transcribe-form-v3 .form-row {
  margin-bottom: 16px;
}
.transcribe-form-v3 .form-row:last-child {
  margin-bottom: 0;
}
.transcribe-form-v3 .submit-row {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 4px;
}
.transcribe-form-v3 .submit-row .btn {
  min-width: 200px;
}
.framework-help {
  font-size: 12px;
  color: var(--mid-gray);
  margin-top: 6px;
  line-height: 1.5;
  font-style: italic;
}
.custom-prompt-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 13px; color: var(--mid-gray);
  user-select: none;
}
.custom-prompt-toggle input[type="checkbox"] {
  margin: 0;
}
.custom-prompt-block {
  margin-top: 12px;
  padding: 14px;
  background: var(--light); border: 1px dashed var(--light-gray);
  border-radius: var(--radius);
}

/* ---- Features grid ---- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 48px 0;
}
.feature {
  background: white; border-radius: var(--radius); padding: 24px;
  border: 1px solid var(--light-gray);
}
.feature-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--light-gray); color: var(--purple);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p  { margin: 0; color: var(--mid-gray); font-size: 14px; }

/* ---- Result page ---- */
.result-header { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.result-thumb {
  width: 200px; flex-shrink: 0;
  aspect-ratio: 16 / 9;
  border-radius: 8px; overflow: hidden;
  background: var(--light-gray);
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-meta h2 { margin: 0 0 4px; font-size: 22px; }
.result-meta .channel { color: var(--mid-gray); font-size: 14px; }
.result-meta .stats { color: var(--mid-gray); font-size: 13px; margin-top: 8px; }
.result-meta .stats span { margin-right: 16px; }

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--light-gray);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 12px 20px;
  background: transparent; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--mid-gray); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--deep-blue); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }

.summary-md h2 { color: var(--deep-blue); border-left: 4px solid var(--purple); padding-left: 12px; margin-top: 28px; font-size: 20px; }
.summary-md h3 { color: var(--deep-blue); font-size: 16px; margin-top: 20px; }
.summary-md ul, .summary-md ol { padding-left: 22px; }
.summary-md li { margin: 6px 0; }
.summary-md p { line-height: 1.6; }
.summary-md em { color: var(--mid-gray); font-style: italic; }
.summary-md code { background: var(--light-gray); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.transcript-text {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 15px;
  font-family: 'Source Serif Pro', Georgia, serif;
}

/* ---- History list ---- */
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--light-gray);
  border-radius: var(--radius); margin-bottom: 10px;
  background: white;
  transition: border-color .15s;
}
.history-item:hover { border-color: var(--purple); }
.history-item .meta { flex: 1; min-width: 0; }
.history-item .title { font-weight: 600; color: var(--deep-blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .sub { font-size: 13px; color: var(--mid-gray); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px; border-radius: var(--radius);
  border-left: 4px solid; font-size: 14px;
  margin-bottom: 16px;
}
.alert-error   { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.alert-info    { background: var(--light-gray); border-color: var(--cyan); color: var(--deep-blue); }
.alert-success { background: #ecfdf5; border-color: var(--emerald); color: #065f46; }

/* ---- Bookmarklet ---- */
.bookmarklet-wrap {
  text-align: center;
  padding: 32px 0;
}
.bookmarklet-link {
  display: inline-block;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--purple), var(--deep-blue));
  color: white !important;
  border-radius: var(--radius);
  font-weight: 600; font-size: 16px;
  text-decoration: none !important;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: element;
  box-shadow: var(--shadow-lg);
  transition: transform .1s;
}
.bookmarklet-link:active { cursor: grabbing; transform: scale(0.98); }
.bookmarklet-link:hover { color: white !important; }

/* ---- Misc ---- */
.muted { color: var(--mid-gray); }
.kbd { font-family: ui-monospace, monospace; font-size: 12px; background: var(--light-gray); padding: 2px 6px; border-radius: 4px; }
.code-block {
  background: var(--light-gray); padding: 14px; border-radius: var(--radius);
  font-family: ui-monospace, monospace; font-size: 12px;
  overflow-x: auto; word-break: break-all;
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--light-gray); border-top-color: var(--purple);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Footer ---- */
.footer {
  background: white;
  border-top: 1px solid var(--light-gray);
  padding: 48px 0 32px;
  margin-top: 80px;
  color: var(--mid-gray);
  font-size: 13px;
}
.footer-grid {
  display: grid; gap: 32px;
  grid-template-columns: 2fr 1fr 1fr;
  margin-bottom: 32px;
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-brand img {
  height: 28px;
  width: auto;
  max-width: 200px;
  display: block;
  margin-bottom: 12px;
  object-fit: contain;
}
.footer-brand p   { margin: 6px 0; max-width: 360px; }
.footer-col h4    { color: var(--deep-blue); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 12px; }
.footer-col ul    { list-style: none; padding: 0; margin: 0; }
.footer-col li    { margin-bottom: 8px; }
.footer-col a     { color: var(--mid-gray); }
.footer-col a:hover { color: var(--purple); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid var(--light-gray);
  padding-top: 20px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* ---- Legal pages ---- */
.legal-doc { max-width: 760px; }
.legal-doc h1 { font-size: 32px; margin: 0 0 8px; }
.legal-doc .legal-updated { color: var(--mid-gray); font-size: 13px; margin-bottom: 32px; }
.legal-doc h2 { font-size: 20px; color: var(--deep-blue); margin-top: 32px; border-left: 4px solid var(--purple); padding-left: 12px; }
.legal-doc p, .legal-doc li { line-height: 1.7; color: #2a2452; }
.legal-doc .legal-notice { background: var(--light-gray); padding: 12px 16px; border-radius: var(--radius); font-size: 13px; }

/* ---- Admin ---- */
.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--light-gray);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.admin-tab {
  padding: 12px 20px;
  text-decoration: none;
  font-size: 14px; font-weight: 600;
  color: var(--mid-gray);
  border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--deep-blue); text-decoration: none; }
.admin-tab.active { color: var(--purple); border-bottom-color: var(--purple); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--light-gray); text-align: left; }
.admin-table th { background: var(--light); color: var(--deep-blue); font-weight: 600; }
.admin-table code { font-family: ui-monospace, monospace; background: var(--light-gray); padding: 2px 6px; border-radius: 4px; }
.admin-table td.numeric, .admin-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table tr:hover td { background: var(--light); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-active   { background: #ecfdf5; color: #065f46; }
.badge-used     { background: var(--light-gray); color: var(--mid-gray); }
.badge-expired  { background: #fef2f2; color: var(--danger); }
.badge-admin    { background: rgba(161, 0, 255, 0.12); color: var(--purple); }
.badge-user     { background: var(--light-gray); color: var(--mid-gray); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-stat {
  background: white; border: 1px solid var(--light-gray);
  border-radius: var(--radius); padding: 16px;
}
.admin-stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mid-gray); margin-bottom: 4px; }
.admin-stat .value { font-size: 24px; font-weight: 700; color: var(--deep-blue); font-variant-numeric: tabular-nums; }

/* ---- v4 multi-platform additions ---- */
.platforms-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin: 0 auto 48px;
  max-width: 720px;
}
.platform-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--light-gray);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--deep-blue);
}
.badge-platform {
  background: rgba(161, 0, 255, 0.10);
  color: var(--purple);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.result-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--purple), var(--deep-blue));
  position: relative;
}
.result-thumb-placeholder .platform-tag {
  color: white;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
