:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --secondary: #0D9488;
  --secondary-light: #F0FDFA;
  --dark: #0F172A;
  --light: #F8FAFC;
  --border: #E2E8F0;
  --text: #334155;
  --text-muted: #64748B;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --card-bg: #FFFFFF;
  --sidebar-bg: #1E293B;
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
}

.dark-mode {
  --primary: #6366F1;
  --primary-light: #1E1B4B;
  --secondary: #14B8A6;
  --secondary-light: #132A13;
  --dark: #F8FAFC;
  --light: #0B0F19;
  --border: #1E293B;
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --card-bg: #111827;
  --sidebar-bg: #030712;
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  transition: background-color 0.3s, border-color 0.3s;
}

body {
  background-color: var(--light);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== LOGIN SCREEN ==================== */
#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #4F46E5 0%, #0D9488 100%);
  padding: 20px;
}

.login-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.dark-mode-login {
  background: rgba(17, 24, 39, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #F8FAFC;
}

.login-logo {
  background-color: #4F46E5;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
}

.login-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #0F172A;
}

.dark-mode-login h2 {
  color: #FFF;
}

.login-card p {
  color: #64748B;
  font-size: 0.95rem;
  margin-bottom: 30px;
}

.login-error {
  background-color: #FEE2E2;
  border: 1px solid #EF4444;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: left;
  display: none;
}

.login-card .form-group {
  text-align: left;
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dark-mode-login label {
  color: #94A3B8;
}

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 12px;
  border: 1px solid #CBD5E1;
  background: white;
  color: #0F172A;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.dark-mode-login .input-icon-wrapper input {
  background: #1F2937;
  border-color: #374151;
  color: #FFF;
}

.input-icon-wrapper input:focus {
  border-color: #4F46E5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.login-btn {
  width: 100%;
  background-color: #4F46E5;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn:hover {
  opacity: 0.95;
}

.register-toggle {
  margin-top: 20px;
  font-size: 0.85rem;
  color: #64748B;
}

.register-toggle a {
  color: #4F46E5;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== LAYOUT PANELS ==================== */
#appPanel {
  width: 100%;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
aside {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #F8FAFC;
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 1000;
  flex-shrink: 0;
  transition: left 0.3s ease;
}

.brand-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.brand-logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  background-color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: white;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94A3B8;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-item.active a, .nav-item a:hover {
  color: #FFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active a {
  background-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Main Content area */
main {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  max-height: 100vh;
  width: 100%;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 16px;
}

.welcome-text h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.welcome-text p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

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

.btn-theme, .btn-menu {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn-menu {
  display: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFF;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  transition: transform 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

/* ==================== STAT CARDS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.stat-details h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-details .value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 8px;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 6px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.warning { color: var(--warning); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* ==================== CARDS & CONTAINERS ==================== */
.db-status-bar {
  background-color: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
}

.db-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.bookings-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.bookings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.search-filter-box {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  background-color: var(--light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px 10px 40px;
  border-radius: 10px;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}

.filter-select {
  background-color: var(--light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

/* ==================== TABLES ==================== */
.table-container {
  overflow-x: auto;
  margin-top: 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

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

th {
  padding: 16px;
  background-color: var(--light);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

tr:hover td {
  background-color: rgba(79, 70, 229, 0.02);
}

.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.client-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.client-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-placed { background-color: var(--primary-light); color: var(--primary); }
.badge-assigned { background-color: #FEF3C7; color: #D97706; }
.badge-inprogress { background-color: #E0F2FE; color: #0284C7; }
.badge-completed { background-color: #D1FAE5; color: var(--success); }
.badge-cancelled { background-color: #FEE2E2; color: var(--danger); }

.action-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

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

.action-btn.btn-delete:hover {
  background-color: #FEE2E2;
  color: var(--danger);
}

/* ==================== FORM SETTINGS CONTROLS ==================== */
.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

.settings-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.settings-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--light);
  color: var(--text);
  outline: none;
  font-size: 0.95rem;
}

.form-control:focus {
  border-color: var(--primary);
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 16px;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(20px);
  transition: transform 0.3s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-secondary {
  background-color: var(--light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ==================== RESPONSIVE LAYOUTS ==================== */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  aside {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
  }

  aside.open {
    left: 0;
  }

  .btn-menu {
    display: flex;
  }

  main {
    padding: 16px;
  }

  header {
    margin-bottom: 20px;
  }

  .welcome-text h1 {
    font-size: 1.4rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

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

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    align-self: flex-end;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .bookings-card {
    padding: 16px;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Sidebar backdrop */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  z-index: 999;
  display: none;
}

.sidebar-overlay.visible {
  display: block;
}
