:root {
  --blue: #1CADE4;
  --blue-dark: #128CBB;
  --yellow: #FFD34D;
  --ink: #1C1C28;
  --gray: #5B6072;
  --cream: #F5EFE0;
  --pastel-orange: #FBD9A6;
  --pastel-orange-dark: #E8A951;
  --pastel-green: #CFEACB;
  --pastel-green-dark: #6FBE68;
  --pastel-blue: #D8F0FB;
  --pastel-blue-dark: #4FB8E8;
  --pastel-yellow: #FCEEC2;
  --pastel-yellow-dark: #E8C24F;
  --pastel-purple: #E4DEFB;
  --pastel-purple-dark: #8B6FEA;
  --red: #E53935;
  --radius: 22px;
  --pill: 999px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

h1, h2, h3 { font-weight: 800; margin: 0; }

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

.arrow { color: var(--blue); font-weight: 700; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: var(--blue);
}

.logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo .dot { color: var(--ink); }

.live-dot-logo {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red);
  animation: pulse 1.2s infinite;
}

.btn-pill {
  background: var(--yellow);
  color: var(--ink);
  padding: 12px 26px;
  border-radius: var(--pill);
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 15px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn-pill:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.2); }

.btn-pill.blue { background: var(--blue); color: white; }
.btn-pill.blue:hover { box-shadow: 0 6px 16px rgba(28,173,228,.4); }
.btn-pill.outline { background: transparent; border: 2px solid var(--ink); color: var(--ink); }
.btn-pill.interested-active { background: var(--yellow); border-color: var(--yellow); }

/* ---------- Auth ---------- */
.header-right { display: flex; align-items: center; gap: 14px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; box-shadow: 0 1px 4px rgba(20,30,60,.1);
  transition: transform .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn.active { background: var(--yellow); }

.auth-not-configured { font-size: 12px; color: rgba(28,28,40,.55); font-weight: 600; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.5); border-radius: var(--pill); padding: 4px 6px 4px 4px;
}
.user-avatar { width: 30px; height: 30px; border-radius: 50%; }
.user-name { font-weight: 700; font-size: 14px; color: var(--ink); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .btn-pill { padding: 6px 14px; font-size: 13px; }

.interest-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: #F1F5F9;
  cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease; color: var(--gray);
}
.interest-btn:hover { background: var(--pastel-yellow); }
.interest-btn.interested-active { background: var(--pastel-yellow-dark); color: white; }

.row-live-badge {
  background: var(--red); color: white; font-size: 9px; font-weight: 800; padding: 2px 6px;
  border-radius: var(--pill); letter-spacing: .3px;
}

/* ---------- Page heading ---------- */
.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px 40px 4px;
}

.page-heading h1 { font-size: 30px; color: var(--blue); }
.page-heading .count { font-size: 14px; color: var(--gray); font-weight: 700; }

/* ---------- Filters ---------- */
.filters-section {
  padding: 18px 40px 6px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  padding: 12px 20px;
  border-radius: var(--pill);
  border: none;
  background: white;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  color: var(--ink);
  transition: all .15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(20,30,60,.06);
}

.chip:hover { box-shadow: 0 4px 10px rgba(20,30,60,.12); }
.chip.active { background: var(--ink); color: white; }

.filter-badge {
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-dropdown { position: relative; display: inline-block; }

.dropdown-btn { background: white; color: var(--ink); }
.dropdown-btn:has(+ .dropdown-panel:not([hidden])) { background: var(--pastel-blue); }

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 16px;
  padding: 10px;
  min-width: 190px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 12px 30px rgba(20,30,60,.18);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dropdown-panel[hidden] { display: none; }

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-option:hover { background: #F1F5F9; }
.dropdown-option input { margin: 0; }

/* ---------- Live Now section ---------- */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.live-section {
  margin: 20px 40px 0;
  padding: 4px 0 0;
}

.live-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--red);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: white;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--pill);
}

.live-count { font-size: 14px; color: var(--gray); font-weight: 700; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: white; animation: pulse 1.2s infinite; flex-shrink: 0; }

