/* ============================================================
   Grand Palm HMS - Theme
   Palette: deep palm green + brass accent on porcelain / ink.
   Light and dark modes via [data-theme] CSS variables.
   ============================================================ */

:root {
  --brand:        #1f4d3a;  /* deep palm green   */
  --brand-600:    #17402f;
  --brand-soft:   #e2efe8;
  --accent:       #b98a2f;  /* brass             */
  --gold-soft:    #f4ead3;
  --teal-soft:    #ddeef0;

  --bg:           #f6f7f5;  /* porcelain         */
  --surface:      #ffffff;
  --surface-2:    #eef0ec;
  --border:       #e1e4de;
  --text:         #22271f;
  --text-muted:   #6b7265;
  --shadow:       0 1px 2px rgba(20, 30, 20, .06), 0 8px 24px rgba(20, 30, 20, .05);

  --sidebar-bg:   #14261d;  /* near-black green  */
  --sidebar-text: #c8d4cc;
  --sidebar-w:    256px;
  --sidebar-w-sm: 72px;
}

[data-theme="dark"] {
  --brand:        #4f9273;
  --brand-600:    #3f7a5f;
  --brand-soft:   #1d3327;
  --gold-soft:    #33290f;
  --teal-soft:    #10292c;

  --bg:           #10140f;
  --surface:      #181d16;
  --surface-2:    #20261e;
  --border:       #2b3228;
  --text:         #e6e9e3;
  --text-muted:   #929a8d;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);

  --sidebar-bg:   #0c110c;
  --sidebar-text: #a9b5ab;
}

/* ---------- base ---------- */
body {
  font-family: 'Public Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1, h2, h3, .auth-title, .page-title {
  font-family: 'Fraunces', Georgia, serif;
}
a { color: var(--brand); }

/* ---------- shell layout ---------- */
.hms-shell { display: flex; min-height: 100vh; }
.hms-main  { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hms-content { flex: 1; padding: 1.5rem clamp(1rem, 3vw, 2.25rem); }

/* ---------- sidebar ---------- */
.hms-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  transition: width .2s ease, margin-left .2s ease;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 10px; font-size: 1rem;
}
.brand-mark.lg { width: 52px; height: 52px; font-size: 1.4rem; margin: 0 auto 0.75rem; }
.brand-text {
  font-family: 'Fraunces', serif; font-size: 1.05rem; color: #fff;
  white-space: nowrap; overflow: hidden;
}
.sidebar-nav { padding: 1rem .65rem; flex: 1; overflow-y: auto; }
.nav-section-label {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.35); padding: 0 .55rem .5rem;
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; margin-bottom: .15rem;
  color: var(--sidebar-text); text-decoration: none;
  border-radius: 9px; font-size: .92rem;
}
.nav-item i { width: 1.1rem; text-align: center; }
.nav-item:hover  { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.sidebar-foot {
  padding: 1rem 1.15rem; border-top: 1px solid rgba(255,255,255,.07);
  color: var(--sidebar-text); font-size: .85rem;
}
.role-chip {
  display: inline-block; margin-top: .3rem;
  background: rgba(255,255,255,.1); color: #fff;
  padding: .1rem .55rem; border-radius: 99px; font-size: .72rem;
}

/* collapsed state */
.hms-shell.sidebar-collapsed .hms-sidebar { width: var(--sidebar-w-sm); }
.hms-shell.sidebar-collapsed .brand-text,
.hms-shell.sidebar-collapsed .nav-item span,
.hms-shell.sidebar-collapsed .nav-section-label,
.hms-shell.sidebar-collapsed .sidebar-foot { display: none; }
.hms-shell.sidebar-collapsed .nav-item { justify-content: center; }

/* off-canvas on mobile */
@media (max-width: 991.98px) {
  .hms-sidebar { position: fixed; z-index: 1050; margin-left: calc(-1 * var(--sidebar-w)); }
  .hms-shell.sidebar-open .hms-sidebar { margin-left: 0; }
}

/* ---------- navbar ---------- */
.hms-navbar {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .6rem clamp(1rem, 3vw, 2.25rem);
  position: sticky; top: 0; z-index: 1020;
}
.navbar-spacer { flex: 1; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); width: 38px; height: 38px;
  border-radius: 10px; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark  { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline; }
.user-chip {
  display: flex; align-items: center; gap: .55rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 99px; padding: .25rem .8rem .25rem .3rem;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}

/* ---------- page & cards ---------- */
.page-head  { margin-bottom: 1.5rem; }
.page-title { font-size: 1.55rem; margin: 0; }
.page-sub   { color: var(--text-muted); margin: .25rem 0 0; }

.hms-breadcrumb { background: transparent; padding: 0; margin: 0; font-size: .85rem; }
.hms-breadcrumb a { text-decoration: none; }

.hms-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
}
.hms-card .card-header {
  background: transparent; border-bottom: 1px solid var(--border);
  font-weight: 600; padding: .9rem 1.15rem;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.1rem; color: var(--brand);
}
.bg-brand-soft { background: var(--brand-soft); }
.bg-gold-soft  { background: var(--gold-soft); color: var(--accent); }
.bg-teal-soft  { background: var(--teal-soft); color: #2b7a80; }
.stat-value { font-family: 'Fraunces', serif; font-size: 1.6rem; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: .85rem; }

/* ---------- tables ---------- */
.hms-table { color: var(--text); }
.hms-table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); border-bottom-color: var(--border) !important;
  background: var(--surface-2); padding: .7rem 1.15rem;
}
.hms-table td { padding: .75rem 1.15rem; border-bottom-color: var(--border) !important; background: transparent; color: inherit; }
.hms-table tbody tr:hover td { background: var(--surface-2); }

