/* Vivian Portal — static/vivian_portal/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:      #060810;
  --surface: #0e1120;
  --border:  rgba(124,58,237,.18);
  --accent:  #7c3aed;
  --accent2: #4f46e5;
  --text:    #e2e8f0;
  --muted:   #94a3b8;
  --dim:     #4b5563;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 50% at 50% -5%, rgba(124,58,237,.14), transparent);
}
main { flex: 1; position: relative; z-index: 1; }
code {
  background: rgba(255,255,255,.08); padding: .1rem .4rem;
  border-radius: 4px; font-size: .85em;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6,8,16,.88); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 0 2rem; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: .65rem;
  text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.05rem;
}
.nav-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; color: #fff; flex-shrink: 0;
}
.nav-links { display: flex; gap: .5rem; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: .85rem;
  padding: .4rem .9rem; border-radius: 7px; transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: rgba(255,255,255,.06); }
.nav-right { display: flex; gap: .65rem; align-items: center; }
.nav-user { font-size: .85rem; color: var(--muted); }
.btn-outline {
  background: transparent; border: 1px solid rgba(255,255,255,.15);
  color: var(--text); padding: .4rem 1rem; border-radius: 8px;
  font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: border-color .15s; font-family: inherit;
}
.btn-outline:hover { border-color: var(--accent); color: #c4b5fd; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; padding: .4rem 1.1rem; border-radius: 8px;
  font-size: .85rem; font-weight: 700; text-decoration: none; border: none; cursor: pointer;
  transition: opacity .15s; font-family: inherit;
}
.btn-primary:hover { opacity: .9; }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center; padding: 5rem 2rem 4rem;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.28);
  color: #a78bfa; border-radius: 99px; padding: .3rem 1rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .05em; margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 900; line-height: 1.1;
  color: #f0f6fc; margin-bottom: 1.1rem; letter-spacing: -.02em;
}
.gradient-text {
  background: linear-gradient(135deg, #a78bfa, #818cf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p { font-size: 1.05rem; color: var(--muted); max-width: 560px; margin: 0 auto 2.25rem; line-height: 1.75; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; padding: .75rem 2rem; border-radius: 10px;
  font-size: 1rem; font-weight: 700; text-decoration: none; transition: opacity .15s, transform .1s;
}
.btn-hero-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-hero-secondary {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  color: var(--text); padding: .75rem 2rem; border-radius: 10px;
  font-size: 1rem; font-weight: 600; text-decoration: none; transition: background .15s, transform .1s;
}
.btn-hero-secondary:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }

/* ── Services grid ─────────────────────────────────────────────────────────── */
.services-section { max-width: 980px; margin: 0 auto; padding: 1rem 2rem 5rem; }
.section-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dim); font-weight: 700; text-align: center; margin-bottom: 1.75rem;
}
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.service-card {
  background: var(--surface); border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px; padding: 1.75rem;
  text-decoration: none; color: var(--text);
  transition: border-color .2s, transform .2s, box-shadow .2s; display: flex; flex-direction: column;
}
.service-card:hover {
  border-color: var(--card-accent, var(--accent)); transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.svc-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.svc-icon { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.svc-title { font-size: 1.05rem; font-weight: 800; margin-bottom: .2rem; }
.svc-domain { font-size: .75rem; font-weight: 600; opacity: .7; letter-spacing: .02em; }
.svc-desc { font-size: .87rem; color: var(--muted); line-height: 1.65; flex: 1; margin-bottom: 1.25rem; }
.svc-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.svc-tag { font-size: .7rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; background: rgba(255,255,255,.06); color: var(--muted); }
.svc-cta { margin-top: auto; padding: .55rem 1.1rem; border-radius: 8px; font-size: .85rem; font-weight: 700; text-align: center; text-decoration: none; display: block; transition: opacity .15s; }
.svc-cta:hover { opacity: .85; }

/* ── API strip ─────────────────────────────────────────────────────────────── */
.api-section {
  background: rgba(255,255,255,.025);
  border-top: 1px solid rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.06);
}
.api-inner {
  max-width: 980px; margin: 0 auto; padding: 3.5rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 2rem;
}
.api-text h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: .5rem; }
.api-text p  { font-size: .9rem; color: var(--muted); max-width: 480px; line-height: 1.7; }
.api-links { display: flex; gap: .75rem; flex-wrap: wrap; }
.api-link {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); padding: .55rem 1.25rem; border-radius: 8px;
  font-size: .85rem; font-weight: 600; text-decoration: none; transition: border-color .15s;
}
.api-link:hover { border-color: var(--accent); color: #c4b5fd; }
.api-link.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff;
}
.api-link.primary:hover { opacity: .9; }

