/* ============================================================
   HMS — Hotel Management System Front-Desk UI
   Design system: DM Sans, warm amber accent, touch-friendly
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');
/* Indian-script system-font stacks loaded on demand via :lang selectors.
   Noto fonts are loaded from Google Fonts to cover devices that lack bundled
   Devanagari / Tamil / Bengali typefaces (common on older Android/Windows). */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&family=Noto+Sans+Tamil:wght@400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  --bg:            #FAFAF8;
  --surface:       #FFFFFF;
  --surface-2:     #F5F5F2;
  --border:        #E5E4DF;
  --border-strong: #C9C8C2;

  --text:          #1C1917;
  --text-secondary:#6B7280;
  --text-muted:    #9CA3AF;

  --accent:        #D97706;   /* amber-600 */
  --accent-dark:   #B45309;   /* amber-700 */
  --accent-light:  #FEF3C7;   /* amber-50  */
  --accent-ring:   rgba(217,119,6,0.25);

  --success:       #059669;
  --success-light: #D1FAE5;
  --danger:        #DC2626;
  --danger-light:  #FEE2E2;
  --warning:       #D97706;
  --warning-light: #FEF3C7;
  --info:          #2563EB;
  --info-light:    #DBEAFE;

  /* room status colours */
  --room-available:  #16A34A;
  --room-available-bg: #F0FDF4;
  --room-occupied:   #D97706;
  --room-occupied-bg:#FFFBEB;
  --room-oos:        #9CA3AF;
  --room-oos-bg:     #F9FAFB;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);

  --sidebar-w: 220px;
  --header-h:  60px;
  --touch:     48px;   /* minimum touch target height */
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.0625rem; font-weight: 600; }
h4 { font-size: 0.9375rem; font-weight: 600; }
.mono { font-family: var(--font-mono); }

/* ── Layout: Login page ─────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, #FEF3C7 0%, #FAFAF8 55%, #FEF3C7 100%);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 0.75rem;
  box-shadow: 0 4px 12px rgba(217,119,6,.35);
}
.login-logo h1 { font-size: 1.5rem; color: var(--text); }
.login-logo p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.25rem; }

/* ── Layout: App shell ──────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.sidebar-logo .logo-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-logo .brand { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }
.sidebar-logo .brand span { color: var(--accent); }

.sidebar-nav { flex: 1; padding: 0.75rem 0.75rem; overflow-y: auto; }

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.375rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 0.625rem;
  height: var(--touch);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item .nav-icon { font-size: 1.125rem; flex-shrink: 0; width: 22px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700;
  flex-shrink: 0;
}
.user-info { min-width: 0; flex: 1; }
.user-info .user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-role { font-size: 0.75rem; color: var(--text-secondary); }

/* Main content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  gap: 1rem;
}
.page-header h2 { font-size: 1.125rem; }

.page-body {
  padding: 1.5rem;
  flex: 1;
}

/* Property badge in header */
.prop-badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(217,119,6,.2);
  max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.375rem;
  height: var(--touch);
  padding: 0 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.12s, transform 0.08s, opacity 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-sm { height: 36px; padding: 0 0.875rem; font-size: 0.875rem; }
.btn-lg { height: 56px; padding: 0 1.75rem; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-icon { width: var(--touch); padding: 0; border-radius: var(--radius); font-size: 1.125rem; }
.btn-icon.btn-sm { width: 36px; font-size: 1rem; }

/* ── Form controls ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-hint { font-size: 0.8125rem; color: var(--text-secondary); }
.form-error { font-size: 0.8125rem; color: var(--danger); font-weight: 500; }

.input, .select, .textarea {
  height: var(--touch);
  padding: 0 0.875rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
  appearance: none;
}
.textarea { height: auto; min-height: 80px; padding: 0.625rem 0.875rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input.error, .select.error { border-color: var(--danger); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.2); }

.input-wrapper { position: relative; }
.input-wrapper .input { padding-right: 2.75rem; }
.input-wrapper .input-suffix {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; font-size: 1.125rem;
  background: none; border: none; display: flex; align-items: center;
}

.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem; }

.checkbox-group { display: flex; align-items: center; gap: 0.625rem; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.checkbox-group label { font-size: 0.9375rem; font-weight: 500; cursor: pointer; }

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

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

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem; justify-content: flex-end;
}

/* ── Room Grid ────────────────────────────────────────────────── */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.875rem;
}

.room-tile {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  padding: 1rem 0.875rem 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  text-align: center;
  position: relative;
  min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
}
.room-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.room-tile.available { border-color: var(--room-available); background: var(--room-available-bg); }
.room-tile.occupied  { border-color: var(--room-occupied);  background: var(--room-occupied-bg); }
.room-tile.out_of_service { border-color: var(--room-oos); background: var(--room-oos-bg); }

