@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1A2C4E;
  --primary-light: #243d6b;
  --primary-dark: #111d33;
  --primary-rgb: 26, 44, 78;
  --white: #ffffff;
  --black: #111111;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0284c7;
  --info-light: #e0f2fe;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  min-width: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803d; color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #b45309; color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
/* Force white text on <a> buttons — overrides global a { color } rule */
a.btn-primary, a.btn-primary:hover, a.btn-primary:visited { color: #fff; }
a.btn-success, a.btn-success:hover, a.btn-success:visited { color: #fff; }
a.btn-danger,  a.btn-danger:hover,  a.btn-danger:visited  { color: #fff; }
a.btn-warning, a.btn-warning:hover, a.btn-warning:visited  { color: #fff; }

/* ── BADGES ──────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-secondary { background: var(--gray-100); color: var(--gray-500); }
.badge-primary { background: rgba(var(--primary-rgb),0.1); color: var(--primary); }

/* ── CARDS ───────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2, .card-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* Stat Cards */
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 22px; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: rgba(var(--primary-rgb), 0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--primary); flex-shrink: 0;
}
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-sub   { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ── FORMS ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-900); background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12); }
.form-control::placeholder { color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--danger); }
.form-text { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.invalid-feedback { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── ALERTS ──────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: #166534; border-left: 4px solid var(--success); }
.alert-danger   { background: var(--danger-light);  color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning  { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }
.alert-info     { background: var(--info-light);    color: #075985; border-left: 4px solid var(--info); }

/* ── TABLES ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--gray-50); color: var(--gray-500);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ── DASHBOARD LAYOUT ────────────────────────── */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width); background: var(--primary);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform var(--transition);
}
.sidebar-brand {
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h1 { font-size: 16px; font-weight: 700; color: var(--white); line-height: 1.3; }
.sidebar-brand span { font-size: 12px; color: rgba(255,255,255,0.5); }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 8px 20px 4px; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: rgba(255,255,255,0.75); font-size: 14px; font-weight: 500; transition: all var(--transition); cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,0.12); color: var(--white); border-right: 3px solid var(--white); }
.nav-item svg, .nav-item i { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { display: flex; align-items: center; gap: 12px; }
.sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--white); font-size: 14px; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: capitalize; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;        /* prevents flex child from overflowing */
  overflow-x: hidden;  /* table overflow stays inside, not page */
}

.topbar {
  height: var(--topbar-height); background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--gray-900); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
/* Hamburger button — always dark, never inherits link color */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #374151 !important;  /* explicit dark — never white */
  font-size: 20px;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.page-content { flex: 1; padding: 28px; }
.page-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-header p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── PUBLIC PAGES ────────────────────────────── */
.public-nav {
  background: var(--white); height: 64px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.public-nav-brand { font-size: 18px; font-weight: 700; color: var(--primary); }
.public-nav-links { display: flex; align-items: center; gap: 24px; }
.public-nav-links a { font-size: 14px; color: var(--gray-700); font-weight: 500; }
.public-nav-links a:hover { color: var(--primary); }

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white); padding: 80px 40px; text-align: center;
}
.hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 16px; line-height: 1.2; }
.hero p { font-size: 18px; opacity: 0.85; max-width: 560px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero .btn-white { background: var(--white); color: var(--primary); }
.hero .btn-white:hover { background: var(--gray-100); }
.hero .btn-outline-white { border: 2px solid rgba(255,255,255,0.6); color: var(--white); background: transparent; }
.hero .btn-outline-white:hover { background: rgba(255,255,255,0.1); }

.section { padding: 60px 40px; }
.section-title { font-size: 28px; font-weight: 700; color: var(--gray-900); text-align: center; margin-bottom: 8px; }
.section-sub { font-size: 16px; color: var(--gray-500); text-align: center; margin-bottom: 40px; }

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.room-card { background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--gray-200); transition: transform var(--transition), box-shadow var(--transition); }
.room-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.room-card-img { height: 200px; background: var(--gray-200); overflow: hidden; }
.room-card-img img { width: 100%; height: 100%; object-fit: cover; }
.room-card-img .no-img { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 48px; color: var(--gray-300); }
.room-card-body { padding: 20px; }
.room-card-type { font-size: 12px; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.room-card-name { font-size: 18px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.room-card-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.room-card-price span { font-size: 13px; color: var(--gray-500); font-weight: 400; }
.room-card-amenities { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.amenity-tag { font-size: 11px; background: var(--gray-100); color: var(--gray-600); padding: 3px 10px; border-radius: 20px; }
.room-card-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }

/* ── AUTH PAGES ──────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-100); padding: 20px; }
.auth-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; overflow: hidden; }
.auth-header { background: var(--primary); padding: 32px; text-align: center; }
.auth-header h1 { color: var(--white); font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-header p { color: rgba(255,255,255,0.7); font-size: 14px; }
.auth-body { padding: 32px; }
.auth-footer { text-align: center; padding: 16px 32px 24px; font-size: 14px; color: var(--gray-500); }

/* ── FILTER BAR ──────────────────────────────── */
.filter-bar { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; flex: 1; }

/* ── BOOKING DETAIL ──────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--gray-500); font-weight: 500; }
.info-value { color: var(--gray-900); font-weight: 600; text-align: right; }

/* ── RECEIPT ─────────────────────────────────── */
.receipt { max-width: 500px; margin: 0 auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.receipt-header { text-align: center; border-bottom: 2px dashed var(--gray-200); padding-bottom: 20px; margin-bottom: 20px; }
.receipt-header h2 { font-size: 20px; font-weight: 700; color: var(--primary); }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }

  /* Layout */
  .page-content { padding: 16px 12px; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 15px; }

  /* Page header — stack title and button vertically, no overflow */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-header h1 { font-size: 18px; }
  /* Buttons in page-header wrap but don't go full-width */
  .page-header > div[style*="display:flex"],
  .page-header > div[style*="display: flex"] {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Tables — horizontal scroll only on table, not the whole page */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius) var(--radius);
  }
  /* Do NOT add overflow:hidden to .card on mobile — clips Tom Select dropdowns */
  .card { max-width: 100%; }

  /* Reduce table padding on mobile */
  thead th { padding: 10px 10px; font-size: 11px; }
  tbody td { padding: 10px 10px; font-size: 13px; }

  /* Grids */
  .form-row { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }

  /* Filter bar — stack vertically on mobile */
  .filter-bar {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }
  .filter-bar .form-group {
    width: 100%;
    min-width: unset;
    flex: unset;
  }
  .filter-bar button,
  .filter-bar a.btn {
    width: 100%;
    justify-content: center;
  }

  /* Public pages */
  .public-nav { padding: 0 16px; }
  .public-nav-links { display: none; }
  .hero { padding: 40px 16px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .section { padding: 32px 16px; }

  /* Auth */
  .auth-card { border-radius: var(--radius); }
  .auth-header { padding: 24px 20px; }
  .auth-body { padding: 24px 20px; }

  /* Receipt */
  .receipt { padding: 20px 16px; }

  /* Card body */
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .card-footer { padding: 12px 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  /* On very small screens, allow stats to be single column if content is wide */
  .page-content { padding: 12px 10px; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }

  /* Full-width buttons in page header */
  .page-header .btn { width: 100%; }
}


/* ── SIDEBAR OVERLAY ─────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.show { display: block; }

/* ── MISC ────────────────────────────────────── */
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state i { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

/* Print */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}
