/* ── StuNight Portal – Dark Theme ─────────────────────────────────── */

:root {
  --bg: #000000;
  --bg-elevated: #0a0a0c;
  --surface: #1c1c1e;
  --surface-strong: #2c2c2e;
  --surface-muted: #1c1c1e;
  --ink: #ffffff;
  --ink-soft: #a1a1aa;
  --ink-faint: #636366;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --accent: #e94560;
  --accent-hover: #f2576f;
  --accent-soft: rgba(233, 69, 96, 0.15);
  --accent-glow: rgba(233, 69, 96, 0.35);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.35);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shell-width: 1440px;
  --transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(233, 69, 96, 0.08);
  color: var(--accent);
}

/* ── Layout Shells ────────────────────────────────────────────────── */

.portal-app {
  min-height: 100vh;
}

.public-shell,
.auth-shell,
.portal-shell {
  width: min(calc(100% - 48px), var(--shell-width));
  margin: 0 auto;
}

.public-shell {
  padding: 40px 0 80px;
}

/* ── Topbar ───────────────────────────────────────────────────────── */

.public-topbar,
.auth-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(233, 69, 96, 0.08);
  color: var(--accent);
  box-shadow: none;
}

.brand-mark ion-icon {
  font-size: 24px;
}

.brand-inline-icon {
  font-size: 16px;
  vertical-align: -2px;
  margin-right: 6px;
  color: var(--accent);
}

.brand-copy strong,
.sidebar-brand strong {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

.brand-copy span,
.sidebar-brand span,
.muted {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 20px;
}

.hero-card,
.surface-card,
.panel,
.sidebar,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-xl);
}

.hero-card {
  padding: 40px;
}

.hero-card h1,
.auth-card h1 {
  margin: 0 0 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
}

.hero-card p,
.panel-intro p,
.auth-card p,
.empty-state p {
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 20px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.cta-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.button-secondary,
.button-ghost,
.nav-link {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.button:hover,
.button-secondary:hover,
.button-ghost:hover,
.nav-link:hover,
.sidebar-nav button:hover,
.mini-button:hover {
  transform: translateY(-1px);
}

.button {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.25);
}

.button:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.35);
}

.button-secondary {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.button-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.button-ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

/* ── Metrics ──────────────────────────────────────────────────────── */

.hero-metrics,
.metric-grid,
.insight-grid,
.overview-grid {
  display: grid;
  gap: 12px;
}

.hero-metrics {
  margin-top: 28px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-pill,
.metric-card,
.insight-card {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.metric-pill:hover,
.metric-card:hover,
.insight-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.metric-pill strong,
.metric-card strong,
.insight-card strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.metric-pill span,
.metric-card span,
.insight-card span {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ── Cards & Panels ───────────────────────────────────────────────── */

.surface-card {
  padding: 28px;
}

.stack {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 28px;
}

.panel h2,
.panel h3,
.section-title {
  margin: 0 0 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.panel p.lead,
.section-subtitle {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.feature-list,
.subtle-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li,
.subtle-list li {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.92rem;
  transition: border-color var(--transition);
}

.feature-list li:hover,
.subtle-list li:hover {
  border-color: var(--line-strong);
}

/* ── Auth ─────────────────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  padding: 40px 0 60px;
  display: grid;
  align-content: center;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  align-items: stretch;
}

.auth-card {
  padding: 36px;
}

/* ── Forms ────────────────────────────────────────────────────────── */

.field-grid,
.two-col {
  display: grid;
  gap: 16px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field-help {
  margin: 8px 0 0;
  color: var(--ink-faint);
  font-size: 0.82rem;
}

.field-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.45;
}

.small {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ── Status Banners ───────────────────────────────────────────────── */

.status-banner {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
}

.status-info {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(233, 69, 96, 0.15);
}

.status-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.status-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.15);
}

.modal-status {
  margin-top: 16px;
  margin-bottom: 0;
}

/* ── Portal Layout ────────────────────────────────────────────────── */

.portal-shell {
  padding: 28px 0 48px;
}

.portal-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */

.sidebar {
  padding: 24px;
  position: sticky;
  top: 20px;
  height: fit-content;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin: 24px 0;
}

.sidebar-nav button {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--ink-soft);
  transition: all var(--transition);
}

.sidebar-nav button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  transform: none;
}

.sidebar-nav button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.2);
}

.sidebar-nav button strong {
  display: block;
  font-size: 0.92rem;
}

.sidebar-nav button span {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  opacity: 0.7;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ── Main Column ──────────────────────────────────────────────────── */

.main-column {
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar-card {
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 800;
}

.topbar-card h1 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  letter-spacing: -0.03em;
  color: #fff;
}

/* ── Tables ───────────────────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--ink-faint);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.table td {
  font-size: 0.9rem;
}

/* ── Tags & Chips ─────────────────────────────────────────────────── */

.tag,
.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-soft);
}

