/* styles.css - Premium Glassmorphic Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette (HSL Tailored) */
  --bg-dark: hsl(222, 47%, 7%);
  --bg-panel: hsla(222, 35%, 12%, 0.65);
  --bg-panel-solid: hsl(222, 35%, 12%);
  --bg-card: hsla(223, 33%, 16%, 0.45);
  --bg-card-hover: hsla(223, 33%, 22%, 0.6);
  --border-light: hsla(217, 33%, 25%, 0.3);
  --border-glow: hsla(180, 100%, 50%, 0.2);
  
  --accent-teal: hsl(180, 100%, 50%);
  --accent-teal-glow: hsla(180, 100%, 50%, 0.15);
  --accent-emerald: hsl(142, 70%, 45%);
  --accent-emerald-glow: hsla(142, 70%, 45%, 0.15);
  --accent-amber: hsl(38, 92%, 50%);
  --accent-amber-glow: hsla(38, 92%, 50%, 0.15);
  --accent-red: hsl(0, 84%, 60%);
  --accent-red-glow: hsla(0, 84%, 60%, 0.15);
  --accent-blue: hsl(210, 100%, 60%);
  --accent-blue-glow: hsla(210, 100%, 60%, 0.15);
  --accent-indigo: hsl(250, 85%, 65%);

  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --text-muted: hsl(215, 16%, 50%);
  
  --sidebar-width: 280px;
  --header-height: 80px;
  
  --font-family: 'Outfit', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px 0 hsla(180, 100%, 50%, 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
}

/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, hsla(250, 85%, 65%, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(180, 100%, 50%, 0.06) 0px, transparent 50%),
    radial-gradient(at 50% 0%, hsla(222, 47%, 7%, 0.5) 0px, var(--bg-dark) 100%);
  background-attachment: fixed;
  display: flex;
}

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

/* Main Layout Shell */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar Styling (Glassmorphism) */
aside.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-light);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
}

.sidebar-logo svg {
  color: var(--accent-teal);
  filter: drop-shadow(0 0 8px var(--accent-teal-glow));
}

.sidebar-logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  transition: var(--transition-smooth);
}

.nav-item:hover {
  background: hsla(217, 33%, 20%, 0.4);
  color: var(--text-primary);
  border-color: var(--border-light);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-teal-glow) 0%, transparent 100%);
  color: var(--accent-teal);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.nav-item.active svg {
  color: var(--accent-teal);
  filter: drop-shadow(0 0 6px var(--accent-teal-glow));
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Main Content Area */
main.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 2rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header Component */
header.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.header-title h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-panel);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-light);
}

.profile-info {
  text-align: right;
}

.profile-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.profile-role {
  font-size: 0.75rem;
  color: var(--accent-teal);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--border-light);
}

/* Screens Layout Container */
.screen-container {
  animation: fadeIn 0.4s ease-out;
  display: none; /* Controlled by JS */
  flex-direction: column;
  gap: 2rem;
}

.screen-container.active {
  display: flex;
}

/* Glassmorphism Panel Container */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
}

.glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* Dashboard Cards Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition-smooth);
  position: relative;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.teal { background: var(--accent-teal-glow); color: var(--accent-teal); }
.stat-icon.emerald { background: var(--accent-emerald-glow); color: var(--accent-emerald); }
.stat-icon.amber { background: var(--accent-amber-glow); color: var(--accent-amber); }
.stat-icon.red { background: var(--accent-red-glow); color: var(--accent-red); }

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

/* Room Grid Section */
.room-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-top: 1rem;
}

.room-card {
  background: var(--bg-panel);
  border: 2px solid var(--border-light);
  border-radius: 20px;
  overflow: hidden;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-premium);
}

.room-card:hover {
  transform: translateY(-8px);
}

.room-card.available { border-color: var(--accent-teal-glow); }
.room-card.booked { border-color: var(--accent-amber-glow); }
.room-card.occupied { border-color: var(--accent-emerald-glow); }
.room-card.dirty { border-color: var(--accent-red-glow); }

.room-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}

.room-card.available .room-header { background: linear-gradient(135deg, hsla(180, 100%, 50%, 0.08), transparent); }
.room-card.booked .room-header { background: linear-gradient(135deg, hsla(38, 92%, 50%, 0.08), transparent); }
.room-card.occupied .room-header { background: linear-gradient(135deg, hsla(142, 70%, 45%, 0.08), transparent); }
.room-card.dirty .room-header { background: linear-gradient(135deg, hsla(0, 84%, 60%, 0.08), transparent); }

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

