:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #132238;
  --accent: #0e7490;
  --accent-soft: #cffafe;
  --danger: #b91c1c;
  --muted: #5b6b7f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, #e0f2fe, transparent 35%),
    radial-gradient(circle at 80% 0%, #cffafe, transparent 35%),
    var(--bg);
  color: var(--ink);
}

.hero {
  background: linear-gradient(135deg, #164e63, #0e7490);
  color: white;
  padding: 2rem 1rem;
}

.hero-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.hero p {
  margin: 0.7rem 0 0;
  max-width: 720px;
}

.welcome-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.95rem;
}

.welcome-banner.hidden {
  display: none;
}

.layout {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem 1.5rem;
}

.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.auth-choice {
  border: 1px solid #d7e5ef;
  background: linear-gradient(180deg, #f7fcff 0%, #eef8ff 100%);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.auth-choice h2 {
  margin: 0 0 0.35rem;
}

.auth-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.auth-choice-card {
  display: grid;
  text-align: left;
  gap: 0.25rem;
  border: 1px solid #7ac4d8;
  background: #0e7490;
  color: #ffffff;
  padding: 0.9rem;
  border-radius: 12px;
}

.auth-choice-card-admin {
  background: #1e3a8a;
  border-color: #93c5fd;
}

.auth-choice-title {
  font-size: 1rem;
  font-weight: 700;
}

.auth-choice-subtitle {
  font-size: 0.85rem;
  opacity: 0.95;
}

.auth-required-msg {
  border: 1px dashed #a5c9d8;
  border-radius: 12px;
  background: #f4fbff;
  color: #0f3c4b;
  font-weight: 600;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.9rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin: 0.75rem 0 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  min-width: 0;
}

input,
select,
button {
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 0.55rem 0.6rem;
  font-size: 0.95rem;
  width: 100%;
  min-width: 0;
}

button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border-color: var(--accent);
}

button:hover {
  filter: brightness(1.05);
}

.form-grid {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.list {
  border: 1px solid #dbe1e8;
  border-radius: 12px;
  padding: 0.5rem;
  background: #fbfdff;
  min-height: 70px;
  max-height: 340px;
  overflow-y: auto;
}

.event {
  border: 1px solid #dbe1e8;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  margin: 0.4rem 0;
  padding: 0.55rem;
  font-size: 0.9rem;
  background: #fff;
}

.event.block {
  border-left-color: var(--danger);
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

.status {
  margin-top: 1rem;
  min-height: 1.3rem;
  font-weight: 600;
}

.week-nav {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.calendar-wrap {
  overflow-x: auto;
  border: 1px solid #dbe1e8;
  border-radius: 12px;
  background: #fbfdff;
}

.calendar-grid {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.calendar-grid th,
.calendar-grid td {
  border: 1px solid #e2e8f0;
  padding: 0.4rem;
  vertical-align: top;
  font-size: 0.84rem;
}

.calendar-grid thead th {
  background: #e0f2fe;
  text-align: left;
}

.time-col {
  width: 90px;
  background: #f8fafc;
  font-weight: 600;
}

.slot {
  min-height: 54px;
  border-radius: 8px;
  padding: 0.35rem;
  line-height: 1.25;
}

.slot.available {
  background: #dcfce7;
  color: #14532d;
}

.slot.unavailable {
  background: #fee2e2;
  color: #7f1d1d;
}

.event-chip {
  display: block;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  background: #e2e8f0;
  padding: 0.25rem 0.35rem;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.event-chip.block {
  background: #fecaca;
}

.time-block-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  align-items: center;
}

.time-block-row .remove-time-block-row {
  width: auto;
  padding: 0.45rem 0.7rem;
  background: #ef4444;
  border-color: #ef4444;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
}

.modal-card-sm {
  width: min(480px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.calendar-wrap.compact .slot {
  min-height: 34px;
  padding: 0.22rem;
}

.calendar-wrap.compact .event-chip {
  margin-bottom: 0.18rem;
  padding: 0.16rem 0.24rem;
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: #166534;
}

@media (max-width: 720px) {
  .panel {
    padding: 1rem;
  }

  .auth-choice-grid {
    grid-template-columns: 1fr;
  }
}

/* Microsoft SSO button */
.btn-ms {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  justify-content: center;
  margin-bottom: 0.5rem;
  transition: background 0.15s;
}

.btn-ms:hover {
  background: #f3f3f3;
}

.btn-small {
  width: auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.35);
}

.sso-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0;
  color: #888;
  font-size: 0.8rem;
}

.sso-divider::before,
.sso-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #ddd;
}

/* Primary and secondary buttons */
.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #0d6880;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--ink);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

/* OTP Modal specific */
#otp-verify-section {
  padding: 0.5rem 0;
}

#otp-status {
  margin-top: 0.5rem;
}

.otp-input {
  font-size: 1.2rem;
  letter-spacing: 0.5em;
  text-align: center;
  font-family: monospace;
}

/* My Bookings */
.modal-card-lg {
  width: min(900px, 100%) !important;
}

.my-bookings-list {
  max-height: 500px;
  overflow-y: auto;
}

.booking-group {
  margin-bottom: 1.5rem;
}

.booking-group h4 {
  margin: 0.5rem 0 0.75rem;
  color: var(--accent);
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: 0.5rem;
}

.booking-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.booking-info {
  flex: 1;
}

.booking-info strong {
  display: block;
  margin-bottom: 0.25rem;
}

.booking-actions {
  display: flex;
  gap: 0.5rem;
  white-space: nowrap;
  margin-left: 1rem;
}

.booking-item .btn-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  background: rgba(14, 116, 144, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

.booking-item .btn-small:hover {
  background: var(--accent);
  color: #fff;
}

/* External login banner in tab */
#external-login-banner {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f0f9ff;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--accent-soft);
}

#external-login-banner.hidden {
  display: none;
}

#external-signup-section {
  margin-bottom: 1rem;
}
