/* ============================================================
   Grand Palace Hotel Management — Main Stylesheet
   Aesthetic: Refined Luxury / Art Deco inspired
   ============================================================ */

:root {
  --gold: #C9A84C;
  --gold-light: #E8C96D;
  --gold-dark: #9E7B2F;
  --navy: #0D1B2A;
  --navy-mid: #1A2E45;
  --navy-light: #243B55;
  --cream: #FAF7F0;
  --cream-dark: #F0EBE0;
  --white: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #5A6478;
  --text-muted: #8B95A7;
  --border: #E2D9C8;
  --border-light: #F0EBE0;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(13,27,42,0.08);
  --shadow-lg: 0 8px 40px rgba(13,27,42,0.14);
  --transition: 0.2s ease;

  /* Status colors */
  --green: #2D8A4E;
  --green-bg: #E8F7EE;
  --red: #D13438;
  --red-bg: #FDECEA;
  --yellow: #B07E0A;
  --yellow-bg: #FEF3E2;
  --blue: #1A6EA8;
  --blue-bg: #E3F0FA;
  --orange: #C25B14;
  --orange-bg: #FEF0E7;
  --gray: #6B7280;
  --gray-bg: #F3F4F6;
  --purple: #6B46C1;
  --purple-bg: #EDE9FE;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: width var(--transition);
  scrollbar-width: thin;
  scrollbar-color: var(--navy-light) transparent;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span:last-child,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn span { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
}
.brand-icon { font-size: 28px; flex-shrink: 0; }
.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: 0.3px;
}
.brand-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 0.5px; display: block; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section { margin-bottom: 8px; }
.nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(201,168,76,0.5);
  padding: 8px 20px 4px;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.nav-item:hover {
  color: var(--white);
  background: rgba(201,168,76,0.08);
  border-left-color: rgba(201,168,76,0.4);
}
.nav-item.active {
  color: var(--gold);
  background: rgba(201,168,76,0.12);
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(201,168,76,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy); font-size: 14px;
  flex-shrink: 0;
}
.user-details { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 10px; color: var(--text-muted); }
.logout-btn {
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  text-decoration: none;
  transition: color var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); }

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

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--cream); color: var(--navy); }
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.date-display {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--cream);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.topbar-user { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* ---- Page Content ---- */
.page-content { padding: 28px; flex: 1; }

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.3px; }
.stat-card.gold .stat-value { color: var(--gold-dark); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.blue .stat-value { color: var(--blue); }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}
.card-body { padding: 24px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--cream);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--cream); }
tbody td {
  padding: 13px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gold   { background: #FEF9EE; color: var(--gold-dark); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}
.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--white);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--navy-mid), var(--navy-light)); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,27,42,0.2); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy);
}
.btn-gold:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201,168,76,0.3); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { opacity: 0.9; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-icon { padding: 7px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.3px; }
.form-control, .form-select, .form-textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.form-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

/* ---- Search & Filters ---- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input {
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%238B95A7' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center / 14px;
  outline: none;
  min-width: 220px;
}
.search-input:focus { border-color: var(--gold); }

/* ---- Alerts ---- */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  gap: 10px;
}
.alert-success { background: var(--green-bg); color: var(--green); border-left: 3px solid var(--green); }
.alert-error   { background: var(--red-bg);   color: var(--red);   border-left: 3px solid var(--red); }
.alert-info    { background: var(--blue-bg);   color: var(--blue);  border-left: 3px solid var(--blue); }
.alert button  { background: none; border: none; cursor: pointer; font-size: 18px; opacity: 0.6; padding: 0; color: inherit; }
.alert button:hover { opacity: 1; }

/* ---- Room Grid ---- */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.room-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}
.room-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.room-card-top {
  padding: 20px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  position: relative;
}
.room-type-icon { font-size: 36px; margin-bottom: 4px; display: block; }
.room-number {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
}
.room-type-label {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.room-status-badge { position: absolute; top: 12px; right: 12px; }
.room-card-body { padding: 16px; }
.room-price {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-dark);
}
.room-price span { font-size: 11px; font-weight: 400; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }
.room-meta { display: flex; gap: 12px; margin: 8px 0; font-size: 11px; color: var(--text-muted); }
.room-amenities { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.room-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--navy-light) 100%);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--navy);
  font-weight: 700;
}
.login-logo p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.login-form .form-group { margin-bottom: 16px; }
.login-btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; justify-content: center; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  justify-content: center;
}
.page-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ---- Print / Invoice ---- */
.invoice-print {
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.invoice-hotel-name {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
}
.invoice-number-label {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--gold);
  font-weight: 700;
  text-align: right;
}
.invoice-divider { height: 2px; background: linear-gradient(90deg, var(--gold), transparent); margin: 24px 0; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.invoice-table th { background: var(--navy); color: var(--white); }
.invoice-total-row td { font-weight: 700; color: var(--navy); }
.invoice-grand-total {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--white) !important;
  font-size: 14px;
}

/* ---- Dashboard Charts ---- */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.occupancy-bar { height: 12px; background: var(--cream-dark); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.occupancy-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 6px; transition: width 1s ease; }

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; margin-top: 4px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Misc ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-dark); }
.text-navy { color: var(--navy); }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-row { display: flex; gap: 4px; margin-bottom: 4px; font-size: 13px; }
.info-row .label { color: var(--text-muted); min-width: 130px; }
.info-row .value { font-weight: 500; color: var(--text-primary); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .invoice-parties { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

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