.room-status-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.room-card.available .room-status-badge { background: var(--accent-teal-glow); color: var(--accent-teal); }
.room-card.booked .room-status-badge { background: var(--accent-amber-glow); color: var(--accent-amber); }
.room-card.occupied .room-status-badge { background: var(--accent-emerald-glow); color: var(--accent-emerald); }
.room-card.dirty .room-status-badge { background: var(--accent-red-glow); color: var(--accent-red); }

.room-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 180px;
}

.room-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.detail-row svg {
  width: 18px;
  height: 18px;
  color: var(--accent-teal);
}

.detail-row .value {
  font-weight: 500;
  color: var(--text-primary);
}

.room-actions {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding: 1.25rem 1.75rem;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  flex-grow: 1;
}

.btn-primary {
  background: var(--accent-teal);
  color: var(--bg-dark);
  box-shadow: 0 4px 14px var(--accent-teal-glow);
}

.btn-primary:hover {
  background: hsl(180, 100%, 40%);
  transform: translateY(-2px);
}

.btn-secondary {
  background: hsla(217, 33%, 20%, 0.5);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: hsla(217, 33%, 20%, 0.8);
  border-color: var(--text-secondary);
}

.btn-accent {
  background: var(--accent-emerald);
  color: var(--bg-dark);
  box-shadow: 0 4px 14px var(--accent-emerald-glow);
}

.btn-accent:hover {
  background: hsl(142, 70%, 38%);
  transform: translateY(-2px);
}

.btn-alert {
  background: var(--accent-red);
  color: var(--text-primary);
  box-shadow: 0 4px 14px var(--accent-red-glow);
}

.btn-alert:hover {
  background: hsl(0, 84%, 50%);
  transform: translateY(-2px);
}

.btn-warning {
  background: var(--accent-amber);
  color: var(--bg-dark);
  box-shadow: 0 4px 14px var(--accent-amber-glow);
}

.btn-warning:hover {
  background: hsl(38, 92%, 42%);
  transform: translateY(-2px);
}

/* Modals System (Popup Overlay) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 8, 15, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 580px;
  box-shadow: var(--shadow-premium);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--accent-red);
}

/* Forms Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  background: hsla(217, 33%, 8%, 0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: var(--shadow-glow);
}

/* Smart Checkout Specific Layouts */
.smart-checkout-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.checkout-summary-box {
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.summary-row.total {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-teal);
  border-top: 1px solid var(--border-light);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.checkout-stock-section h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkout-stock-section h4 svg {
  color: var(--accent-amber);
}

.checkout-stock-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.checkout-stock-item {
  background: hsla(217, 33%, 8%, 0.4);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkout-stock-item-info {
  display: flex;
  flex-direction: column;
}

.checkout-item-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.checkout-item-stock {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checkout-stock-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.counter-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  background: hsla(217, 33%, 20%, 0.5);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.counter-btn:hover {
  background: var(--border-light);
}

.counter-value {
  font-size: 0.9rem;
  font-weight: 600;
  width: 20px;
  text-align: center;
}

/* Inventory List Styling */
.inventory-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
}

.tab-btn.active {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
}

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}

table.premium-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.premium-table th, table.premium-table td {
  padding: 1rem 1.5rem;
}

table.premium-table th {
  background: hsla(217, 33%, 8%, 0.6);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light);
}

table.premium-table td {
  border-bottom: 1px solid var(--border-light);
  font-size: 0.95rem;
}

table.premium-table tr:last-child td {
  border-bottom: none;
}

table.premium-table tbody tr:hover {
  background: hsla(217, 33%, 20%, 0.15);
}

.stock-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.stock-badge.good { background: var(--accent-emerald-glow); color: var(--accent-emerald); }
.stock-badge.warning { background: var(--accent-amber-glow); color: var(--accent-amber); }
.stock-badge.critical { background: var(--accent-red-glow); color: var(--accent-red); }

/* Double Column Layouts */
.content-columns {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 2rem;
}

