/*
 * SEVA Committee console — Gurdwara-inspired dark theme
 * Deep navy Darbar tones + kesari highlights + gold accents (client-facing).
 */
:root {
  --bg: #070f18;
  --bg-elevated: #0c1929;
  --surface: #0f2744;
  --surface-2: #153559;
  --border: #2a4f73;
  --border-kesari: rgba(217, 119, 54, 0.45);
  --text: #fdf9f3;
  --muted: #9bb0c8;
  /* Kesari — primary UI highlight */
  --kesari: #e8933a;
  --kesari-dim: #c45c26;
  --kesari-soft: #f4c28a;
  /* Gold — brand / prosperity accent */
  --gold: #d4af37;
  --gold-dim: #a67c00;
  --ok: #5cb87a;
  --danger: #e85d6f;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body.portal-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 90% 60% at 15% -10%, rgba(232, 147, 58, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse 70% 50% at 95% 10%, rgba(15, 55, 89, 0.5) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  color: var(--text);
}

.portal-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.portal-nav {
  background: linear-gradient(180deg, var(--surface) 0%, #0d2137 100%);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.2);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.portal-brand .portal-mark {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: linear-gradient(135deg, var(--kesari-soft) 0%, var(--gold) 55%, var(--kesari) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.portal-brand .portal-sub {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.portal-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.portal-links a {
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.92rem;
  transition: background 0.12s, color 0.12s;
}

.portal-links a:hover {
  background: rgba(232, 147, 58, 0.12);
  color: var(--kesari-soft);
}

.portal-links a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(232, 147, 58, 0.22), transparent);
  border: 1px solid var(--border-kesari);
  color: var(--kesari-soft);
}

.portal-user {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.portal-user .email {
  color: var(--text);
  word-break: break-all;
}

.portal-user .role {
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.portal-user .logout {
  margin: 0.75rem 0 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--kesari-soft);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.portal-main {
  padding: 1.75rem 2rem 3rem;
  max-width: 1200px;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--text);
}

.page-head-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.panel-head h2 {
  margin: 0;
}

.lede, .muted {
  color: var(--muted);
  margin: 0 0 1rem;
}

.meta-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.meta-inline a {
  color: var(--kesari-soft);
  font-weight: 600;
  text-decoration: none;
}

.meta-inline a:hover {
  color: var(--kesari);
  text-decoration: underline;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  border-top: 3px solid var(--kesari-dim);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 600;
  margin-top: 0.35rem;
  color: var(--gold);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--kesari-soft);
}