.status-chip.paid,
.status-chip.active,
.status-chip.ready {
  background: var(--success-bg);
  color: var(--success);
}

.status-chip.pending,
.status-chip.restricted,
.status-chip.created,
.status-chip.reserved {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-chip.refunded,
.status-chip.canceled,
.status-chip.error {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Grids ────────────────────────────────────────────────────────── */

.card-grid-2,
.card-grid-3 {
  display: grid;
  gap: 16px;
}

.card-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Event Cards ──────────────────────────────────────────────────── */

.event-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  gap: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.event-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.event-card-clickable {
  cursor: pointer;
}

.event-card-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.event-card h3 {
  margin: 0;
  color: #fff;
}

/* ── Ticket / Feed / Summary Rows ─────────────────────────────────── */

.ticket-list {
  display: grid;
  gap: 0;
}

.ticket-row,
.feed-row,
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.summary-row:first-child,
.feed-row:first-child,
.ticket-row:first-child {
  border-top: 0;
}

/* ── Progress Bar ─────────────────────────────────────────────────── */

.bar-track {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ff7e5f);
}

.inline-stat {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ── Empty State ──────────────────────────────────────────────────── */

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.empty-state h3 {
  color: var(--ink-soft);
  margin: 0 0 6px;
}

/* ── Modal ────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 28px;
  z-index: 100;
}

.modal-card {
  width: min(100%, 920px);
  max-height: min(90vh, 880px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  padding: 24px;
}

.modal-card .button[disabled] {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.section-panel {
  padding: 24px;
}

.soft-note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink-soft);
}

.poster-upload-card {
  display: grid;
  gap: 14px;
}

.poster-preview,
.poster-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: var(--bg-elevated);
}

.poster-preview {
  object-fit: cover;
}

.poster-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.poster-empty strong {
  color: var(--ink);
  font-size: 1rem;
}

.poster-empty span {
  display: block;
  margin-top: 8px;
  max-width: 48ch;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field-location {
  position: relative;
}

.location-input-shell {
  position: relative;
}

.location-loading {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 0.78rem;
  pointer-events: none;
}

.location-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.location-option {
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  color: var(--ink);
}

.location-option:first-child {
  border-top: 0;
}

.location-option:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: none;
}

.location-option strong,
.location-option span {
  display: block;
}

.location-option strong {
  font-size: 0.92rem;
}

.location-option span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-top: 3px;
}

.choice-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink-soft);
  font-weight: 700;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.choice-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-pill.active {
  border-color: rgba(233, 69, 96, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Ticket Editor ────────────────────────────────────────────────── */

.ticket-editor {
  display: grid;
  gap: 12px;
}

.ticket-editor-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  background: var(--bg-elevated);
}

/* ── Split Actions ────────────────────────────────────────────────── */

.split-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Mini Button ──────────────────────────────────────────────────── */

.mini-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: all var(--transition);
}

.mini-button:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}

.danger-button {
  border-color: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-bg);
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 1160px) {
  .portal-layout,
  .hero-grid,
  .auth-grid,
  .card-grid-3,
  .card-grid-2,
  .two-col {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .public-shell,
  .auth-shell,
  .portal-shell {
    width: min(calc(100% - 24px), var(--shell-width));
  }

  .topbar-card,
  .public-topbar,
  .auth-topbar,
  .ticket-row,
  .feed-row,
  .summary-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-card {
    padding: 28px;
  }

  .panel,
  .surface-card,
  .auth-card {
    padding: 22px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}
