/* ============================================================
   IITJ Student Fun — theme tokens
   Deep-navy night sky, gold arch monument, violet circuitry.
   ============================================================ */
:root {
  --bg-0: #06050d;
  --bg-1: #0d0b1f;
  --bg-2: #14112b;

  --panel: rgba(22, 18, 40, 0.72);
  --panel-solid: #171331;
  --panel-strong: #1c1738;
  --border: #352a5e;
  --border-soft: rgba(139, 108, 240, 0.28);

  --gold-1: #ffe19a;
  --gold-2: #f2a93c;
  --gold-3: #d97f27;

  --purple-1: #9b7cf2;
  --purple-2: #6c4fd6;
  --blue-node: #5b9dfb;

  --text: #f4efe6;
  --muted: #b0a6d4;
  --muted-dim: #8577ab;

  --danger-1: #ef6a72;
  --danger-2: #c0424a;
  --success: #7fd88f;

  --radius: 14px;
  --radius-sm: 9px;

  --font-display: "Cinzel", "Marcellus", Georgia, serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--text);
}

body {
  background:
    radial-gradient(ellipse 900px 500px at 18% -10%, rgba(107, 79, 214, 0.30), transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 0%, rgba(217, 127, 39, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

/* starfield */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 32% 68%, #fff, transparent 60%),
    radial-gradient(1px 1px at 52% 24%, #ffe19a, transparent 60%),
    radial-gradient(1.5px 1.5px at 68% 82%, #fff, transparent 60%),
    radial-gradient(1px 1px at 78% 12%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 44%, #ffe19a, transparent 60%),
    radial-gradient(1px 1px at 6% 52%, #fff, transparent 60%),
    radial-gradient(1px 1px at 44% 88%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 95% 70%, #fff, transparent 60%),
    radial-gradient(1px 1px at 24% 40%, #fff, transparent 60%);
  background-repeat: no-repeat;
}

/* faint campus skyline strip at the foot of the page */
body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 120px;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(0deg, rgba(6,5,13,0.9), transparent),
    repeating-linear-gradient(90deg, rgba(139,108,240,0.10) 0 2px, transparent 2px 48px);
  mask-image: linear-gradient(180deg, transparent, #000 60%);
}

#app, .dash { position: relative; z-index: 1; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* -------------------- brand header -------------------- */
.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 22px;
}

.brand-header img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: 10px;
  box-shadow: 0 0 0 1px var(--border-soft), 0 0 24px rgba(242, 169, 60, 0.25);
}

.brand-header .brand-name {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.brand-header .brand-fun {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 1px;
}

.brand-header .brand-tag {
  margin-top: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple-1);
}

/* -------------------- card -------------------- */
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.2),
    0 24px 60px -20px rgba(0,0,0,0.65),
    0 0 40px -12px rgba(107, 79, 214, 0.35);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 14px; right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
  opacity: 0.8;
}

.card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  text-align: center;
}

.card p.subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
  text-align: center;
}

/* -------------------- forms -------------------- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(9, 8, 20, 0.6);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

.field input:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(242, 169, 60, 0.18);
}

button {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  color: #241305;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 4px;
  transition: filter 0.15s ease, transform 0.05s ease;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

button.secondary {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
}
button.secondary:hover { background: var(--panel-solid); border-color: var(--purple-1); filter: none; }

button.danger {
  background: linear-gradient(120deg, var(--danger-1), var(--danger-2));
  color: #2a0c0f;
}
button.danger:hover { filter: brightness(1.1); }

.error-msg {
  background: rgba(192, 66, 74, 0.16);
  border: 1px solid rgba(239, 106, 114, 0.35);
  color: #ffb0b5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

.status-msg { font-size: 0.85rem; margin-top: 8px; display: none; }
.status-msg.success { color: var(--success); }
.status-msg.error { color: #ffb0b5; }

/* -------------------- tabs -------------------- */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-row button {
  margin-top: 0;
  background: var(--panel-strong);
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 9px;
}

.tab-row button.active {
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  color: #241305;
  border-color: transparent;
}

.tab-row button .tab-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--purple-2);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.tab-row button.active .tab-badge { background: rgba(36, 19, 5, 0.25); color: #241305; }

.tab-panel { }

.hidden { display: none !important; }

/* -------------------- form field grid -------------------- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* -------------------- user picker (searchable multi-select) -------------------- */
.user-picker {
  position: relative;
}

.user-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.user-picker-chips.empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.8rem;
  padding: 5px 6px 5px 10px;
  border-radius: 999px;
}

.chip button {
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.chip button:hover { color: var(--danger-1); filter: none; }

.user-picker-input-wrap { position: relative; }

.user-picker-search {
  margin: 0;
}

.user-picker-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  padding: 6px;
}

.user-picker-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0;
  cursor: pointer;
}
.user-picker-option:hover { background: var(--panel-strong); filter: none; }