/* status badges (login history now, room statuses later) */
.badge.status-success { background: var(--brand-soft); color: var(--brand-600); }
.badge.status-failed  { background: #fbe4e4; color: #a33; }
.badge.status-blocked { background: var(--gold-soft); color: var(--accent); }
[data-theme="dark"] .badge.status-failed { background: #3a1c1c; color: #e08c8c; }

/* ---------- buttons & forms ---------- */
.btn-brand {
  background: var(--brand); border-color: var(--brand); color: #fff;
  border-radius: 10px; padding: .6rem 1rem; font-weight: 600;
}
.btn-brand:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.form-control, .form-select {
  background: var(--surface); color: var(--text);
  border-color: var(--border); border-radius: 10px; padding: .55rem .8rem;
}
.form-control:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(31, 77, 58, .15);
  background: var(--surface); color: var(--text);
}
.field-error { color: #b03a3a; font-size: .8rem; min-height: 1rem; margin-top: .2rem; }

/* ---------- footer & toasts ---------- */
.hms-footer {
  display: flex; justify-content: space-between;
  padding: .9rem clamp(1rem, 3vw, 2.25rem);
  border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-muted);
}
.hms-toast { border-radius: 12px; }

/* ---------- auth pages ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(185,138,47,.18), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(31,77,58,.22), transparent 55%),
    var(--sidebar-bg);
}
.auth-wrap { width: min(420px, 92vw); }
.auth-card {
  background: var(--surface); border-radius: 18px;
  padding: 2.2rem 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-title { font-size: 1.5rem; margin: 0; }
.auth-sub   { color: var(--text-muted); font-size: .9rem; margin: .35rem 0 0; }
.auth-link  { font-size: .87rem; text-decoration: none; }
.auth-foot  { text-align: center; color: rgba(255,255,255,.45); font-size: .8rem; margin-top: 1.25rem; }

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

/* ============ Module 2-12 additions ============ */

/* Status badges - rooms, bookings, invoices */
.badge[class*="status-"] { font-weight: 600; letter-spacing: .02em; border-radius: 999px; padding: .35em .7em; }
.status-available    { background: rgba(31,77,58,.14);  color: #1f4d3a; }
.status-occupied     { background: rgba(43,122,128,.16); color: #2b7a80; }
.status-reserved     { background: rgba(185,138,47,.16); color: #8a6620; }
.status-dirty        { background: rgba(201,138,138,.2); color: #a34e4e; }
.status-maintenance  { background: rgba(138,147,201,.2); color: #4d5aa3; }
.status-out_of_order { background: rgba(107,114,101,.18); color: #6b7265; }
.status-pending      { background: rgba(185,138,47,.16); color: #8a6620; }
.status-confirmed    { background: rgba(31,77,58,.14);  color: #1f4d3a; }
.status-checked_in   { background: rgba(43,122,128,.16); color: #2b7a80; }
.status-checked_out  { background: rgba(107,114,101,.18); color: #6b7265; }
.status-cancelled,
.status-failed       { background: rgba(163,78,78,.16); color: #a34e4e; }
.status-unpaid       { background: rgba(163,78,78,.16); color: #a34e4e; }
.status-partial      { background: rgba(185,138,47,.16); color: #8a6620; }
.status-paid,
.status-success      { background: rgba(31,77,58,.14);  color: #1f4d3a; }
.status-refunded     { background: rgba(138,147,201,.2); color: #4d5aa3; }
.status-blocked      { background: rgba(185,138,47,.22); color: #8a6620; }
[data-theme="dark"] .badge[class*="status-"] { filter: brightness(1.45); }

/* Extra stat-card icon tints */
.bg-teal-soft { background: rgba(43,122,128,.16); color: #2b7a80; }
.bg-gold-soft { background: rgba(185,138,47,.18); color: #8a6620; }

/* Room board (kanban) */
.room-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.board-col  { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 240px; }
.board-col-head { display: flex; align-items: center; gap: .5rem; padding: .65rem .85rem; font-weight: 600; font-size: .9rem; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.board-col-head .board-count { margin-left: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: .75rem; padding: 0 .55em; }
.col-available    { color: #1f4d3a; background: rgba(31,77,58,.08); }
.col-occupied     { color: #2b7a80; background: rgba(43,122,128,.08); }
.col-reserved     { color: #8a6620; background: rgba(185,138,47,.08); }
.col-dirty        { color: #a34e4e; background: rgba(201,138,138,.1); }
.col-maintenance  { color: #4d5aa3; background: rgba(138,147,201,.1); }
.col-out_of_order { color: #6b7265; background: rgba(107,114,101,.08); }
[data-theme="dark"] .board-col-head { filter: brightness(1.4); }
.board-col-body { padding: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) - 4px); padding: .6rem .7rem; box-shadow: var(--shadow-sm); }
.board-empty { color: var(--text-muted); text-align: center; font-size: .85rem; padding: 1.2rem 0; }

/* Invoice print */
@media print {
  .hms-sidebar, .hms-navbar, .hms-breadcrumb, .d-print-none, .toast-stack { display: none !important; }
  .hms-main, .hms-content { margin: 0 !important; padding: 0 !important; }
  .invoice-sheet { border: none !important; box-shadow: none !important; }
  body { background: #fff !important; }
}