/* History logs list style */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.log-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-item-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.log-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.log-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.log-value.income { color: var(--accent-emerald); }
.log-value.expense { color: var(--accent-red); }

/* Visual Chart Component via SVG */
.chart-container {
  height: 250px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2.5rem;
  padding: 1.5rem 1rem 0.5rem;
  border-bottom: 2px solid var(--border-light);
  position: relative;
  justify-content: center;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  justify-content: flex-end;
  width: 70px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 180px;
  width: 100%;
  justify-content: center;
}

.chart-bar {
  width: 24px;
  border-radius: 4px 4px 0 0;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-height: 5px;
  position: relative;
}

.chart-bar.income {
  background: linear-gradient(0deg, var(--accent-emerald-glow) 0%, var(--accent-emerald) 100%);
  box-shadow: 0 4px 10px hsla(142, 70%, 45%, 0.2);
}

.chart-bar.expense {
  background: linear-gradient(0deg, var(--accent-red-glow) 0%, var(--accent-red) 100%);
  box-shadow: 0 4px 10px hsla(0, 84%, 60%, 0.2);
}

.chart-bar:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.chart-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.income { background: var(--accent-emerald); }
.legend-color.expense { background: var(--accent-red); }
.legend-color.net-profit { background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue)); }

/* Net Profit / Loss bar */
.chart-bar.net-profit {
  background: linear-gradient(0deg, hsla(180, 100%, 50%, 0.15) 0%, var(--accent-teal) 100%);
  box-shadow: 0 4px 10px hsla(180, 100%, 50%, 0.25);
}

.chart-bar.net-loss {
  background: linear-gradient(0deg, hsla(0, 84%, 60%, 0.15) 0%, var(--accent-amber) 100%);
  box-shadow: 0 4px 10px hsla(38, 92%, 50%, 0.2);
}

/* Net income stat card dynamic colors */
#stat-net-card.profit {
  background: hsla(180, 100%, 50%, 0.04);
  border-color: hsla(180, 100%, 50%, 0.2);
}

#stat-net-card.loss {
  background: hsla(0, 84%, 60%, 0.04);
  border-color: hsla(0, 84%, 60%, 0.2);
}

/* ======================================== */
/* LINE CHART - Annual Net Income           */
/* ======================================== */
.line-chart-wrapper {
  width: 100%;
  height: 280px;
  position: relative;
}

.line-chart-wrapper svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Grid lines */
.line-chart-grid line {
  stroke: var(--border-light);
  stroke-width: 1;
  stroke-dasharray: 4, 4;
}

/* Zero baseline */
.line-chart-zero {
  stroke: hsla(215, 16%, 50%, 0.5);
  stroke-width: 1.5;
  stroke-dasharray: 6, 3;
}

/* Area fill under/over line */
.line-chart-area-profit {
  fill: url(#areaGradientProfit);
  opacity: 0.35;
}

.line-chart-area-loss {
  fill: url(#areaGradientLoss);
  opacity: 0.25;
}

/* The main data line */
.line-chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px hsla(180, 100%, 50%, 0.3));
}

/* Data point dots */
.line-chart-dot {
  r: 5;
  stroke-width: 2.5;
  stroke: var(--bg-panel-solid);
  cursor: pointer;
  transition: all 0.2s ease;
}

.line-chart-dot:hover {
  r: 8;
  filter: drop-shadow(0 0 8px currentColor);
}

.line-chart-dot.profit {
  fill: var(--accent-teal);
}

.line-chart-dot.loss {
  fill: var(--accent-red);
}

.line-chart-dot.zero {
  fill: var(--text-muted);
}

/* Tooltip on hover */
.line-chart-tooltip {
  position: absolute;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 50;
  box-shadow: var(--shadow-premium);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.line-chart-tooltip.visible {
  opacity: 1;
}

.line-chart-tooltip .tooltip-month {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.line-chart-tooltip .tooltip-value {
  font-weight: 700;
  font-size: 0.9rem;
}

.line-chart-tooltip .tooltip-value.profit { color: var(--accent-teal); }
.line-chart-tooltip .tooltip-value.loss { color: var(--accent-red); }

/* X-axis month labels */
.line-chart-x-label {
  font-size: 0.72rem;
  fill: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-family);
  text-anchor: middle;
}

.line-chart-x-label.current-month {
  fill: var(--accent-teal);
  font-weight: 700;
  font-size: 0.78rem;
}

/* Y-axis value labels */
.line-chart-y-label {
  font-size: 0.7rem;
  fill: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-family);
  text-anchor: end;
}

