:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.78);
  --text: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #0f766e;
  --primary-2: #0ea5e9;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
  --radius: 8px;
}

[data-theme="dark"] {
  --bg: #101318;
  --surface: #181d24;
  --surface-2: rgba(24, 29, 36, 0.82);
  --text: #f8fafc;
  --muted: #aab3c2;
  --line: #2f3745;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

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

.brand-mark,
.room-icon {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.btn {
  border-radius: var(--radius);
  font-weight: 700;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: #115e59;
  --bs-btn-hover-border-color: #115e59;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--surface);
}

.hero {
  color: #fff;
  background:
    linear-gradient(90deg, rgba(10, 15, 23, 0.88), rgba(10, 15, 23, 0.32)),
    url("https://images.unsplash.com/photo-1523580846011-d3a5bc25702b?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.hero-inner {
  min-height: 430px;
  display: grid;
  grid-template-columns: 1fr;
  align-content: end;
  gap: 24px;
  padding-top: 72px;
  padding-bottom: 36px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 12vw, 6.5rem);
  font-weight: 900;
  line-height: 0.95;
}

.hero-text {
  max-width: 620px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

.eyebrow {
  color: var(--primary-2);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero .eyebrow { color: #67e8f9; }

.hero-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 640px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

.hero-panel > div {
  padding: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-panel > div:last-child { border-right: 0; }
.metric { display: block; font-size: 1.8rem; font-weight: 900; }
.label { color: rgba(255, 255, 255, 0.78); font-size: 0.85rem; }

.app-shell { padding-top: 22px; padding-bottom: 42px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.06);
}

.search-box input {
  width: 100%;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.room-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

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

.room-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.room-title { margin: 0; font-size: 1.24rem; font-weight: 900; }
.university-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; padding: 0; list-style: none; }
.chip {
  max-width: 100%;
  padding: 6px 9px;
  color: var(--text);
  background: color-mix(in srgb, var(--line), transparent 38%);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.quota-block { margin-top: auto; }
.quota-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.progress { height: 10px; background: color-mix(in srgb, var(--line), transparent 24%); border-radius: 999px; }
.progress-bar { background: var(--room-color, var(--primary)); transition: width 360ms ease; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}
.status-Available { background: var(--success); }
.status-Almost { background: var(--warning); }
.status-Full { background: var(--danger); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.48);
}

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 90;
  width: min(720px, 100%);
  max-height: 92vh;
  padding: 10px 18px 22px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow);
  transform: translate(-50%, 110%);
  transition: transform 220ms ease;
}

.bottom-sheet.open {
  transform: translate(-50%, 0);
}

.sheet-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 12px;
  background: var(--line);
  border-radius: 999px;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sheet-header h2 { margin: 0; font-size: 1.35rem; font-weight: 900; }
.registration-form { margin-top: 16px; }
.form-control, .form-select {
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--line);
}

.footer {
  padding: 24px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.skeleton > * {
  background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--line), transparent 60%), var(--line));
  background-size: 220% 100%;
  animation: shimmer 1.1s infinite linear;
}
.skeleton-icon { width: 48px; height: 48px; border-radius: var(--radius); }
.skeleton-line { height: 16px; margin-top: 18px; border-radius: 999px; }
@keyframes shimmer { to { background-position: -220% 0; } }

@media (min-width: 768px) {
  .hero-inner {
    grid-template-columns: 1.08fr 0.92fr;
    align-items: end;
  }
  .hero-panel { justify-self: end; }
}

@media (max-width: 575.98px) {
  .hero-inner { min-height: 390px; }
  .hero-panel > div { padding: 14px 10px; }
  .metric { font-size: 1.34rem; }
  .floating-action {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    box-shadow: var(--shadow);
  }
}
