/*
 * Torve Portal - authenticated app layout.
 * Uses site-base.css tokens and shared header.
 * No sidebar. Top nav only, matching the homepage header.
 */

/* ── Legacy token aliases (for inline styles on sub-pages) ─────────── */
:root {
  --bg: var(--t-bg, #08080e);
  --bg-card: var(--t-bg-card, #111118);
  --bg-input: var(--t-bg-input, #16161e);
  --border: var(--t-border, rgba(255,255,255,.1));
  --border-focus: var(--t-border-focus, rgba(200,164,78,.35));
  --text: var(--t-text, #e4e4e7);
  --text-muted: var(--t-text-muted, #71717a);
  --accent: var(--t-accent, #c8a44e);
  --accent-hover: var(--t-accent-light, #dbb95c);
  --danger: var(--t-danger, #ef4444);
  --success: var(--t-success, #22c55e);
  --radius: var(--t-radius, 10px);
  --radius-lg: var(--t-radius-lg, 16px);
}

/* ── Portal body ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.app-body {
  font-family: var(--t-font, Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(200,164,78,.02) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 100%, rgba(20,20,50,.15) 0%, transparent 40%),
    var(--t-bg, #08080e);
  color: var(--t-text, #e4e4e7);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Portal user email in header ───────────────────────────────────── */
.portal-user-email {
  font-size: 13px;
  color: var(--t-text-muted, #71717a);
}

/* ── Portal nav active state ───────────────────────────────────────── */
.site-header-nav a.active {
  color: var(--t-accent, #c8a44e);
}

/* ── Portal main content (no sidebar) ──────────────────────────────── */
.portal-main {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  display: flex;
  justify-content: center;
  padding: 48px 24px 80px;
}
.portal-content {
  width: 100%;
  max-width: 800px;
}
.portal-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--t-text-strong, #fff);
  margin-bottom: 8px;
  letter-spacing: -.02em;
}
.portal-content .section-desc {
  font-size: 15px;
  color: var(--t-text-muted, #71717a);
  margin-bottom: 36px;
  line-height: 1.6;
  max-width: 520px;
}

/* ── Overview cards ────────────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.overview-card {
  display: flex;
  flex-direction: column;
  background: var(--t-bg-card, #111118);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--t-radius-lg, 16px);
  padding: 28px;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  transition: border-color .3s, box-shadow .3s, transform .3s;
  cursor: pointer;
}
.overview-card:hover {
  border-color: rgba(200,164,78,.2);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.overview-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(200,164,78,.06);
  border: 1px solid rgba(200,164,78,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.overview-card-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--t-accent, #c8a44e);
}
.overview-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--t-text-strong, #fff);
  margin-bottom: 6px;
}
.overview-card p {
  font-size: 13px;
  color: var(--t-text-muted, #71717a);
  line-height: 1.5;
}

/* ── Legacy app-main (used by sub-pages until migrated) ────────────── */
.app-main {
  margin-top: 64px;
  padding: 48px 24px 80px;
  min-height: calc(100vh - 64px);
  max-width: 848px;
  margin-left: auto;
  margin-right: auto;
}
.app-main h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--t-text-strong, #fff);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.app-main .section-desc {
  font-size: 15px;
  color: var(--t-text-muted, #71717a);
  margin-bottom: 32px;
  max-width: 540px;
  line-height: 1.6;
}

/* ── Placeholder cards ─────────────────────────────────────────────── */
.placeholder-card {
  background: var(--t-bg-card, #111118);
  border: 1px solid var(--t-border, rgba(255,255,255,.06));
  border-radius: var(--t-radius-lg, 16px);
  padding: 32px;
  text-align: center;
  max-width: 520px;
}
.placeholder-card h3 {
  font-size: 16px;
  color: var(--t-text-strong, #fff);
  margin-bottom: 8px;
}
.placeholder-card p {
  font-size: 14px;
  color: var(--t-text-muted, #71717a);
  line-height: 1.5;
}
a.placeholder-card { text-decoration: none; transition: border-color .2s; cursor: pointer; }
a.placeholder-card:hover { border-color: rgba(200,164,78,.15); }
.placeholder-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(200,164,78,.08);
  border: 1px solid rgba(200,164,78,.12);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t-accent, #c8a44e);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}

/* ── Verification banner ───────────────────────────────────────────── */
.verify-banner {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 99;
  padding: 10px 24px;
  background: rgba(200,164,78,.06);
  border-bottom: 1px solid rgba(200,164,78,.1);
  text-align: center;
  font-size: 13px;
  color: var(--t-accent, #c8a44e);
}
.verify-banner.visible { display: block; }
.verify-banner a {
  color: var(--t-accent, #c8a44e);
  font-weight: 600;
  text-decoration: underline;
}

/* ── Loading ───────────────────────────────────────────────────────── */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--t-text-muted, #71717a);
  font-size: 15px;
  font-family: var(--t-font, Inter, system-ui, sans-serif);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--t-border, rgba(255,255,255,.06));
  border-top-color: var(--t-accent, #c8a44e);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Legacy alert classes ──────────────────────────────────────────── */
.alert { display: none; padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.alert.visible { display: block; }
.alert-error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.15); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.15); color: #86efac; }
.alert-info { background: rgba(200,164,78,.06); border: 1px solid rgba(200,164,78,.1); color: var(--t-accent, #c8a44e); }

/* ── Form controls ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--t-text-muted, #71717a); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  color: var(--t-text, #e4e4e7); background: var(--t-bg-input, #16161e);
  border: 1px solid var(--t-border, rgba(255,255,255,.06)); border-radius: 8px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus { border-color: var(--t-border-focus, rgba(200,164,78,.35)); box-shadow: 0 0 0 3px rgba(200,164,78,.06); }
.form-group input::placeholder { color: var(--t-text-subtle, #52525b); }

/* ── Channel form rows ────────────────────────────────────────────── */
.form-row { margin-bottom:12px; }
.form-row label { display:block; font-size:12px; font-weight:500; color:var(--t-text-muted, #71717a); margin-bottom:4px; }
.form-row input {
  width:100%; padding:9px 12px; font-size:13px; font-family:inherit;
  background:var(--t-bg-surface, #18181b); border:1px solid var(--t-border, rgba(255,255,255,.08));
  border-radius:6px; color:var(--t-text, #e4e4e7); outline:none; box-sizing:border-box;
}
.form-row input:focus { border-color:var(--t-border-focus, rgba(200,164,78,.35)); }
.form-row input::placeholder { color:#52525b; }

.channel-tab-btn { transition:all .2s; }
.channel-tab-btn.active { background:var(--accent, #c8a44e); color:#08080e; border-color:var(--accent, #c8a44e); }

/* ── Portal buttons ────────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 12px; font-size: 15px; font-weight: 600; font-family: inherit;
  color: #08080e; background: linear-gradient(135deg, var(--t-accent, #c8a44e), var(--t-accent-light, #dbb95c));
  border: none; border-radius: 8px; cursor: pointer;
  transition: opacity .2s, box-shadow .2s; text-align: center; text-decoration: none;
  box-shadow: 0 2px 16px var(--t-accent-glow, rgba(200,164,78,.15));
}
.btn-primary:hover { opacity: .9; box-shadow: 0 4px 24px rgba(200,164,78,.2); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-secondary-link { display: block; text-align: center; margin-top: 16px; font-size: 14px; color: var(--t-accent, #c8a44e); text-decoration: none; }
.btn-secondary-link:hover { text-decoration: underline; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 14px; color: var(--t-text-muted, #71717a); }
.auth-footer a { color: var(--t-accent, #c8a44e); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .overview-grid { grid-template-columns: 1fr; }
  .portal-main { padding: 32px 16px 60px; }
  .app-main { padding: 32px 16px 60px; }
}