.user-picker-option-sub {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--muted);
}

.user-picker-empty {
  padding: 10px 9px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* -------------------- meeting frame -------------------- */
.meeting-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

.meeting-container iframe,
.meeting-container whereby-embed {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  z-index: 10;
  pointer-events: none;
}

.top-bar button {
  pointer-events: auto;
  width: auto;
  padding: 6px 14px;
  font-size: 0.8rem;
  background: rgba(14, 12, 28, 0.85);
  color: var(--text);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(6px);
}

/* Masks Whereby's own "Powered by Whereby" strip, which renders inside
   their (cross-origin) iframe and can't be targeted directly. Sits above
   the iframe but below our own top-bar buttons, and never intercepts
   clicks. Tweak the height if Whereby changes their bar's size. */
.whereby-brand-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  z-index: 5;
  pointer-events: none;
  background: var(--bg-0);
}

.maintenance-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(242, 169, 60, 0.5));
}

.link-row {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-row a { color: var(--purple-1); text-decoration: none; }
.link-row a:hover { text-decoration: underline; color: var(--gold-2); }

/* -------------------- dashboards (admin / staff / profile) -------------------- */
.dash {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 20px 60px;
}

.dash h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.dash p.subtitle { color: var(--muted); margin-bottom: 28px; }

.panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 16px 40px -24px rgba(0,0,0,0.6);
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  color: var(--gold-1);
}

.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.row .desc { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.desc { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

a { color: var(--purple-1); }

::selection { background: rgba(242, 169, 60, 0.35); }

/* -------------------- portal shell (room picker) -------------------- */
.portal-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 8, 22, 0.55);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.portal-brand { display: flex; align-items: center; gap: 12px; }
.portal-brand img {
  width: 38px; height: 38px; border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-soft), 0 0 16px rgba(242,169,60,0.25);
}
.portal-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.portal-brand-text .name {
  font-family: var(--font-display); font-size: 0.92rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text);
}
.portal-brand-text .fun {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.portal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-actions button { width: auto; padding: 8px 14px; font-size: 0.82rem; margin-top: 0; }

.portal-main {
  flex: 1;
  padding: 36px 28px 60px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.portal-main h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.portal-main p.subtitle { color: var(--muted); margin-bottom: 26px; text-align: left; }

/* -------------------- room grid / cards -------------------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.room-card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 16px 40px -28px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
}

.room-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple-1);
  box-shadow: 0 20px 44px -20px rgba(107, 79, 214, 0.4);
}

.room-card-banner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(120deg, var(--purple-2), var(--purple-1));
  position: relative;
}

.room-card.staff-only .room-card-banner {
  background: linear-gradient(120deg, var(--gold-3), var(--gold-2));
}

.room-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.room-card-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  color: var(--text);
}
.room-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.room-card-join { font-size: 0.78rem; color: var(--purple-1); font-weight: 700; letter-spacing: 0.02em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-open {
  background: rgba(127, 216, 143, 0.15);
  color: var(--success);
  border: 1px solid rgba(127, 216, 143, 0.35);
}
.badge-staff {
  background: rgba(242, 169, 60, 0.16);
  color: var(--gold-2);
  border: 1px solid rgba(242, 169, 60, 0.35);
}

/* -------------------- announcement banners -------------------- */
.announce-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.announce-banner {
  position: relative;
  background: linear-gradient(120deg, rgba(242,169,60,0.14), rgba(155,124,242,0.10));
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold-2);
  border-radius: var(--radius-sm);
  padding: 12px 40px 12px 16px;
  backdrop-filter: blur(10px);
}
.announce-banner-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gold-2); margin-bottom: 4px;
}
.announce-banner-title {
  font-family: var(--font-display); font-size: 0.95rem; color: var(--text); margin-bottom: 3px;
}
.announce-banner-message { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.announce-banner-dismiss {
  position: absolute; top: 8px; right: 8px; width: auto; margin-top: 0;
  background: none; border: none; color: var(--muted); font-size: 1rem;
  padding: 4px 8px; cursor: pointer; line-height: 1;
}
.announce-banner-dismiss:hover { color: var(--text); filter: none; }

.meeting-announce-overlay {
  position: fixed;
  top: 54px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 480px;
}
.meeting-announce-overlay .announce-banner {
  pointer-events: auto;
  background: rgba(14, 12, 28, 0.92);
  box-shadow: 0 12px 30px -14px rgba(0,0,0,0.7);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