.room-number { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.02em; }
.room-tile.available .room-number { color: var(--room-available); }
.room-tile.occupied  .room-number { color: var(--room-occupied); }
.room-tile.out_of_service .room-number { color: var(--room-oos); }

.room-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.available  .room-status-badge { background: var(--success-light); color: var(--room-available); }
.occupied   .room-status-badge { background: var(--warning-light); color: var(--accent-dark); }
.out_of_service .room-status-badge { background: #F3F4F6; color: var(--room-oos); }

.room-floor { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }

/* ── Status / Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--accent-dark); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-neutral { background: var(--surface-2);     color: var(--text-secondary); }

/* reservation status */
.status-booked      { background: var(--info-light); color: var(--info); }
.status-checked_in  { background: var(--warning-light); color: var(--accent-dark); }
.status-checked_out { background: var(--success-light); color: var(--success); }
.status-cancelled   { background: var(--danger-light); color: var(--danger); }
.status-no_show     { background: #F3F4F6; color: var(--text-secondary); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(28,25,23,.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  border: 1px solid var(--border);
}
.modal-lg { max-width: 760px; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Alert / Inline notice ────────────────────────────────────── */
.alert {
  display: flex; gap: 0.625rem; align-items: flex-start;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}
.alert-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 1px; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--accent-dark); }
.alert-info    { background: var(--info-light);    color: var(--info); }

/* ── Toast notifications ──────────────────────────────────────── */
#toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 9000;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-weight: 500;
  max-width: 340px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 0.625rem;
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
  border-left: 4px solid var(--accent);
}
.toast.success { border-color: var(--success); }
.toast.danger  { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info    { border-color: var(--info); }
.toast-icon { flex-shrink: 0; font-size: 1.1rem; }
.toast-text { flex: 1; }
.toast.out { animation: toastOut 0.2s ease forwards; }

/* ── Loading ──────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(28,25,23,.15);
  border-top-color: var(--accent);
}

.loading-state {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 3rem 1rem; color: var(--text-secondary); font-size: 0.9375rem;
}
.loading-state .spinner { width: 32px; height: 32px; border-width: 3px; }
.loading-state .spinner { border-color: var(--border-strong); border-top-color: var(--accent); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  padding: 3rem 1rem; text-align: center;
}
.empty-state .empty-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state p { color: var(--text-secondary); font-size: 0.9375rem; max-width: 260px; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
thead th {
  background: var(--surface-2);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }

/* ── Divider ──────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.divider-label {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--text-muted); font-size: 0.8125rem;
  margin: 0.75rem 0;
}
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Invoice print view ───────────────────────────────────────── */
.invoice-view {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  max-width: 720px;
}
.invoice-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--accent);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap;
}
.invoice-number { font-family: var(--font-mono); font-size: 1.125rem; font-weight: 700; color: var(--accent-dark); }
.invoice-body { padding: 1.25rem 1.5rem; }
.invoice-lines { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 1rem 0; }
.invoice-totals { margin-top: 1rem; }
.totals-row { display: flex; justify-content: space-between; padding: 0.375rem 0; font-size: 0.9375rem; }
.totals-row.grand { border-top: 2px solid var(--border); padding-top: 0.75rem; margin-top: 0.375rem; font-size: 1.0625rem; font-weight: 700; }
.totals-row .label { color: var(--text-secondary); }
.totals-row.grand .label { color: var(--text); }
.amount { font-family: var(--font-mono); }

/* ── KPI Cards ────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.kpi-label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.kpi-value { font-size: 1.75rem; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.02em; color: var(--text); }
.kpi-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* ── Property setup prompt ────────────────────────────────────── */
.setup-prompt {
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
  padding: 2.5rem 1.5rem; text-align: center;
}
.setup-prompt .setup-icon { font-size: 3rem; }

/* ── Responsive ───────────────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 1.375rem;
  padding: 0.25rem;
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); }
  .sidebar.open { transform: translateX(0); width: 220px; }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }
  .room-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .page-body { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .invoice-header { flex-direction: column; }
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes toastIn  { from { opacity: 0; transform: translateX(60px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px) scale(0.9); } }
@keyframes spin     { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.25s ease; }

/* ── Utility classes ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semi { font-weight: 600; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Language switcher ────────────────────────────────────────── */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.1875rem;
  flex-shrink: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 0.375rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  /* Ensure Indian script characters render with correct font */
  font-family: 'Noto Sans Devanagari', 'Noto Sans Tamil', 'Noto Sans Bengali',
               var(--font-sans);
}
.lang-btn:hover:not(.active) {
  background: var(--border);
  color: var(--text);
}
.lang-btn.active {
  background: var(--accent);
  color: white;
  cursor: default;
}