/* Zero label */
.line-chart-zero-label {
  font-size: 0.72rem;
  fill: var(--text-secondary);
  font-weight: 600;
  font-family: var(--font-family);
  text-anchor: end;
}

/* Year badge label */
.line-chart-year-label {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-teal);
  letter-spacing: 0.5px;
}

/* Keyframes Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utility action buttons in list */
.action-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.action-icon-btn:hover {
  background: hsla(217, 33%, 20%, 0.5);
}

.action-icon-btn.delete:hover {
  color: var(--accent-red);
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .content-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  aside.sidebar {
    width: 70px;
    padding: 2rem 0.5rem;
  }
  .sidebar-logo h1, .sidebar-logo span, .sidebar-logo svg + h1, .nav-item span, .sidebar-footer {
    display: none;
  }
  .sidebar-logo {
    justify-content: center;
    padding-bottom: 1rem;
  }
  .nav-item {
    justify-content: center;
    padding: 0.75rem;
  }
  main.main-content {
    margin-left: 70px;
    padding: 1.5rem;
  }
  .room-grid {
    grid-template-columns: 1fr;
  }
}

/* Calendar Screen Specific Styles */
.calendar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-month-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-controls {
  display: flex;
  gap: 0.5rem;
}

.calendar-arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsla(217, 33%, 20%, 0.5);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.calendar-arrow-btn:hover {
  background: var(--border-light);
  color: var(--accent-teal);
  border-color: var(--accent-teal-glow);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.5rem;
}

.calendar-cell {
  background: hsla(223, 33%, 12%, 0.45);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  min-height: 110px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.calendar-cell:hover {
  background: hsla(223, 33%, 18%, 0.6);
  border-color: var(--border-glow);
}

.calendar-cell.outside {
  opacity: 0.25;
  pointer-events: none;
}

.calendar-cell.today {
  border-color: var(--accent-teal);
  box-shadow: 0 0 10px hsla(180, 100%, 50%, 0.1);
  background: hsla(180, 100%, 50%, 0.03);
}

.calendar-date-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  align-self: flex-end;
}

.calendar-cell.today .calendar-date-number {
  color: var(--accent-teal);
}

.calendar-events-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 75px;
}

