/* ═══════════════════════════════════════════════════════════════════════════
   MMU Hostel Booking System – Global Stylesheet
   Separation of Concerns: ALL visual rules live here, zero inline styles
   in JS except dynamic values (colors from data, widths from percentages).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Design Tokens) ─────────────────────────────── */
:root {
  --g:      #1a5c38;   /* MMU primary green  */
  --gl:     #2d7a4f;   /* MMU green light    */
  --dark:   #0f3520;   /* MMU dark green     */
  --gold:   #c9961a;   /* MMU gold           */
  --goldf:  #f0b429;   /* MMU gold bright    */
  --cream:  #fdf9f0;   /* Background cream   */
  --radius: .625rem;
  --shadow: 0 4px 24px rgba(26,92,56,.10);
  --shadow-hover: 0 8px 32px rgba(26,92,56,.18);
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--cream);
  color: #1f2937;
  min-height: 100vh;
}

h1, h2, h3, .serif {
  font-family: 'Playfair Display', serif;
}

/* ── Colour Utilities ────────────────────────────────────────────────────── */
.bg-g      { background-color: var(--g); }
.bg-dark   { background-color: var(--dark); }
.bg-gold   { background-color: var(--gold); }
.text-g    { color: var(--g); }
.text-gold { color: var(--gold); }

/* ── Card & Shadows ──────────────────────────────────────────────────────── */
.shadow-card  { box-shadow: var(--shadow); }
.shadow-hover { transition: box-shadow .2s, transform .2s; }
.shadow-hover:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