/* Login page — language bar (top-right overlay) */
.login-lang-bar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

/* ── Indian-script font stacks ────────────────────────────────── */
/* Applied via the <html lang="…"> attribute that i18n.js updates on locale
   change. System-font stacks are listed first so the OS native font is used
   when available (better rendering on mobile devices).
   Noto Sans serves as a cross-platform fallback for devices that lack the
   bundled Devanagari / Tamil / Bengali typefaces. */

:lang(hi) {
  font-family: 'Mangal', 'Noto Sans Devanagari', 'Arial Unicode MS', system-ui, sans-serif;
  line-height: 1.65; /* Devanagari needs a little extra line-height */
}

:lang(ta) {
  font-family: 'Latha', 'Noto Sans Tamil', 'Arial Unicode MS', system-ui, sans-serif;
  line-height: 1.7;
}

:lang(bn) {
  font-family: 'Vrinda', 'Noto Sans Bengali', 'Arial Unicode MS', system-ui, sans-serif;
  line-height: 1.7;
}

/* Preserve monospace elements in their dedicated font regardless of lang */
:lang(hi) .font-mono,
:lang(ta) .font-mono,
:lang(bn) .font-mono,
:lang(hi) code,
:lang(ta) code,
:lang(bn) code {
  font-family: var(--font-mono);
}

