/* ==============================
   CSS Variables & Reset
   ============================== */
:root {
  --primary: #1a237e;
  --primary-light: #283593;
  --primary-dark: #0d1b64;
  --accent: #ff6f00;
  --accent-light: #ffa040;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f57f17;
  --info: #0277bd;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e0e3e8;
  --gray-300: #c4c9d1;
  --gray-400: #9ea5b1;
  --gray-500: #6c757d;
  --gray-600: #495057;
  --gray-700: #343a40;
  --gray-800: #212529;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--gray-100);
  color: var(--gray-700);
  display: flex;
  min-height: 100vh;
}

/* ==============================
   Sidebar
   ============================== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .sidebar-logo {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
}

.sidebar-header .logo-img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 8px;
  object-fit: contain;
}

.sidebar-header .logo-fallback {
  font-size: 2.5rem;
  color: #FFD700;
  display: none;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 0;
  flex: 1;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-menu li a i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-menu li:hover a {
  color: white;
  background: rgba(255,255,255,0.08);
}

.sidebar-menu li.active a {
  color: white;
  background: rgba(255,255,255,0.12);
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  opacity: 0.5;
  text-align: center;
}

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

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gray-600);
}

.topbar h1 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gray-800);
}

.topbar-date {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.content-area {
  flex: 1;
  padding: 24px 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ==============================
   Dashboard Cards
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 2.5rem;
  opacity: 0.15;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }
.stat-card.info { border-left: 4px solid var(--info); }
.stat-card.accent { border-left: 4px solid var(--accent); }

/* ==============================
   Panels / Cards
   ============================== */
.panel {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.panel-body {
  padding: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==============================
   Table
   ============================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: var(--gray-50);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table .actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { opacity: 0.9; }

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover { opacity: 0.9; }

.btn-info {
  background: var(--info);
  color: white;
}
.btn-info:hover { opacity: 0.9; }

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { opacity: 0.9; }

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover { background: var(--gray-50); }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==============================
   Badges
   ============================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background: #e8f5e9; color: var(--success); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-warning { background: #fff3e0; color: var(--warning); }
.badge-info { background: #e1f5fe; color: var(--info); }
.badge-primary { background: #e8eaf6; color: var(--primary); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

/* ==============================
   Forms
   ============================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: var(--transition);
  background: white;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ==============================
   Modal
   ============================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  transition: var(--transition);
}
.modal-close:hover { color: var(--gray-700); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

/* ==============================
   Toast
   ============================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }

.toast-remove {
  animation: slideOutRight 0.3s ease forwards;
}

/* ==============================
   Animations
   ============================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100px); }
}

/* ==============================
   Dashboard-specific
   ============================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.recent-list {
  list-style: none;
}

.recent-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recent-list li:last-child { border-bottom: none; }

.recent-list .guest-name {
  font-weight: 500;
  color: var(--gray-800);
}

.recent-list .room-info {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.recent-list .booking-status {
  font-size: 0.8rem;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* ==============================
   Search
   ============================== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  width: 250px;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  width: 300px;
}

.search-box i {
  position: absolute;
  left: 12px;
  color: var(--gray-400);
  font-size: 0.85rem;
}

/* ==============================
   Room Type Summary
   ============================== */
.room-type-chart {
  display: flex;
  gap: 8px;
}

.room-type-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.room-type-bar .bar {
  width: 40px;
  height: 100px;
  background: var(--gray-200);
  border-radius: 4px 4px 0 0;
  position: relative;
  overflow: hidden;
}

.room-type-bar .bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: var(--transition);
}

.room-type-bar .bar-label {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* ==============================
   Detail View
   ============================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item {
  padding: 8px 0;
}

.detail-item .detail-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.detail-item .detail-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-800);
}

/* ==============================
   Room Cards
   ============================== */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.room-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Status border */
.room-card.status-Available { border: 2.5px solid var(--success); }
.room-card.status-Occupied { border: 2.5px solid var(--danger); }
.room-card.status-Reserved { border: 2.5px solid var(--warning); }
.room-card.status-Maintenance { border: 2.5px solid var(--gray-400); }

.room-card-image {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  position: relative;
}

.room-card-image.type-Standard { background: linear-gradient(135deg, #78909c, #37474f); }
.room-card-image.type-Junior { background: linear-gradient(135deg, #42a5f5, #1565c0); }
.room-card-image.type-Superior { background: linear-gradient(135deg, #66bb6a, #2e7d32); }
.room-card-image.type-Deluxe { background: linear-gradient(135deg, #ab47bc, #6a1b9a); }
.room-card-image.type-Premium { background: linear-gradient(135deg, #ffa726, #e65100); }
.room-card-image.type-Family { background: linear-gradient(135deg, #ef5350, #b71c1c); }

.room-card-image .room-floor-badge {
  display: none;
}

.room-card-body {
  padding: 8px 10px;
}

.room-card-body .room-number {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
}

.room-card-body .room-type {
  font-size: 0.72rem;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.room-card-body .room-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.room-card-body .room-meta {
  display: none;
}

.room-card-body .room-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--gray-100);
}

/* Floor group headers */
.floor-group {
  margin-bottom: 20px;
}

.floor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.floor-header i {
  font-size: 1rem;
}

.floor-header .floor-count {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Status glow indicators */
.room-card.status-Available .room-card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(46,125,50,0.15), transparent 70%);
}

/* ==============================
   Room Detail Modal
   ============================== */
.room-detail-hero {
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  border-radius: var(--radius);
  margin-bottom: 20px;
  position: relative;
}

.room-detail-hero i {
  font-size: 4rem;
  margin-bottom: 8px;
  opacity: 0.9;
}

.room-detail-hero .room-detail-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0,0,0,0.3);
  color: white;
}

.room-detail-hero .room-detail-number {
  font-size: 1.5rem;
  font-weight: 700;
}

.room-detail-hero .room-detail-type {
  font-size: 0.9rem;
  opacity: 0.85;
}

.room-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ==============================
   User Menu
   ============================== */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: var(--transition);
  position: relative;
}

.user-menu:hover {
  background: var(--gray-100);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 500;
  margin-top: 4px;
  overflow: hidden;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--gray-200);
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.user-dropdown a:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.user-dropdown a i {
  width: 18px;
  color: var(--gray-400);
}

/* ==============================
   Responsive
   ============================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.open + .main-content {
    margin-left: 0;
  }
  .main-content {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
  }
  .content-area {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Responsive table wrapper for horizontal scroll */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.table-responsive .data-table {
  min-width: 700px;
}

@media (max-width: 768px) {
  .table-responsive .data-table {
    min-width: 600px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .data-table {
    font-size: 0.8rem;
  }
  .data-table th,
  .data-table td {
    padding: 6px 8px;
  }
}
