/**
 * Styling for BYU Calendar Standalone Portal (`403.byucalendar.com`)
 *
 * Uses BYU Calendar's crisp outlined card aesthetic (`1.5px` slate borders, hard
 * offset shadows, BYU blue accents, readable typography) with responsive grids for
 * desktop and mobile screens.
 */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --border: #1e293b;
  --soft-border: #cbd5e1;
  --byu-blue: #1a73e8;
  --byu-navy: #002e5d;
  --accent-bg: #e8f1fe;
  --mint: #dcfce7;
  --mint-ink: #166534;
  --amber: #fef3c7;
  --amber-ink: #92400e;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --shadow: 0 4px 0 #1e293b;
  --shadow-sm: 0 2px 0 #1e293b;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  scroll-behavior: smooth;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== HEADER & NAVIGATION ==================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--border);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  border-radius: 8px;
  border: 1.5px solid var(--border);
}

.brand-name {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.portal-pill {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--accent-bg);
  color: var(--byu-navy);
  border: 1.5px solid var(--byu-blue);
  border-radius: 999px;
  padding: 2px 8px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: var(--accent-bg);
  color: var(--byu-blue);
}

.maintain-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--byu-navy);
  background: #eff6ff;
  border: 1.5px solid var(--byu-blue);
  border-radius: 999px;
  padding: 6px 13px;
  transition: transform 0.12s, background 0.12s, color 0.12s;
}

.maintain-btn:hover, .maintain-btn.active {
  background: var(--byu-blue);
  color: #ffffff;
  transform: translateY(-1px);
}

.auth-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--mint);
  color: var(--mint-ink);
  border: 1.5px solid #22c55e;
  border-radius: 999px;
  padding: 4px 11px;
}

/* ==================== BUTTONS & INPUTS ==================== */

.btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--byu-blue);
  color: #ffffff;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: #1558b3;
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-card {
  background: #ffffff;
  color: var(--byu-navy);
  border-color: var(--byu-navy);
  box-shadow: 0 2px 0 var(--byu-navy);
  padding: 7px 14px;
  font-size: 0.86rem;
}

.btn-card:hover {
  background: var(--accent-bg);
}

.btn-danger-outline {
  background: #ffffff;
  color: var(--danger);
  border-color: var(--danger);
  padding: 7px 14px;
  font-size: 0.86rem;
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.input-control, input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  width: 100%;
}

.input-control:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--byu-blue);
  outline-offset: 1px;
}

/* ==================== ADMIN RIBBON ==================== */

.admin-ribbon {
  background: linear-gradient(90deg, #dbeafe 0%, #eff6ff 100%);
  border-bottom: 1.5px solid var(--byu-blue);
  padding: 12px 0;
}

.admin-ribbon-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ribbon-eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--byu-navy);
}

.ribbon-note {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.ribbon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== HERO ==================== */

.hero {
  padding: 38px 0 34px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--soft-border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 32px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--byu-blue);
  margin-bottom: 8px;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero-copy h1 span {
  color: var(--byu-blue);
}

.hero-lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.04rem;
  max-width: 560px;
}

.hero-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.stat-pill {
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.stat-pill strong {
  font-size: 1.25rem;
  color: var(--byu-navy);
}

.stat-pill span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-media {
  margin: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hero-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  border-top: 1.5px solid var(--border);
  background: #ffffff;
}

.caption-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--mint);
  color: var(--mint-ink);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #86efac;
}

/* ==================== PUBLIC EVENTS & VENUES ==================== */

.section {
  padding: 40px 0;
}

.section-tinted {
  background: #edf2f8;
  border-top: 1px solid var(--soft-border);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 620px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  width: 280px;
  max-width: 100%;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.toggle-chip input {
  width: auto;
  margin: 0;
}

.category-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chip {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}

.chip.active {
  background: var(--ink);
  color: #ffffff;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
}

.event-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cat-badge {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-bg);
  color: var(--byu-navy);
  border: 1px solid #93c5fd;
  border-radius: 999px;
  padding: 2px 9px;
}

.perk-badge {
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--mint);
  color: var(--mint-ink);
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 2px 8px;
}

.status-badge {
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--amber);
  color: var(--amber-ink);
  border-radius: 999px;
  padding: 2px 8px;
}

.event-card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.event-meta {
  font-size: 0.86rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.event-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Venues grid + 3D map image */
.venues-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 28px;
  align-items: start;
}

.map-frame {
  margin-top: 16px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.map-preview-img {
  display: block;
  width: 100%;
  height: auto;
}

.venues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.venue-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 14px;
}

.venue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.building-code {
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--ink);
  color: #ffffff;
  border-radius: 6px;
  padding: 2px 8px;
}

.venue-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--byu-blue);
}

.venue-card h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.venue-zone {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.venue-notes {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ==================== MAINTAIN WORKSPACE TABLES ==================== */

.maintain-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.maintain-header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.link-back {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--byu-blue);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: block;
  margin-bottom: 8px;
}

.maintain-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.lock-card {
  padding: 36px;
  text-align: center;
  max-width: 520px;
  margin: 24px auto;
}

.table-card {
  overflow: hidden;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border);
  font-size: 0.84rem;
  font-weight: 700;
}

.table-hint {
  color: var(--muted);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  padding: 11px 14px;
  background: #f1f5f9;
  border-bottom: 1.5px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.row-btns {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

/* ==================== MODALS & TOAST ==================== */

.dialog-card {
  border: 2px solid var(--border);
  box-shadow: 0 10px 0 var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(460px, 92vw);
  max-height: 90vh;
  overflow: auto;
}

.dialog-wide {
  width: min(640px, 94vw);
}

.dialog-card::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.icon-close {
  appearance: none;
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-weight: 800;
}

.modal-form {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-help {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.checkbox-field input {
  width: auto;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.detail-body {
  padding: 16px 20px 22px;
}

.detail-body h2 {
  margin: 0 0 10px;
}

.detail-meta {
  margin: 4px 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-desc {
  margin: 14px 0;
  color: var(--muted);
}

.detail-access {
  background: #f8fafc;
  border: 1px solid var(--soft-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  background: var(--ink);
  color: #ffffff;
  border: 1.5px solid #000000;
  box-shadow: var(--shadow-sm);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
}

/* ==================== FOOTER ==================== */

.site-footer {
  border-top: 1.5px solid var(--border);
  background: #ffffff;
  padding: 18px 0;
  margin-top: 24px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-brand, .footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 900px) {
  .hero-grid, .venues-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .search-input {
    width: 100%;
  }
}