/* ── Dashboard layout ──────────────────────────────────────────────────────── */
.dashboard-wrap {
  max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem;
  display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem;
}
@media (max-width: 768px) { .dashboard-wrap { grid-template-columns: 1fr; } }

/* Sidebar */
.sidebar {
  background: var(--surface); border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px; padding: 1.5rem; height: fit-content; position: sticky; top: 76px;
}
.sidebar-user { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 900; color: #fff;
}
.sidebar-name  { font-size: .92rem; font-weight: 700; }
.sidebar-username { font-size: .75rem; color: var(--muted); }
.role-badge { font-size: .65rem; font-weight: 700; padding: .15rem .5rem; border-radius: 99px; display: inline-block; margin-top: .25rem; }
.role-badge.admin { background: rgba(239,68,68,.15); color: #f87171; }
.role-badge.pro   { background: rgba(245,158,11,.15); color: #fbbf24; }
.role-badge.free  { background: rgba(255,255,255,.08); color: var(--muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar-link {
  color: var(--muted); text-decoration: none; font-size: .87rem;
  padding: .55rem .75rem; border-radius: 8px; transition: background .15s, color .15s;
}
.sidebar-link:hover, .sidebar-link.active { background: rgba(124,58,237,.12); color: #c4b5fd; }

/* Dash main */
.dash-main { display: flex; flex-direction: column; gap: 1.25rem; }

/* Stat row */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--surface); border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 1.25rem; display: flex; align-items: center; gap: .9rem;
}
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 900; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .1rem; }

/* Panels */
.panel { background: var(--surface); border: 1px solid rgba(255,255,255,.07); border-radius: 14px; overflow: hidden; }
.panel-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.05); display: flex; align-items: center; justify-content: space-between; }
.panel-title  { font-size: .95rem; font-weight: 800; }
.panel-hint   { font-size: .75rem; color: var(--muted); }
.panel-link   { font-size: .78rem; color: #a78bfa; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.panel-body   { padding: 1.25rem 1.5rem; }

/* API key */
.key-row { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.key-input {
  flex: 1; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: .55rem 1rem; color: var(--text);
  font-family: monospace; font-size: .85rem; outline: none;
}
.btn-icon {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; font-size: .95rem; transition: background .15s;
}
.btn-icon:hover { background: rgba(255,255,255,.12); }
.key-usage {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px; padding: .75rem 1rem; font-size: .82rem; line-height: 1.8;
  color: var(--muted);
}

/* History table */
.history-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.history-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: .4rem .5rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.history-table td { padding: .65rem .5rem; border-bottom: 1px solid rgba(255,255,255,.04); }
.history-table tr:last-child td { border-bottom: none; }
.model-tag { background: rgba(124,58,237,.12); color: #a78bfa; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; }

/* Quick links grid */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.quick-card {
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; padding: 1rem; text-decoration: none; color: var(--text);
  text-align: center; transition: border-color .2s, background .2s;
}
.quick-card:hover { border-color: var(--accent); background: rgba(124,58,237,.07); }
.quick-icon { font-size: 1.5rem; margin-bottom: .5rem; border-radius: 10px; padding: .35rem; display: inline-block; }
.quick-label { font-size: .82rem; font-weight: 700; margin-bottom: .2rem; }
.quick-sub   { font-size: .72rem; color: var(--muted); }

/* Error page */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; padding: 2rem; }
.error-card { background: var(--surface); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 3rem 2.5rem; text-align: center; max-width: 480px; width: 100%; }
.error-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.error-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: .75rem; }

/* Misc */
.text-muted { color: var(--muted); font-size: .87rem; }
a.text-muted { color: #a78bfa; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
  position: relative; z-index: 1;
  padding: 2.5rem 2rem; text-align: center; font-size: .82rem; color: var(--dim);
}
footer p + p { margin-top: .5rem; }
footer a { color: var(--muted); text-decoration: none; margin: 0 .5rem; }
footer a:hover { color: #a78bfa; }
