/* ── Brand palette (zilverwerkt.nl) ──────────────────────────────────────────
   --navy:       #232342  (logo black — primary text)
   --dark:       #3b383c  (darkslategray — secondary dark)
   --oldlace:    #ebebdc  (page & modal background)
   --steelblue:  #3f75bb  (primary action)
   --olive:      #627846  (available / free)
   --indianred:  #a75f56  (occupied / error)
   --gray:       #7c8c8c  (secondary text)
   --silver:     #b6cec2  (logo silver — soft accent)
   --steellight: #bcc2d0  (lightsteelblue — subtle blue)
   --burlywood:  #ac8a52  (warm golden accent)
── */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #ebebdc;
  color: #232342;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #fff;
  border-bottom: 1px solid #d9d8ce;
  padding: 0.85rem 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

header h1 { font-size: 1.2rem; font-weight: 700; color: #232342; }

.header-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

#current-date {
  font-size: 1rem;
  font-weight: 700;
  min-width: 220px;
  text-align: center;
  text-transform: capitalize;
  color: #232342;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

#last-updated { font-size: 0.78rem; color: #7c8c8c; }

/* ── Room grid ── */
#rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Room card ── */
.room-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 2px 8px rgba(35,35,66,.07);
  border-left: 6px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s;
  min-width: 0;
}

.room-card:hover { transform: translateY(-2px); }
.room-card.available { border-left-color: #627846; background: #f4f6f0; }
.room-card.occupied  { border-left-color: #a75f56; background: #faf2f1; }
.room-card.scheduled { border-left-color: #3f75bb; }
.room-card.error     { border-left-color: #ac8a52; }

/* ── Card header ── */
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.room-name { font-size: 1.1rem; font-weight: 700; color: #232342; }

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge.available { background: #dce8d4; color: #4a5c35; }
.status-badge.occupied  { background: #f0d8d6; color: #7a3c35; }
.status-badge.scheduled { background: #d4e2f0; color: #2a5490; }

/* ── Card footer ── */
.card-footer {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e0dfd5;
}

/* ── Meeting rows ── */
.meeting-row {
  font-size: 0.83rem;
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
  line-height: 1.5;
  padding: 0.15rem 0;
}

.meeting-row.meeting-now {
  background: rgba(172,138,82,.15);
  border-radius: 5px;
  padding: 0.25rem 0.4rem;
  margin: 0 -0.4rem;
}

.meeting-time {
  font-size: 0.78rem;
  color: #7c8c8c;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meeting-now .meeting-time { color: #7a5a20; font-weight: 600; }

.meeting-subject { font-weight: 500; color: #232342; }

.meeting-booker {
  grid-column: 2;
  color: #7c8c8c;
  font-style: italic;
  font-size: 0.78rem;
}

.no-meetings { color: #b6cec2; font-style: italic; }

.meeting-row[data-event-id] {
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.1s;
}
.meeting-row[data-event-id]:hover { background: rgba(35,35,66,.05); }
.meeting-row.meeting-now[data-event-id]:hover { background: rgba(172,138,82,.25); }

/* ── Detail full-screen modal ── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: #ebebdc;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 5vw, 3rem);
  overflow-y: auto;
}

.detail-overlay[hidden] { display: none; }

.detail-close-btn {
  align-self: flex-end;
  background: rgba(35,35,66,0.1);
  color: #3b383c;
  font-size: 1rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 2rem;
  flex-shrink: 0;
}

.detail-close-btn:hover { background: rgba(35,35,66,0.18); opacity: 1; }

.detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2.5vw, 1.25rem);
  max-width: 700px;
}

/* 1. Room name — Large */
.detail-room-name {
  font-size: clamp(1.3rem, 4.5vw, 2.2rem);
  font-weight: 700;
  color: #232342;
}

/* 2. Date + time — Normal */
.detail-datetime {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.detail-date {
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  font-weight: 400;
  color: #7c8c8c;
  text-transform: capitalize;
}

.detail-time-val {
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  font-weight: 600;
  color: #3f75bb;
}

/* 3. Meeting name — XL */
.detail-subject {
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 800;
  line-height: 1.05;
  color: #232342;
  word-break: break-word;
}

/* 4. Booker — Normal */
.detail-organizer-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.detail-meta-label {
  font-size: clamp(0.65rem, 1.8vw, 0.78rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #7c8c8c;
}

.detail-meta-value {
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  font-weight: 400;
  color: #232342;
}

/* 5. Guest names / meeting details — XL */
.detail-guests,
.detail-body {
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 800;
  line-height: 1.05;
  color: #3b383c;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ── Loading & error ── */
.loading, .error-banner {
  grid-column: 1 / -1;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.loading { color: #7c8c8c; text-align: center; padding: 3rem; }

.error-banner {
  background: #f0d8d6;
  border: 1px solid #c9908a;
  color: #7a3c35;
}

/* ── Buttons ── */
button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.15s;
}

button:hover:not(:disabled) { opacity: 0.8; }
button:disabled { opacity: 0.35; cursor: default; }

.nav-btn  { background: #e8e7de; color: #232342; padding: 0.4rem 0.8rem; font-size: 1rem; }
#refresh-btn { background: #d4e2f0; color: #2a5490; }

/* ── Book button ── */
.book-btn {
  width: 100%;
  background: #bcc2d0;
  color: #232342;
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35,35,66,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: #ebebdc;
  border-radius: 20px;
  padding: 1.75rem 1.75rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(35,35,66,.22);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.modal-header h2 { font-size: 1.05rem; font-weight: 700; line-height: 1.3; color: #232342; }

.modal-close-btn {
  background: rgba(35,35,66,0.08);
  color: #3b383c;
  font-size: 0.9rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.modal-close-btn:hover { background: rgba(35,35,66,0.15); opacity: 1; }

/* ── Form ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #3b383c;
}

.form-group input,
.form-group select {
  border: 1px solid #b6cec2;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: #232342;
  background: #fff;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3f75bb;
  box-shadow: 0 0 0 3px rgba(63,117,187,0.15);
}

.booking-error {
  background: #f0d8d6;
  color: #7a3c35;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.form-actions button[type="button"] { background: rgba(35,35,66,0.1); color: #232342; border-radius: 10px; }
.btn-primary { background: #3f75bb; color: #fff; border-radius: 10px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  header { grid-template-columns: 1fr; padding: 0.75rem 1rem; }
  .header-center, .header-right { justify-content: center; }
  #rooms-grid { padding: 1rem; gap: 1rem; }
  .modal { border-radius: 16px; padding: 1.25rem; }
  .form-row { grid-template-columns: 1fr 1fr; }
}
