/* ShivAI Portal styles — extends the marketing site's design language.
   Same design tokens (navy + orange + DM Sans + Playfair Display) so the
   portal feels like a continuation of shivaiscsolutions.com. */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
  --navy: #0A1628;
  --navy-mid: #1B3A6B;
  --navy-light: #243B6A;
  --orange: #E8721A;
  --orange-light: #FF8C3A;
  --orange-pale: #FFF3E8;
  --bg: #FAFBFC;
  --white: #FFFFFF;
  --text: #1a1a2e;
  --text-mid: #3d4f5f;
  --text-light: #556170;
  --border: #E2E8F0;
  --border-light: #EDF2F7;
  --green: #047857;
  --red: #B91C1C;
  --amber: #D97706;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.1);
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --max-w: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange); text-decoration: none; transition: color .15s; }
a:hover { color: var(--orange-light); }

/* ── Top navigation ──────────────────────────────────────── */
.portal-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.portal-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--navy);
}
.nav-brand .logo {
  width: 32px; height: 32px;
  background: var(--navy); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--orange); font-weight: 800; font-family: var(--font-display);
}
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.nav-brand-main { font-weight: 700; font-size: 1.05rem; }
.nav-brand-sub { font-size: 0.7rem; color: var(--text-light); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a {
  color: var(--text-mid); font-weight: 500; font-size: 0.92rem;
}
.nav-links a.active { color: var(--navy); font-weight: 600; }
.nav-links a:hover { color: var(--orange); }
.nav-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; color: var(--text-mid);
}
.nav-user-pill {
  background: var(--orange-pale); color: var(--orange);
  padding: 4px 10px; border-radius: 999px;
  font-weight: 600; font-size: 0.75rem;
}
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--navy);
}

/* ── Container & page header ─────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px;
}
.page-header {
  margin-bottom: 24px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700;
  color: var(--navy); line-height: 1.2;
}
.page-subtitle {
  color: var(--text-light); font-size: 0.95rem; margin-top: 4px;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 16px; }
.card-title {
  font-weight: 600; font-size: 1.05rem;
  color: var(--navy); margin-bottom: 8px;
}

/* ── Forms ───────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-mid); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body); font-size: 0.95rem;
  background: var(--white); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,114,26,0.12);
}
.field .help {
  font-size: 0.78rem; color: var(--text-light); margin-top: 4px;
}
.field .error {
  font-size: 0.82rem; color: var(--red); margin-top: 4px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--orange); color: var(--white);
}
.btn-primary:hover { background: var(--orange-light); color: var(--white); }
.btn-secondary {
  background: var(--white); color: var(--navy);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--navy); }
.btn-ghost {
  background: transparent; color: var(--text-mid);
}
.btn-ghost:hover { background: var(--border-light); color: var(--navy); }
.btn-danger {
  background: var(--white); color: var(--red);
  border-color: var(--border);
}
.btn-danger:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Auth pages (centred) ────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--bg) 0%, var(--white) 100%);
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  text-align: center; margin-bottom: 24px;
}
.auth-brand .logo-text {
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 700;
}
.auth-brand .logo-text .accent { color: var(--orange); }
.auth-brand .tag {
  font-size: 0.72rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 1.5px; margin-top: 6px;
}
.auth-card h1 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  color: var(--navy); text-align: center; margin-bottom: 6px;
}
.auth-card .subtitle {
  text-align: center; color: var(--text-light);
  font-size: 0.9rem; margin-bottom: 24px;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-light); font-size: 0.78rem;
  margin: 18px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.auth-card .alt-link {
  text-align: center; margin-top: 20px;
  font-size: 0.88rem; color: var(--text-light);
}

/* Google sign-in button */
.btn-google {
  background: var(--white); color: var(--text);
  border-color: var(--border);
  font-weight: 500;
}
.btn-google:hover { border-color: var(--navy-mid); }
.btn-google svg { width: 18px; height: 18px; }

/* ── Status pills ────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pill-success { background: #ECFDF5; color: var(--green); }
.pill-warning { background: #FEF3C7; color: var(--amber); }
.pill-danger  { background: #FEE2E2; color: var(--red); }
.pill-neutral { background: var(--border-light); color: var(--text-mid); }
.pill-info    { background: var(--orange-pale); color: var(--orange); }

/* ── Tables ──────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.table th {
  font-weight: 600; color: var(--text-mid);
  background: var(--bg);
  text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.72rem;
}
.table tr:last-child td { border-bottom: none; }
.table-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-light);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.3rem; color: var(--navy);
  margin-bottom: 6px;
}
.empty-state p { font-size: 0.92rem; margin-bottom: 18px; }

/* ── Alerts (flash + banners) ────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.alert-success { background: #ECFDF5; border-color: var(--green); color: var(--green); }
.alert-error   { background: #FEE2E2; border-color: var(--red);   color: var(--red); }
.alert-info    { background: var(--orange-pale); border-color: var(--orange); color: var(--text); }

/* ── Subscription card ──────────────────────────────────── */
.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}
.sub-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.sub-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.sub-product {
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 700;
  color: var(--navy);
}
.sub-plan {
  font-size: 0.78rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sub-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 14px 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.sub-metric-label {
  font-size: 0.72rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sub-metric-value {
  font-weight: 600; color: var(--navy);
  font-size: 0.95rem; margin-top: 2px;
}
.sub-actions {
  display: flex; gap: 8px;
  margin-top: auto;
}

/* ── Activation modal (HTMX-loaded) ──────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,22,40,.6);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 1.4rem; color: var(--navy);
  text-align: center; margin-bottom: 4px;
}
.modal .modal-subtitle {
  text-align: center; color: var(--text-light);
  font-size: 0.92rem; margin-bottom: 22px;
}
.activation-code {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 2.6rem; font-weight: 700; letter-spacing: 8px;
  text-align: center; color: var(--navy);
  background: var(--orange-pale);
  border: 2px dashed var(--orange);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0;
  user-select: all;
}
.modal-meta {
  background: var(--bg); border-radius: 8px;
  padding: 12px 14px; margin: 12px 0 18px;
  font-size: 0.85rem; color: var(--text-mid);
  line-height: 1.5;
}
.modal-meta strong { color: var(--navy); }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch;
    padding: 12px 24px; gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; }
  .nav-user { display: none; }
  .container { padding: 20px 16px; }
  .page-title { font-size: 1.5rem; }
  .auth-card { padding: 28px 22px; }
  .activation-code { font-size: 2rem; letter-spacing: 4px; padding: 16px; }
  .sub-grid { grid-template-columns: 1fr; }
  .sub-metrics { grid-template-columns: 1fr; }
  /* Tables become scrollable rather than wrapped */
  .table-card { overflow-x: auto; }
}

/* ── Footer ──────────────────────────────────────────────── */
.portal-footer {
  margin-top: 60px;
  padding: 24px;
  text-align: center;
  font-size: 0.82rem; color: var(--text-light);
  border-top: 1px solid var(--border-light);
}

/* ── Tabs (account page) ─────────────────────────────────── */
.tabs-bar {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  background: transparent; border: none;
  padding: 12px 18px;
  font-family: var(--font-body); font-size: 0.92rem; font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}