/* ── Tape Chart (room × date calendar grid) ───────────────────── */
.tape-chart-wrap {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tape-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tape-header-row {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tape-room-col-hdr {
  width: 88px;
  min-width: 88px;
  flex-shrink: 0;
  padding: .5rem .625rem;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--surface-2);
  z-index: 11;
  display: flex;
  align-items: center;
}

.tape-date-cell {
  width: 76px;
  min-width: 76px;
  flex-shrink: 0;
  text-align: center;
  padding: .3125rem .25rem .375rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  line-height: 1.3;
}

.tape-date-cell.is-today {
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 700;
}

.tape-date-dow {
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  display: block;
}

.tape-date-cell.is-today .tape-date-dow {
  color: var(--accent-dark);
  opacity: .75;
}

.tape-body-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

.tape-body-row:last-child { border-bottom: none; }
.tape-body-row:hover { background: var(--surface-2); }

.tape-room-label {
  width: 88px;
  min-width: 88px;
  flex-shrink: 0;
  padding: 0 .625rem;
  font-size: .9375rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 5;
  transition: background .1s;
}

.tape-body-row:hover .tape-room-label {
  background: var(--surface-2);
}

.tape-cells {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 48px;
}

.tape-day-slot {
  width: 76px;
  min-width: 76px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  min-height: 48px;
}

.tape-day-slot.is-today {
  background: rgba(217, 119, 6, .04);
}

.tape-bar {
  position: absolute;
  top: 7px;
  bottom: 7px;
  border-radius: var(--radius-sm);
  padding: 0 .5rem;
  font-size: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  z-index: 3;
  transition: filter .12s, transform .1s;
  border: 1.5px solid transparent;
  min-width: 24px;
}

.tape-bar:hover {
  filter: brightness(.92);
  transform: scaleY(1.06);
  z-index: 4;
}

.tape-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tape-bar.status-booked      { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.tape-bar.status-checked_in  { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.tape-bar.status-checked_out { background: #F3F4F6; color: #374151; border-color: #D1D5DB; }
.tape-bar.status-cancelled   { background: #FEE2E2; color: #991B1B; border-color: #FECACA; opacity: .6; text-decoration: line-through; }
.tape-bar.status-no_show     { background: #FEF9C3; color: #78350F; border-color: #FDE68A; opacity: .75; }

/* ── Print styles (invoice) ───────────────────────────────────── */
@media print {
  .sidebar, .page-header, .no-print, #toast-container, .modal-overlay,
  .lang-switcher, .login-lang-bar { display: none !important; }
  .main-content { margin-left: 0; }
  .page-body { padding: 0; }
  .invoice-view { border: none; box-shadow: none; max-width: 100%; }
  body { background: white; }
}

/* ── Dark theme ───────────────────────────────────────────────────
   Token values mirror design/design.pen ({mode: dark}). Activated via
   <html data-theme="dark">; persisted in localStorage 'hms_theme'. */
[data-theme="dark"] {
  --bg:            #131110;
  --surface:       #1C1917;
  --surface-2:     #26221F;
  --border:        #2E2A27;
  --border-strong: #4A443F;

  --text:          #F5F5F4;
  --text-secondary:#A8A29E;
  --text-muted:    #78716C;

  --accent:        #F59E0B;
  --accent-dark:   #FCD34D;
  --accent-light:  #3B2A10;
  --accent-ring:   rgba(245,158,11,0.3);

  --success:       #34D399;
  --success-light: #0A2E21;
  --danger:        #F87171;
  --danger-light:  #3F1D1D;
  --warning:       #FBBF24;
  --warning-light: #2E2410;
  --info:          #60A5FA;
  --info-light:    #1E2A47;

  --room-available:  #4ADE80;
  --room-available-bg: #132A1C;
  --room-occupied:   #FBBF24;
  --room-occupied-bg:#2E2410;
  --room-oos:        #78716C;
  --room-oos-bg:     #1E1B19;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 12px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.4);
}

/* Spots the tokens can't reach (hardcoded light values above). */
[data-theme="dark"] .login-page {
  background: linear-gradient(145deg, #1F1A0F 0%, #131110 55%, #1F1A0F 100%);
}
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.6); }
[data-theme="dark"] .tape-bar.status-booked      { background: #1E2A47; color: #93C5FD; border-color: #2C3E63; }
[data-theme="dark"] .tape-bar.status-checked_in  { background: #0A2E21; color: #6EE7B7; border-color: #14532D; }
[data-theme="dark"] .tape-bar.status-checked_out { background: #1E1B19; color: #A8A29E; border-color: #2E2A27; }
[data-theme="dark"] .tape-bar.status-cancelled   { background: #3F1D1D; color: #FCA5A5; border-color: #7F1D1D; }
[data-theme="dark"] .tape-bar.status-no_show     { background: #2E2410; color: #FDE68A; border-color: #78350F; }
[data-theme="dark"] .out_of_service .room-status-badge { background: #1E1B19; }
[data-theme="dark"] .status-no_show { background: #1E1B19; color: var(--text-secondary); }
[data-theme="dark"] .btn-primary { color: #131110; }

/* Theme toggle button (sits beside the language switcher). */
.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background .15s ease;
}
.theme-toggle:hover { background: var(--surface-2); }

/* ── Public booking page ──────────────────────────────────────── */
/* Guest-facing book.html — mobile-first single column. */
.booking-page {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 4.25rem 1rem 3rem;
  background: linear-gradient(145deg, #FEF3C7 0%, #FAFAF8 55%, #FEF3C7 100%);
}
[data-theme="dark"] .booking-page {
  background: linear-gradient(145deg, #1F1A0F 0%, #131110 55%, #1F1A0F 100%);
}

.booking-shell {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideUp 0.3s ease;
}
#view-search { display: flex; flex-direction: column; gap: 1rem; }
#results { display: flex; flex-direction: column; gap: 1rem; }

.booking-header { display: flex; align-items: center; gap: 0.875rem; }
.booking-header .logo-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(217,119,6,.35);
}
.booking-header h1 { font-size: 1.375rem; }

.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

/* Search bar: dates + adults stepper */
.booking-search {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}
@media (max-width: 480px) {
  .booking-search { grid-template-columns: 1fr 1fr; }
  .booking-search .form-group:last-child { grid-column: 1 / -1; }
}

.stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  height: var(--touch);
  padding: 0 0.25rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.stepper-btn {
  width: 38px; height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.stepper-btn:hover:not(:disabled) { background: var(--border); }
.stepper-btn:disabled { opacity: 0.4; cursor: default; }
.stepper-value { min-width: 2rem; text-align: center; font-weight: 600; }

/* Room-type result cards */
.room-card {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.room-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.room-card-meta { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.375rem; }
.room-card-price { text-align: right; flex-shrink: 0; }
.room-rate { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

/* Expandable price breakdown */
.price-details { border-top: 1px dashed var(--border); padding-top: 0.75rem; }
.price-details summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-dark);
}
.price-rows { margin-top: 0.625rem; display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.875rem; }
.price-row { display: flex; justify-content: space-between; gap: 1rem; color: var(--text-secondary); }
.price-row-total {
  border-top: 1px solid var(--border);
  padding-top: 0.375rem;
  font-weight: 700;
  color: var(--text);
}

/* Empty state */
.booking-empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--text-secondary); }
.booking-empty .empty-ico { font-size: 2rem; margin-bottom: 0.5rem; }

/* Confirmation / lookup card */
.booking-confirm { text-align: center; padding: 2rem 1.5rem; }
.confirm-icon {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--success-light);
  color: var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; font-weight: 700;
}
.conf-code {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-dark);
  margin: 0.25rem 0 0.5rem;
  word-break: break-all;
}
.conf-rows { margin: 1.25rem 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; text-align: left; }
.conf-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
.conf-row .k { color: var(--text-secondary); }
.conf-row .v { font-weight: 600; text-align: right; }