.calendar-event-tag {
  font-size: 0.72rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.calendar-event-tag:hover {
  filter: brightness(1.2);
  transform: scale(1.02);
}

.calendar-event-tag.room-1 {
  background: hsla(180, 100%, 50%, 0.15);
  color: var(--accent-teal);
  border-color: hsla(180, 100%, 50%, 0.3);
}

.calendar-event-tag.room-2 {
  background: hsla(330, 100%, 65%, 0.15);
  color: hsl(330, 100%, 75%);
  border-color: hsla(330, 100%, 65%, 0.3);
}

.calendar-event-tag.checked-out {
  opacity: 0.55;
  text-decoration: line-through;
}

/* ======================================== */
/* PREMIUM FROSTED GLASS LOADING SCREEN     */
/* ======================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 26, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

.loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 3rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-premium), 0 0 40px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  max-width: 90%;
  text-align: center;
}

.loading-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-teal), transparent);
}

.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--accent-teal);
  border-right-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  position: relative;
  z-index: 10;
}

.spinner-glow {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: 0 0 20px var(--accent-teal-glow);
  opacity: 0.8;
  animation: pulse-glow 2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

/* ======================================== */
/* PREMIUM MOBILE APP UI & RESPONSIVENESS    */
/* ======================================== */

/* Hide mobile tab bar by default on desktop */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  /* 1. Global Page Margins & Hiding Sidebar */
  aside.sidebar {
    display: none !important;
  }
  
  main.main-content {
    margin-left: 0 !important;
    padding: 1.25rem 1rem !important;
    padding-bottom: 90px !important; /* Space for bottom nav bar */
    gap: 1.25rem !important;
  }

  /* 2. Top Header adjustments */
  header.header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    gap: 0.5rem;
  }

  .header-title h2 {
    font-size: 1.35rem !important;
  }

  .header-title p {
    font-size: 0.78rem !important;
  }

  .header-profile {
    padding: 0.35rem 0.65rem !important;
    gap: 0.5rem !important;
    border-radius: var(--border-radius-md) !important;
  }

  .profile-info {
    display: none !important; /* Hide name/role text on narrow screens, keep avatar */
  }

  .profile-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.8rem !important;
  }

  /* 3. Responsive Grids */
  .dashboard-grid {
    grid-template-columns: 1fr !important; /* Stacked layout for cards */
    gap: 1rem !important;
  }

  .room-grid {
    grid-template-columns: 1fr !important; /* Stacked rooms */
    gap: 1.25rem !important;
  }

  .room-body {
    min-height: auto !important;
    padding: 1.25rem !important;
  }

  .room-header {
    padding: 1.25rem !important;
  }

  .room-actions {
    padding: 1rem 1.25rem !important;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .room-actions .btn {
    width: 100%;
    flex-grow: 1;
  }

  /* 4. Stat Cards compact styling */
  .stat-card {
    padding: 1.25rem !important;
    gap: 1rem !important;
  }

  .stat-value {
    font-size: 1.4rem !important;
  }

  /* 5. SVG Line Charts & Charts */
  .line-chart-wrapper {
    height: 200px !important; /* Shorter for mobile viewports */
  }

  .line-chart-year-label {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
  }

  #net-income-line-panel h3 {
    font-size: 1rem !important;
  }

  #net-income-line-panel p {
    font-size: 0.75rem !important;
  }

  /* 6. Form Modals sizing */
  .modal-content {
    padding: 1.5rem !important;
    margin: 1.5rem auto !important;
    width: calc(100% - 2rem) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    border-radius: var(--border-radius-md) !important;
  }

  .modal-title {
    font-size: 1.15rem !important;
  }

  .smart-checkout-grid {
    grid-template-columns: 1fr !important; /* Single column */
    gap: 1rem !important;
  }

  /* 7. Tables Horizontal Scroll */
  .table-container {
    overflow-x: auto !important;
    width: 100% !important;
    border-radius: var(--border-radius-md) !important;
    -webkit-overflow-scrolling: touch; /* Smooth inertia scrolling for iOS */
  }

  .premium-table th, .premium-table td {
    padding: 0.75rem 0.75rem !important;
    font-size: 0.82rem !important;
  }

  .tab-btn {
    padding: 0.6rem 1rem !important;
    font-size: 0.8rem !important;
  }

  /* 8. Calendar UI Mobile Optimizations */
  .calendar-header {
    flex-direction: column !important;
    gap: 0.75rem !important;
    align-items: stretch !important;
  }

  .calendar-controls {
    justify-content: space-between !important;
    width: 100% !important;
  }

  .calendar-grid-header {
    font-size: 0.72rem !important;
  }

  .calendar-cell {
    min-height: 80px !important;
    padding: 4px !important;
  }

  .calendar-date-number {
    font-size: 0.8rem !important;
  }

  .calendar-event-tag {
    font-size: 0.65rem !important;
    padding: 2px 3px !important;
    white-space: normal !important;
    word-break: break-all !important;
    line-height: 1.1 !important;
  }

  /* 9. Mobile Bottom Tab Bar Style (Premium Glassmorphism Overlay) */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 70px;
    background: hsla(222, 47%, 8%, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)); /* Dynamic iPhone bar padding */
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  }

  .mobile-tab-bar .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0.4rem 0 !important;
    flex-grow: 1;
    color: var(--text-secondary);
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    transition: var(--transition-smooth);
  }

  .mobile-tab-bar .nav-item span {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.2px;
  }

  .mobile-tab-bar .nav-item svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
  }

  .mobile-tab-bar .nav-item.active {
    color: var(--accent-teal) !important;
  }

  .mobile-tab-bar .nav-item.active svg {
    color: var(--accent-teal) !important;
    transform: translateY(-2px);
    filter: drop-shadow(0 0 6px var(--accent-teal-glow));
  }
}

/* ======================================== */
/* ROLE-BASED ACCESS CONTROL VISIBILITY     */
/* ======================================== */

/* When not logged in, hide admin-only elements */
body:not(.admin-logged-in) .admin-only {
  display: none !important;
}

/* When logged in, hide non-admin placeholders */
body.admin-logged-in .non-admin-only {
  display: none !important;
}


