/* ===================================================================
   HOUSE 567 APARTMENT - PMS & HOTEL MANAGEMENT SYSTEM (ADMIN)
   Responsive, Multi-Role Architecture for Mobile, Tablet & Desktop
   =================================================================== */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #070a0f;
  color: #f1f5f9;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  position: relative;
}

/* Sidebar */
.admin-sidebar {
  width: 270px;
  background: #0d131c;
  border-right: 1px solid #1c2738;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #1c2738;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}

.sidebar-nav-btn:hover {
  color: #fff;
  background: rgba(212, 175, 55, 0.08);
}

.sidebar-nav-btn.active {
  color: #0c1219;
  background: linear-gradient(135deg, #f5e4b3 0%, #d4af37 100%);
  font-weight: 700;
}

.sidebar-nav-btn .icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1c2738;
  background: #080d14;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Main Content Area */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #070a0f;
}

.admin-topbar {
  background: #0d131c;
  border-bottom: 1px solid #1c2738;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
  flex-wrap: wrap;
  gap: 12px;
}

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

.topbar-left h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.topbar-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Mobile Sidebar Toggle Button */
.admin-menu-toggle {
  display: none;
  background: #141c28;
  border: 1px solid #243245;
  color: #d4af37;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* KPI Cards Row */
.admin-content {
  padding: 28px;
  overflow-y: auto;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: #0f1622;
  border: 1px solid #1c2738;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4af37, transparent);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.kpi-badge {
  font-size: 0.72rem;
  margin-top: 6px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Room Status Grid */
.room-grid-wrap {
  background: #0f1622;
  border: 1px solid #1c2738;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 28px;
}

.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.pms-room-card {
  background: #0a0f16;
  border: 1px solid #1e2a3c;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.pms-room-card:hover {
  transform: translateY(-2px);
  border-color: #d4af37;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.pms-room-card.status-available {
  border-left: 4px solid #10b981;
}

.pms-room-card.status-occupied {
  border-left: 4px solid #3b82f6;
}

.pms-room-card.status-cleaning {
  border-left: 4px solid #f59e0b;
}

.pms-room-card.status-maintenance {
  border-left: 4px solid #ef4444;
}

.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.room-card-num {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.room-card-type {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.room-card-guest {
  font-size: 0.825rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-card-status-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  font-weight: 700;
}

.badge-available { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-occupied { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-cleaning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-maintenance { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-red { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-dark { background: rgba(255, 255, 255, 0.06); color: #94a3b8; border: 1px solid rgba(255, 255, 255, 0.12); }

.role-workspace-banner {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease;
}

/* Data Tables */
.table-card {
  background: #0f1622;
  border: 1px solid #1c2738;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 28px;
}

.table-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1c2738;
  gap: 14px;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pms-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 680px;
}

.pms-table th {
  background: #090e16;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 18px;
  border-bottom: 1px solid #1c2738;
}

.pms-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #172230;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.pms-table tr:hover td {
  background: rgba(212, 175, 55, 0.03);
}

/* Role Selector Cards in Login Screen */
.role-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.role-preset-card {
  background: #0e151f;
  border: 1px solid #202d3e;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-preset-card:hover {
  border-color: #d4af37;
  background: #141d2b;
  transform: translateY(-2px);
}

.role-preset-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-preset-details {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* Folio Receipt Modal / Print styling */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-folio, #printable-folio * {
    visibility: visible;
  }
  #printable-folio {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }
}

.folio-sheet {
  background: #fff;
  color: #111;
  padding: 36px;
  border-radius: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.folio-sheet h1, .folio-sheet h2, .folio-sheet h3 {
  color: #111;
  font-family: serif;
}

.folio-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.folio-table th, .folio-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.folio-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===================================================================
   RESPONSIVE BREAKPOINTS FOR PMS ADMIN
   =================================================================== */

@media (max-width: 900px) {
  .admin-menu-toggle {
    display: inline-flex;
  }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  }
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  .admin-content {
    padding: 18px;
  }
  .admin-topbar {
    padding: 12px 18px;
  }
}

@media (max-width: 600px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .kpi-card {
    padding: 14px;
  }
  .kpi-value {
    font-size: 1.35rem;
  }
  .room-grid {
    grid-template-columns: 1fr;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ===================================================================
   AUTH GATE (LOGGED-OUT STATE)
   Hides the entire dashboard shell and turns the login modal into an
   opaque full-screen sign-in screen until a session is restored.
   =================================================================== */
body.pms-locked .admin-layout {
  display: none;
}

body.pms-locked #login-modal {
  background: #070a0f;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.pms-locked #login-modal .modal-box {
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(212, 175, 55, 0.15);
}

body.pms-locked #login-modal .modal-close-btn {
  display: none;
}