.panel h3 {
  margin: 1.15rem 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.kv {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kv li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.kv li:last-child { border-bottom: none; }

.tile-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tile-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.tile-list a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.tile-list a:hover { color: var(--kesari-soft); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table.wide { font-size: 0.82rem; }

.data-table th, .data-table td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table .num { text-align: right; }

.data-table .narrow-wrap {
  max-width: 14rem;
  white-space: normal;
  line-height: 1.35;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  border-left: 3px solid var(--kesari-dim);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover { color: var(--kesari-soft); }

.badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}

.badge.ok {
  background: rgba(92, 184, 122, 0.15);
  color: var(--ok);
  border: 1px solid rgba(92, 184, 122, 0.35);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages.compact { margin-bottom: 1rem; }

.msg {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.msg.error { border-color: rgba(232, 93, 111, 0.5); }

.filters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  margin: 0.75rem 0 1.25rem;
  align-items: center;
}

@media (min-width: 768px) {
  .filters {
    flex-wrap: nowrap;
  }
}

.pagination {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

.pagination a { color: var(--kesari-soft); }

/* Committee booking form */
.panel-accent {
  border-top: 3px solid var(--kesari-dim);
}

.committee-form label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-full {
  margin-bottom: 1rem;
}

.form-full textarea.portal-input {
  min-height: 4.5rem;
}

.form-errors {
  color: var(--danger);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.small { font-size: 0.88rem; }
.tiny { font-size: 0.75rem; opacity: 0.85; }

.subh {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--muted);
}

.crumb {
  margin: 0 0 0.5rem;
}

.crumb a {
  color: var(--kesari-soft);
  text-decoration: none;
}

.crumb a:hover { text-decoration: underline; }

.link-inline {
  color: var(--kesari-soft);
  font-weight: 600;
  text-decoration: none;
}

.link-inline:hover { text-decoration: underline; }

.cell-actions { white-space: nowrap; }

/* Readable links on dark tables (avoid default browser blue) */
.portal-main .data-table a {
  color: var(--kesari-soft);
  font-weight: 600;
  text-decoration: none;
}

.portal-main .data-table a:hover {
  color: #fff;
  text-decoration: underline;
}

.portal-main .data-table td code {
  color: inherit;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.btn-compact {
  padding: 0.45rem 0.95rem;
  font-size: 0.88rem;
}

a.btn-secondary.inline-cancel {
  display: inline-block;
  margin-left: 0.75rem;
  text-decoration: none;
  line-height: normal;
}

.form-checks {
  margin: 1rem 0;
}

.form-checks .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Auth — light card on deep navy */
body.portal-auth {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(232, 147, 58, 0.18) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  color: var(--text);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem 2.1rem;
  background: linear-gradient(180deg, #fdf9f3 0%, #f5ebe0 100%);
  border: 1px solid var(--border-kesari);
  border-radius: 14px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #0f2744;
}

.auth-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, var(--kesari-dim) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: #0f2744;
}

.auth-card .muted {
  color: #5a6b7d;
}

.auth-card .messages .msg {
  background: #fef3e6;
  border: 1px solid rgba(217, 119, 54, 0.35);
  color: #0f2744;
}

.auth-card .messages .msg.error {
  border-color: rgba(185, 28, 28, 0.45);
  background: #fef2f2;
}

.auth-form label {
  display: block;
  font-size: 0.8rem;
  color: #5a6b7d;
  margin: 0.75rem 0 0.35rem;
}

.portal-input, .auth-form input[type="text"], .auth-form input[type="password"], .auth-form input[type="email"], .auth-form select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 2px solid #c5d4e0;
  background: #fff;
  color: #0f2744;
  font: inherit;
}

.portal-input:focus, .auth-form input:focus, .auth-form select:focus {
  outline: 2px solid rgba(217, 119, 54, 0.45);
  border-color: var(--kesari-dim);
}

/* Booking list / toolbar: one row on desktop (override width:100% on inputs) */
.filters .portal-input,
.filters .btn-secondary {
  width: auto;
  max-width: 100%;
}

.filters select.portal-input {
  flex: 0 1 13rem;
  min-width: 10rem;
}

.filters input.portal-input[type="search"] {
  flex: 1 1 12rem;
  min-width: 11rem;
  max-width: 24rem;
}

.filters .btn-secondary {
  flex: 0 0 auto;
}

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(180deg, var(--kesari) 0%, var(--kesari-dim) 100%);
  color: #fff;
  font-weight: 600;
  margin-top: 1rem;
  box-shadow: 0 4px 16px rgba(196, 92, 38, 0.35);
}

.btn-primary.wide { width: 100%; }

.btn-primary:hover { filter: brightness(1.05); }

.btn-secondary {
  background: #fff;
  color: #0f2744;
  border-color: #2a4f73;
}

.invite-link-row {
  margin: 1rem 0 1.25rem;
}

.invite-link-copy {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.35rem;
}

.invite-link-copy .portal-input {
  flex: 1;
  min-width: 0;
}

.invite-link-copy .btn-secondary {
  flex: 0 0 auto;
  margin-top: 0;
  align-self: center;
}

.form-errors, .field-errors {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.auth-foot {
  margin: 1.25rem 0 0;
  font-size: 0.88rem;
}

.auth-foot a { color: var(--kesari-dim); font-weight: 600; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 860px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }
  .portal-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .portal-links { flex-direction: row; flex-wrap: wrap; }
  .portal-user { width: 100%; }
}
