/* =====================================================================
   PG Hostel and Rooms — Design system
   Palette: deep navy (trust, institutional) + warm gray + clear status
   colors. Two type families: Poppins for headings/numbers (rounded,
   approachable — this is a home for students, not a bank), Inter for
   body/UI text (quiet, highly legible in dense tables and forms).
   ===================================================================== */

:root {
  /* Color */
  --navy-900: #12233F;
  --navy-800: #1B3A63;
  --navy-700: #274C7D;
  --blue-accent: #3E7CB8;
  --gray-50: #F6F7F9;
  --gray-100: #EDF0F4;
  --gray-200: #E1E5EB;
  --gray-400: #9AA5B4;
  --ink-900: #16202E;
  --ink-600: #4E5A6C;
  --white: #FFFFFF;

  --green-600: #1E8E5A;
  --green-100: #E4F5EC;
  --red-600: #D64545;
  --red-100: #FBE7E7;
  --orange-600: #C97A20;
  --orange-100: #FBEEDC;

  /* Layout */
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(18, 35, 63, 0.06), 0 1px 12px rgba(18, 35, 63, 0.05);
  --max-content: 480px;
  --max-admin: 1180px;

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--gray-50);
  color: var(--ink-900);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-word, .stat-number {
  font-family: 'Poppins', 'Inter', sans-serif;
  color: var(--navy-900);
  margin: 0;
}

a { color: inherit; }
button { font-family: inherit; }

img, svg { max-width: 100%; display: block; }

/* ---------- Focus visibility (accessibility floor) ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Shell / containers ---------- */
.app-shell {
  max-width: var(--max-content);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--gray-50);
  padding-bottom: 84px; /* room for bottom nav */
  position: relative;
}

.app-shell.admin-shell {
  max-width: var(--max-admin);
  padding-bottom: 24px;
}

.page-pad { padding: 20px 18px; }

/* ---------- Top bar (brand header used on most pages) ---------- */
.topbar {
  background: var(--navy-900);
  color: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo-badge {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--white);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--white); }
.topbar-sub { font-size: 12px; color: #B7C6DC; }

.topbar-back {
  background: none; border: none; color: var(--white);
  font-size: 20px; padding: 4px 8px; margin-left: -8px; cursor: pointer;
}

.topbar-spacer { flex: 1; }

.icon-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

/* ---------- Entrance animation (landing page) ---------- */
@keyframes pgFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pg-anim {
  opacity: 0;
  animation: pgFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.feature-row {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(18,35,63,0.08), 0 12px 28px rgba(18,35,63,0.1);
}

/* ---------- Landing hero ---------- */
.hero {
  position: relative;
  background: var(--navy-900);
  color: var(--white);
  padding: 60px 24px 68px;
  text-align: center;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
}

/* Faint grid-of-rooms watermark — ties the hero back to the subject
   (a building of numbered rooms) instead of a generic decorative gradient. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.10;
  background-image:
    linear-gradient(var(--blue-accent) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--blue-accent) 1.5px, transparent 1.5px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 90%);
  pointer-events: none;
}

.hero-content { position: relative; }

.hero .logo-badge { width: 68px; height: 68px; font-size: 20px; margin: 0 auto 22px; border-radius: 16px; }

.hero h1 { color: var(--white); font-size: 27px; font-weight: 700; letter-spacing: -0.015em; }
.hero .location { color: #9FB4CE; font-size: 13.5px; margin-top: 7px; font-weight: 600; letter-spacing: 0.02em; }
.hero .tagline { color: #DCE6F2; font-size: 15px; margin-top: 20px; max-width: 30ch; margin-inline: auto; line-height: 1.55; }

.hero-actions {
  padding: 22px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Landing page feature list ---------- */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feature-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.feature-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--gray-50);
  color: var(--navy-800);
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-title { font-weight: 700; font-size: 14px; color: var(--navy-900); }
.feature-sub { font-size: 12.5px; color: var(--ink-600); margin-top: 3px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--navy-800); color: var(--white); box-shadow: 0 1px 2px rgba(18,35,63,0.08), 0 8px 20px rgba(18,35,63,0.16); }
.btn-primary:hover { box-shadow: 0 1px 2px rgba(18,35,63,0.1), 0 10px 24px rgba(18,35,63,0.2); }
.btn-secondary { background: var(--white); color: var(--navy-800); border: 1.5px solid var(--gray-200); }
.btn-ghost { background: transparent; color: var(--navy-800); text-decoration: underline; padding: 10px; }
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-success { background: var(--green-600); color: var(--white); }
.btn-sm { padding: 9px 14px; font-size: 13.5px; width: auto; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-600);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  background: var(--white);
  color: var(--ink-900);
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 3px rgba(62, 124, 184, 0.16);
}
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--gray-400); margin-top: 5px; }
.field .error-text { font-size: 12.5px; color: var(--red-600); margin-top: 5px; display: none; }
.field.has-error input, .field.has-error select { border-color: var(--red-600); }
.field.has-error .error-text { display: block; }

.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-card);
}

.form-heading { margin-bottom: 4px; }
.form-sub { color: var(--ink-600); font-size: 13.5px; margin-bottom: 20px; }