/* ── Status Badges ───────────────────────────────────────────────────────── */
.badge-ok   { background: #dcfce7; color: #166534; }
.badge-err  { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ── Availability Urgency Badges ─────────────────────────────────────────── */
.avail-high   { background: #dcfce7; color: #166534; }   /* 5+ rooms */
.avail-medium { background: #fef3c7; color: #92400e; }   /* 2–4 rooms */
.avail-low    { background: #fee2e2; color: #991b1b; }   /* 1 room */
.avail-none   { background: #f3f4f6; color: #9ca3af; }   /* 0 rooms */

/* ── Form Inputs ─────────────────────────────────────────────────────────── */
.inp {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  transition: border-color .15s, background .15s;
  background: #fff;
}
.inp:focus {
  outline: 2px solid var(--g);
  outline-offset: 1px;
}
.inp.ok  { border-color: #16a34a; background: #f0fdf4; }
.inp.bad { border-color: #dc2626; background: #fff5f5; }

.inp-dark {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: #fff;
  padding: .65rem .75rem;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.inp-dark:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--gold);
  outline: none;
}
.inp-dark::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.lbl {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  margin-bottom: .2rem;
}

/* ── Price Range Slider ─────────────────────────────────────────────────── */
.range-inp {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--g), var(--gold));
  outline: none;
  cursor: pointer;
}
.range-inp::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--g);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(26,92,56,.35);
  cursor: pointer;
}
.range-inp::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--g);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(26,92,56,.35);
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-g {
  background: var(--g);
  color: #fff;
  border-radius: var(--radius);
  padding: .55rem 1.25rem;
  font-weight: 700;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  transition: opacity .15s;
  border: none;
  cursor: pointer;
}
.btn-g:hover    { opacity: .88; }
.btn-g:disabled { opacity: .5; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: #fff;
  border-radius: var(--radius);
  padding: .55rem 1.25rem;
  font-weight: 700;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.btn-gold:hover { background: var(--goldf); }

.btn-out {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
  border-radius: var(--radius);
  padding: .5rem 1.25rem;
  font-weight: 600;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: background .15s;
}
.btn-out:hover { background: #f9fafb; }

.btn-red {
  background: #dc2626;
  color: #fff;
  border-radius: var(--radius);
  padding: .5rem 1.25rem;
  font-weight: 700;
  font-size: .875rem;
  font-family: 'Nunito', sans-serif;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.btn-red:hover { background: #b91c1c; }

.btn-sm { padding: .3rem .75rem; font-size: .75rem; }

/* ── Wishlist / Shortlist Heart Button ──────────────────────────────────── */
.btn-heart {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: .25rem;
  border-radius: 50%;
  transition: transform .2s, color .2s;
  color: #d1d5db;
}
.btn-heart:hover   { transform: scale(1.2); color: #ef4444; }
.btn-heart.saved   { color: #ef4444; }
.btn-heart.saved:hover { color: #b91c1c; }

/* ── Star Rating ─────────────────────────────────────────────────────────── */
.star-row {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
}
.star { color: #fbbf24; font-size: .85rem; }
.star-empty { color: #d1d5db; font-size: .85rem; }
.star-score {
  font-size: .7rem;
  font-weight: 700;
  color: #6b7280;
  margin-left: .25rem;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav-a {
  color: #d1fae5;
  font-size: .85rem;
  transition: color .15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
}
.nav-a:hover,
.nav-a.active { color: #fde68a; font-weight: 700; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.hostel-card { cursor: pointer; }
.hostel-img  {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
}
.hostel-emoji {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Room preview (cards + booking modal) */
.room-preview-wrap {
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  border-bottom: 1px solid #f3f4f6;
}
.room-preview-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}
.room-preview-wrap--sm .room-preview-img--sm {
  height: 100px;
  border-radius: var(--radius);
}
.room-preview-wrap--sm {
  border: none;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
  overflow: hidden;
}
.room-preview-placeholder {
  width: 100%;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #f3f4f6;
}
.room-preview-placeholder--sm {
  min-height: 100px;
  border-radius: var(--radius);
  border-bottom: none;
  margin-bottom: 0.75rem;
}
.room-preview-ph-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.75rem;
  text-align: center;
}
.room-preview-ph-bed { font-size: 1.75rem; line-height: 1; }
.room-preview-ph-num { font-size: 0.8rem; font-weight: 700; color: #374151; }
.room-preview-ph-type { font-size: 0.7rem; color: #6b7280; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.prog {
  background: linear-gradient(90deg, var(--g), var(--gold));
  border-radius: 99px;
  transition: width .4s ease;
}

/* ── Chips (amenity tags) ────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: #f0fdf4;
  color: #166534;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 99px;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-bg {
  background: rgba(15, 53, 32, .62);
  backdrop-filter: blur(3px);
}
.modal-box {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 42rem;
  max-height: 92vh;
  overflow-y: auto;
}

/* ── Booking Timeline ────────────────────────────────────────────────────── */
.timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: .75rem 0;
}
.tl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.tl-dot {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  position: relative;
}
.tl-dot.done    { background: var(--g);    color: #fff; }
.tl-dot.active  { background: var(--gold); color: #fff; }
.tl-dot.pending { background: #e5e7eb;     color: #9ca3af; }
.tl-label {
  font-size: .6rem;
  font-weight: 600;
  color: #6b7280;
  margin-top: .2rem;
  text-align: center;
  white-space: nowrap;
}
.tl-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin: 0 -.25rem;
  margin-bottom: 1.1rem;
}
.tl-line.done { background: var(--g); }

/* ── Skeleton Shimmer ────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius);
}
.skeleton-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.skeleton-img   { height: 180px; }
.skeleton-line  { height: 14px; margin: .5rem .75rem; }
.skeleton-line-sm { height: 10px; margin: .25rem .75rem; width: 60%; }

/* ── Booking Slip (print) ────────────────────────────────────────────────── */
.slip-wrap {
  font-family: 'Nunito', sans-serif;
  max-width: 480px;
  margin: 2rem auto;
  border: 2px solid var(--g);
  border-radius: 1rem;
  overflow: hidden;
}
.slip-header {
  background: linear-gradient(135deg, var(--dark), var(--g));
  color: #fff;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.slip-body    { padding: 1.25rem 1.5rem; }
.slip-row     { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid #f3f4f6; font-size: .85rem; }
.slip-row:last-child { border-bottom: none; }
.slip-key     { color: #6b7280; }
.slip-val     { font-weight: 700; text-align: right; }
.slip-ref     { background: #f0fdf4; border-radius: .5rem; padding: .75rem; text-align: center; margin-top: 1rem; font-size: .8rem; }
.slip-ref-num { font-size: 1.4rem; font-weight: 800; color: var(--g); font-family: monospace; letter-spacing: .1em; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.tbl-hd th {
  background: #f9fafb;
  font-size: .7rem;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: .05em;
  padding: .5rem .75rem;
  text-align: left;
  font-weight: 700;
}
.tbl-row td {
  padding: .55rem .75rem;
  font-size: .825rem;
  border-top: 1px solid #f3f4f6;
  vertical-align: middle;
}
.tbl-row:hover td { background: #f9fafb; }

/* ── Image upload drop zone ──────────────────────────────────────────────── */
.img-drop {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.img-drop:hover,
.img-drop.drag { border-color: var(--g); background: #f0fdf4; }

/* ── Map iframe ──────────────────────────────────────────────────────────── */
.map-frame {
  width: 100%;
  height: 200px;
  border: none;
  border-radius: var(--radius);
  display: block;
}

/* ── Booking step indicator ──────────────────────────────────────────────── */
.step-dot {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-dot.active { background: var(--g);  color: #fff; }
.step-dot.done   { background: var(--gl); color: #fff; }
.step-dot.idle   { background: #e5e7eb;   color: #9ca3af; }
.step-line       { flex: 1; height: 2px; border-radius: 99px; }
.step-line.done  { background: var(--g); }
.step-line.idle  { background: #e5e7eb; }

/* ── Security badge (nav) ────────────────────────────────────────────────── */
.sec-badge {
  background: #0f3520;
  color: #86efac;
  font-size: .6rem;
  padding: .1rem .5rem;
  border-radius: 99px;
  font-family: monospace;
}

/* ── Toast Notification ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast-success { background: var(--g); }
.toast-error   { background: #dc2626; }
.toast-warn    { background: #d97706; }

/* ── Error text ──────────────────────────────────────────────────────────── */
.err-txt { color: #dc2626; font-size: .75rem; }

/* ── Camera Capture ──────────────────────────────────────────────────────── */
.cam-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 40px solid rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cam-frame {
  width: 100%;
  height: 100%;
  border: 2px dashed #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.2);
}
.cam-shutter {
  position: absolute;
  bottom: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: transform 0.1s;
}
.cam-shutter:active { transform: scale(0.9); background: #fff; }

.cam-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1rem 0;
}
.cam-preview {
  width: 100%;
  border-radius: var(--radius);
  max-height: 300px;
  object-fit: contain;
}

/* ── Action row (admin table) ────────────────────────────────────────────── */
.action-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ── Animations ──────────────────────────────────────────────────────────── */
.fade { animation: fadeIn .3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.rotate-180 {
  transform: rotate(180deg);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--g); border-radius: 9px; }

/* ── Tab switcher (My Bookings) ─────────────────────────────────────────── */
.tab-btn {
  padding: .45rem 1rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: all .15s;
  background: #f3f4f6;
  color: #6b7280;
}
.tab-btn.active {
  background: var(--g);
  color: #fff;
  border-color: var(--g);
}
.tab-btn:not(.active):hover {
  border-color: var(--g);
  color: var(--g);
  background: #f0fdf4;
}

/* ── Responsive helpers ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }

  /* Mobile: bottom-sheet modal */
  .modal-bg {
    align-items: flex-end;
  }
  .modal-box {
    max-width: 100%;
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 96vh;
    animation: slideUp .3s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

/* ── Print Stylesheet (Booking Slip) ─────────────────────────────────────── */
@media print {
  body > *:not(.slip-wrap) { display: none !important; }
  .slip-wrap { border: 2px solid #000; margin: 0; }
  .no-print  { display: none !important; }
}

/* ── Admin Hostel Accordion ────────────────────────────────────────────── */
.hostel-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s;
  opacity: 0;
}
.hostel-accordion-content.expanded {
  max-height: 2000px;
  opacity: 1;
}
.chevron-toggle {
  transition: transform 0.3s;
  display: inline-block;
  font-size: 0.8rem;
  color: #9ca3af;
}
.chevron-toggle.expanded {
  transform: rotate(180deg);
  color: var(--g);
}
.hostel-header-clickable {
  cursor: pointer;
  user-select: none;
}
.hostel-header-clickable:hover {
  background-color: rgba(26, 92, 56, 0.05) !important;
}