.live-grid { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

.live-card {
  background: white;
  border-radius: 20px;
  padding: 16px 18px;
  border: 3px solid var(--red);
  box-shadow: 0 6px 18px rgba(229,57,53,.12);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform .15s ease;
}
.live-card:hover { transform: translateY(-2px); }

/* ---------- Avatars ---------- */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.avatar.orange { background: var(--pastel-orange); }
.avatar.green { background: var(--pastel-green); }
.avatar.blue { background: var(--pastel-blue); }
.avatar.yellow { background: var(--pastel-yellow); }
.avatar.purple { background: var(--pastel-purple); }

/* ---------- Event list (grouped by date) ---------- */
.events-section { padding: 24px 40px 60px; }

.date-group { margin-bottom: 6px; }

.date-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 2px 10px;
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 2px solid #E7E0CC;
  margin-bottom: 10px;
}
.date-heading .count { font-weight: 600; font-size: 13px; color: var(--gray); text-transform: none; letter-spacing: 0; }

.event-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 20px;
  margin-bottom: 10px;
  background: white;
  box-shadow: 0 1px 4px rgba(20,30,60,.05);
  transition: box-shadow .15s ease, transform .15s ease;
}
.event-row:hover { box-shadow: 0 6px 16px rgba(20,30,60,.1); transform: translateY(-1px); }

.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-meta { font-size: 13px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-tags { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; margin-top: 2px; }

.row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.cal-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: #F1F5F9;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.cal-btn:hover { background: var(--pastel-blue); }

.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 4px 10px;
  border-radius: var(--pill);
  background: #F1F5F9;
  color: var(--gray);
  flex-shrink: 0;
  white-space: nowrap;
}