.form-footer-link { text-align: center; font-size: 13.5px; color: var(--ink-600); margin-top: 18px; }
.form-footer-link a { color: var(--navy-800); font-weight: 600; text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.card-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.stat-label { font-size: 12px; color: var(--ink-600); font-weight: 600; }
.stat-number { font-size: 24px; font-weight: 700; margin-top: 4px; }

.welcome-banner {
  color: var(--white);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.welcome-banner .greet { font-size: 18px; font-weight: 700; color: var(--white); }
.welcome-banner .sub { font-size: 13px; color: #C6D3E5; margin-top: 4px; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }

.badge-green { background: var(--green-100); color: var(--green-600); }
.badge-green .badge-dot { background: var(--green-600); }
.badge-red { background: var(--red-100); color: var(--red-600); }
.badge-red .badge-dot { background: var(--red-600); }
.badge-orange { background: var(--orange-100); color: var(--orange-600); }
.badge-orange .badge-dot { background: var(--orange-600); }
.badge-gray { background: var(--gray-100); color: var(--ink-600); }
.badge-gray .badge-dot { background: var(--gray-400); }

/* ---------- Section headings ---------- */
.section-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-900);
  margin: 22px 0 10px;
}
.section-heading:first-child { margin-top: 0; }

/* ---------- Rent list rows ---------- */
.rent-row { display: flex; justify-content: space-between; align-items: flex-start; }
.rent-month { font-weight: 600; font-size: 14.5px; }
.rent-amount { color: var(--ink-600); font-size: 13px; margin-top: 2px; }
.rent-meta { color: var(--gray-400); font-size: 12px; margin-top: 4px; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-600);
}
.empty-state .icon { font-size: 30px; margin-bottom: 10px; }
.empty-state p { font-size: 13.5px; margin: 0; }

/* ---------- Bottom navigation (student, mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--max-content);
  margin: 0 auto;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 10px 4px 8px;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.bottom-nav a .nav-icon { font-size: 19px; }
.bottom-nav a.active { color: var(--navy-800); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  background: var(--navy-900);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.toast-error { background: var(--red-600); }
#toast.toast-success { background: var(--green-600); }

/* ---------- Modal (payment method / reject reason) ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(18,35,63,0.45);
  display: none;
  align-items: flex-end;
  z-index: 90;
}
.modal-backdrop.show { display: flex; }
.modal-sheet {
  background: var(--white);
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  border-radius: 20px 20px 0 0;
  padding: 22px 18px 26px;
}
.modal-sheet h3 { margin-bottom: 4px; }
.modal-sheet .modal-sub { color: var(--ink-600); font-size: 13px; margin-bottom: 16px; }

.radio-option {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.radio-option.selected { border-color: var(--navy-800); background: var(--gray-50); }
.radio-option input { accent-color: var(--navy-800); }

/* ---------- Loading ---------- */
.loading-row { text-align: center; padding: 30px; color: var(--gray-400); font-size: 13px; }

/* ---------- Tables (admin desktop) ---------- */
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid var(--gray-100); }
.data-table th { background: var(--gray-50); color: var(--ink-600); font-weight: 600; font-size: 12px; text-transform: none; }
.data-table tr:last-child td { border-bottom: none; }

/* mobile: hide data tables, show card list instead */
@media (max-width: 720px) {
  .data-table { display: none; }
}
@media (min-width: 721px) {
  .mobile-card-list { display: none; }
}

/* ---------- Admin layout ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: var(--navy-900);
  color: var(--white);
  flex-shrink: 0;
  padding: 20px 0;
  display: none;
}
.admin-sidebar .brand { display: flex; gap: 10px; align-items: center; padding: 0 18px 20px; }
.admin-sidebar nav { display: flex; flex-direction: column; }
.admin-sidebar nav a {
  padding: 12px 20px;
  color: #B7C6DC;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.admin-sidebar nav a.active { color: var(--white); border-left-color: var(--blue-accent); background: rgba(255,255,255,0.05); }
.admin-main { flex: 1; min-width: 0; }

@media (min-width: 900px) {
  .admin-sidebar { display: flex; flex-direction: column; }
  .admin-topbar-mobile { display: none; }
}

#mobile-nav-menu { background: var(--navy-900); }
#mobile-nav-menu.show { display: flex !important; flex-direction: column; }
@media (min-width: 900px) {
  #mobile-nav-menu { display: none !important; }
}

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row select {
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--white);
}

.tab-strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 14px; }
.tab-strip button {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--ink-600);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tab-strip button.active { background: var(--navy-900); color: var(--white); border-color: var(--navy-900); }

.room-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 720px) { .room-grid { grid-template-columns: repeat(6, 1fr); } }
.room-tile {
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--gray-200);
}
.room-tile.available { background: var(--green-100); color: var(--green-600); border-color: transparent; }
.room-tile.partial { background: var(--orange-100); color: var(--orange-600); border-color: transparent; }
.room-tile.full { background: var(--red-100); color: var(--red-600); border-color: transparent; }
.room-tile .room-status { display: block; font-size: 10px; font-weight: 600; margin-top: 3px; text-transform: capitalize; }

.section-block { display: none; }
.section-block.active { display: block; }
