body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; background: #f6f7fb; }
header { background: #111827; color: #fff; padding: 12px 16px; display:flex; justify-content:space-between; align-items:center; }
header a { color: #fff; text-decoration:none; margin-left: 12px; }
main { padding: 16px; max-width: 1100px; margin: 0 auto; }
.card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 8px rgba(0,0,0,.06); margin-bottom: 16px; }
h1,h2 { margin: 0 0 12px; }
label { display:block; margin: 8px 0 4px; }
input, select, button { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; }
button { cursor: pointer; background: #111827; color:#fff; border: none; }
button.secondary { background: #374151; }
table { width:100%; border-collapse: collapse; }
td, th { border-bottom: 1px solid #eef2f7; padding: 10px; vertical-align: middle; text-align: center; }
.badge { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.busy { background:#fee2e2; color:#991b1b; }
.badge.free { background:#dcfce7; color:#166534; }
.small { font-size: 12px; color:#6b7280; }
.grid { overflow:auto; }
.slot { min-width: 140px; }
.slot.free { background: #ecfeff; }
.slot.busy { background: #fef2f2; color:#7f1d1d; }
.slot button { width:100%; }
nav a { margin-right: 10px; }
.notice { padding: 10px 12px; border-radius: 10px; background: #fffbeb; border: 1px solid #f59e0b33; }
.error { padding: 10px 12px; border-radius: 10px; background: #fef2f2; border: 1px solid #ef444433; color:#7f1d1d; }


/* =========================
   Mobile-friendly defaults
   ========================= */
html { font-size: 16px; }
@media (max-width: 600px) {
  html { font-size: 18px; }           /* make everything a bit bigger */
  main { padding: 14px; }
  header { padding: 14px 14px; }
  .card { padding: 14px; }
  table { font-size: 0.95rem; }
  .small { font-size: 0.9rem; }
}

/* Make form controls comfortable on mobile */
input, select, button, textarea {
  font-size: 1rem;
  line-height: 1.2;
}
@media (max-width: 600px) {
  input, select, button, textarea {
    padding: 12px 14px;
  }
  button { width: 100%; }
}

/* Tables: allow horizontal scroll instead of tiny squishing */
.grid, .card { overflow-x: auto; }
table { min-width: 520px; } /* gives breathing room; scrolls on small screens */

/* =========================
   Fix admin Rooms form overlap
   ========================= */
.room-form {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  align-items: end;
}
.room-form .room-form-name,
.room-form .room-form-desc {
  min-width: 0; /* critical: prevent overlap/overflow in grid/flex */
}
.room-form input,
.room-form textarea {
  width: 100%;
  box-sizing: border-box;
}
.room-form textarea { resize: vertical; }

@media (max-width: 900px) {
  .room-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .room-form button { width: 100%; }
  table { min-width: 480px; }
}

.badge.yellow { background:#fffbeb; color:#92400e; }

/* ===== Tooltip ===== */
.tooltip-wrap {
  position: relative;
  display: inline-block;
}

.tooltip-icon {
  display: inline-block;
  margin-left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  cursor: help;
}

.tooltip-box {
  position: absolute;
  left: 50%;
  bottom: 125%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 999;
}

.tooltip-wrap:hover .tooltip-box,
.tooltip-wrap:focus-within .tooltip-box {
  opacity: 1;
}

.tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #111827 transparent transparent transparent;
}

/* Cancelled bookings (My bookings) */
.booking-cancelled {
  opacity: 0.5;
  background: #f9fafb;
}

.booking-cancelled td {
  text-decoration: line-through;
}

/* Booking status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge-active {
  background: #ecfdf5;   /* soft green */
  color: #065f46;
}

.badge-cancelled {
  background: #f3f4f6;   /* light grey */
  color: #6b7280;
}

.badge-past {
  background: #f3f4f6;  /* light grey */
  color: #374151;
}

.booking-past {
  opacity: 0.75;
}

/* =========================
   Admin Rooms: inline editor
   ========================= */
.room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.room-actions form {
  margin: 0;
}

details.room-edit summary {
  cursor: pointer;
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  user-select: none;
}

details.room-edit[open] summary {
  background: #f9fafb;
}

details.room-edit summary::-webkit-details-marker {
  display: none;
}

details.room-edit form {
  margin-top: 10px;
}

details.room-edit input,
details.room-edit textarea {
  width: 100%;
  box-sizing: border-box;
}

details.room-edit textarea {
  resize: vertical;
}

/* =========================
   Calendar table
   ========================= */
table.cal {
  width: 100%;
  border-collapse: collapse;
}

table.cal th,
table.cal td {
  border: 1px solid #eef2f7;
  padding: 10px;
  width: 14.285%;
  vertical-align: top;
}

/* Outside current month */
table.cal td.out {
  background: #f9fafb;
  color: #9ca3af;
}

/* Availability levels */
table.cal td.green {
  background: #ecfdf5;
}

table.cal td.yellow {
  background: #fffbeb;
}

table.cal td.red {
  background: #fef2f2;
}

/* Day number */
table.cal td .daynum {
  font-weight: 800;
}

table.cal a {
  text-decoration: none;
}

/* =========================
   TODAY (hard override)
   ========================= */
table.cal td.today {
  position: relative !important;
  outline: 4px solid #2563eb !important;
  outline-offset: -4px !important;
}

/* Today number pill */
table.cal td.today .daynum a {
  display: inline-block !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  text-decoration: none !important;
}

/* =========================
   Current day button
   ========================= */
.btn-current-day {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  font-weight: 700;
  text-decoration: none;
  color: inherit;
}

.btn-current-day:hover {
  background: #f9fafb;
}