.tag-pill.freefood { background: #FDECC8; color: #B9770E; }
.tag-pill.networking { background: #E4DEFB; color: #6C3CE9; }
.tag-pill.social { background: #FDE0D0; color: #D2691E; }
.tag-pill.sebe { background: #D8F0FB; color: var(--blue-dark); }
.tag-pill.artsed { background: #FBD8E3; color: #C2185B; }
.tag-pill.buslaw { background: #E1E6FA; color: #3A4A9E; }
.tag-pill.health { background: #FDE2E1; color: #C0392B; }
.tag-pill.club { background: #DDF2D9; color: #3C8C4A; }
.tag-pill.campus-pill { background: #E7E9F0; color: #4A4E69; }
.tag-pill.cost-free { background: #DDF2D9; color: #2E7D32; }
.tag-pill.cost-paid { background: #FBD8E3; color: #AD1457; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }

/* ---------- Event detail page ---------- */
.detail-wrap { max-width: 720px; margin: 0 auto; padding: 40px 20px 80px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--blue); margin-bottom: 20px; }

.detail-card {
  border-radius: 28px;
  overflow: hidden;
  background: white;
  box-shadow: 0 10px 30px rgba(20,30,60,.08);
}
.detail-card.live { border: 3px solid var(--red); }

.detail-banner { height: 140px; display: flex; align-items: center; justify-content: center; font-size: 56px; }
.detail-banner.orange { background: var(--pastel-orange); }
.detail-banner.green { background: var(--pastel-green); }
.detail-banner.blue { background: var(--pastel-blue); }
.detail-banner.yellow { background: var(--pastel-yellow); }
.detail-banner.purple { background: var(--pastel-purple); }

.detail-body { padding: 30px 32px 36px; }
.detail-body h1 { font-size: 28px; color: var(--ink); margin-bottom: 6px; }

.hosted-by { color: var(--gray); font-size: 15px; font-weight: 600; margin: 0 0 14px; }

.detail-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; color: var(--gray); font-size: 15px; }
.detail-meta span strong { color: var(--ink); }

.detail-desc { color: var(--gray); line-height: 1.7; margin-bottom: 26px; }

.rsvp-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- Admin page ---------- */
.admin-wrap { max-width: 640px; margin: 0 auto; padding: 40px 20px 80px; }
.admin-wrap h1 { color: var(--blue); font-size: 28px; margin-bottom: 6px; }
.admin-wrap p.sub { color: var(--gray); margin-bottom: 30px; }

.form-group { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-weight: 700; font-size: 14px; }
.form-group input, .form-group textarea, .form-group select {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #E3E8EE;
  font-size: 15px;
  font-family: inherit;
  background: white;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--blue); }

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-chip { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--pill); border: 2px solid #E3E8EE; font-size: 13px; font-weight: 600; cursor: pointer; background: white; }
.checkbox-chip input { margin: 0; }
.checkbox-chip:has(input:checked) { border-color: var(--blue); background: var(--pastel-blue); }

.color-grid { display: flex; gap: 10px; }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.color-swatch.orange { background: var(--pastel-orange-dark); }
.color-swatch.green { background: var(--pastel-green-dark); }
.color-swatch.blue { background: var(--pastel-blue-dark); }
.color-swatch.yellow { background: var(--pastel-yellow-dark); }
.color-swatch.purple { background: var(--pastel-purple-dark); }
.color-swatch.selected { border-color: var(--ink); }

.icon-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-swatch {
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer; border: 2px solid #E3E8EE;
  display: flex; align-items: center; justify-content: center; font-size: 20px; background: white;
}
.icon-swatch.selected { border-color: var(--blue); background: var(--pastel-blue); }

.admin-list { margin-top: 50px; }
.admin-list h2 { font-size: 20px; color: var(--blue); margin-bottom: 16px; }
.admin-event-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: white; border-radius: 14px; margin-bottom: 10px;
}
.admin-event-row .name { font-weight: 700; }
.admin-event-row .del-btn { background: #FBD8E3; color: #C2185B; border: none; border-radius: var(--pill); padding: 6px 14px; font-weight: 700; cursor: pointer; font-size: 13px; }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; padding: 14px 26px; border-radius: var(--pill);
  font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- Add to Calendar modal ---------- */
.cal-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(20,20,30,.45); z-index: 200;
}

.cal-modal {
  display: none;
  flex-direction: column;
  gap: 10px;
  position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: white;
  border-radius: 20px;
  padding: 26px 28px;
  width: min(90vw, 380px);
  z-index: 201;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.cal-modal h3 { font-size: 18px; }
.cal-modal-sub { color: var(--gray); font-size: 14px; margin: 0 0 6px; }
.cal-option {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 14px; border: 2px solid #E3E8EE;
  font-weight: 700; font-size: 15px; background: white; cursor: pointer; color: var(--ink);
}
.cal-option:hover { border-color: var(--blue); background: var(--pastel-blue); }
.cal-cancel {
  background: none; border: none; color: var(--gray); font-weight: 600; cursor: pointer;
  padding: 8px; font-size: 14px;
}

.site-footer {
  text-align: center;
  padding: 40px 20px 30px;
  margin-top: 20px;
  border-top: 1px solid #EAE2CC;
}

.footer-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.footer-about {
  max-width: 560px;
  margin: 0 auto 16px;
}

.footer-about summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--gray);
  list-style: none;
  display: inline-block;
}
.footer-about summary::-webkit-details-marker { display: none; }
.footer-about summary::after { content: ' \25be'; }
.footer-about[open] summary::after { content: ' \25b4'; }

.footer-note {
  margin: 14px 0 16px;
  color: var(--gray);
  font-size: 14px;
  line-height: 1.6;
}

.acknowledgement {
  margin: 0;
  color: var(--gray);
  font-size: 12px;
  line-height: 1.6;
}

.footer-copy { color: var(--gray); font-size: 12px; margin: 0; }

.footer-version { color: rgba(91,96,114,.6); font-size: 11px; margin: 6px 0 0; font-family: monospace; }

.feedback-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #E3E8EE;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.feedback-textarea:focus { outline: none; border-color: var(--blue); }

@media (max-width: 640px) {
  .site-header { padding: 14px 20px; }
  .page-heading, .filters-section, .events-section { padding-left: 20px; padding-right: 20px; }
  .live-section { margin-left: 20px; margin-right: 20px; }
  .form-row { flex-direction: column; }
}
