:root {
  --primary: #6C3FC5;
  --primary-dark: #3B0764;
  --primary-light: #8B5CF6;
  --accent: #F3E8FF;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; background: #f8f5ff; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, #3B0764 0%, #6C3FC5 100%);
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: all 0.3s;
  box-shadow: 4px 0 15px rgba(108,63,197,0.3);
  overflow-y: auto;
}

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

.sidebar .brand h6 { color: #fff; font-size: 13px; opacity: 0.8; margin-bottom: 4px; }
.sidebar .brand h5 { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.3; margin: 0; }

.sidebar .nav-link {
  color: rgba(255,255,255,0.8) !important;
  padding: 12px 20px;
  border-radius: 8px;
  margin: 2px 10px;
  transition: all 0.2s;
  font-size: 14px;
  text-decoration: none;
  display: block;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255,255,255,0.15) !important;
  color: #fff !important;
  transform: translateX(4px);
}
.sidebar .nav-link i { width: 20px; text-align: center; }

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: #f8f5ff;
  transition: all 0.3s;
}

/* Top navbar */
.top-navbar {
  background: #fff;
  padding: 15px 25px;
  border-bottom: 1px solid #e8e0f5;
  box-shadow: 0 2px 10px rgba(108,63,197,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-navbar h4 {
  color: var(--primary-dark);
  font-weight: 700;
  margin: 0;
  font-size: 18px;
}

/* Page content */
.page-content { padding: 25px; }

/* Cards */
.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(108,63,197,0.08);
}
.card-header {
  background: linear-gradient(135deg, #6C3FC5, #8B5CF6);
  color: white;
  border-radius: 16px 16px 0 0 !important;
  padding: 15px 20px;
  font-weight: 600;
}

/* Stats cards */
.stat-card {
  border-radius: 16px;
  padding: 20px;
  color: white;
  transition: transform 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-card.purple { background: linear-gradient(135deg, #6C3FC5, #8B5CF6); }
.stat-card.violet { background: linear-gradient(135deg, #7C3AED, #A78BFA); }
.stat-card.indigo { background: linear-gradient(135deg, #4F46E5, #818CF8); }
.stat-card.pink { background: linear-gradient(135deg, #BE185D, #F472B6); }
.stat-number { font-size: 32px; font-weight: 700; }
.stat-label { font-size: 13px; opacity: 0.9; }
.stat-icon { font-size: 40px; opacity: 0.3; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); }

/* Buttons */
.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-primary:hover { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

/* Table */
.table-container { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(108,63,197,0.08); }
.table { margin-bottom: 0; }
.table thead th {
  background: linear-gradient(135deg, #6C3FC5, #8B5CF6);
  color: white;
  font-weight: 600;
  border: none;
  padding: 14px 16px;
  white-space: nowrap;
  font-size: 13px;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #f8f5ff; }
.table tbody td { padding: 12px 16px; vertical-align: middle; border-color: #f0e8ff; font-size: 14px; }

/* Status badges */
.badge-scheduled { background: #EDE9FE; color: #6C3FC5; }
.badge-completed { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-noshow { background: #FEF3C7; color: #92400E; }
.badge { border-radius: 20px; padding: 5px 12px; font-weight: 500; font-size: 12px; }

/* Day badges */
.day-badge {
  background: #F3E8FF;
  color: #6C3FC5;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}
.day-badge.sunday { background: #FEE2E2; color: #991B1B; }
.day-badge.saturday { background: #FEF3C7; color: #92400E; }

/* Search/Filter bar */
.filter-bar { background: white; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(108,63,197,0.06); }

/* Modal */
.modal-header { background: linear-gradient(135deg, #6C3FC5, #8B5CF6); color: white; }
.modal-header .btn-close { filter: invert(1); }
.modal-content { border-radius: 12px; border: none; }

/* Select2 */
.select2-container--default .select2-selection--single {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  height: 38px;
  padding: 5px 10px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-results__option--highlighted { background: var(--primary) !important; }
.select2-container { width: 100% !important; }

/* Form */
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(108,63,197,0.15);
}
.form-label { font-weight: 600; color: #374151; font-size: 14px; }

/* Time display */
.time-slot {
  background: #EDE9FE;
  color: #5B21B6;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

/* Appointment number */
.appt-id { color: #9CA3AF; font-size: 12px; }

/* Mobile hamburger */
.hamburger-btn {
  display: none;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* Action buttons */
.btn-action { padding: 5px 10px; font-size: 12px; border-radius: 6px; margin: 1px; }

/* Loading */
.loading-spinner { display: none; }
.loading .loading-spinner { display: inline-block; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9CA3AF;
}
.empty-state i { font-size: 64px; color: #D1D5DB; margin-bottom: 20px; }
.empty-state h5 { color: #6B7280; }

/* Sortable header */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #5a32a3 !important; }
th.sortable i { margin-left: 4px; font-size: 11px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { left: -260px; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; }
  .hamburger-btn { display: inline-flex; align-items: center; gap: 6px; }
  .page-content { padding: 15px; }
  .stat-card { margin-bottom: 12px; }
  .table-responsive { font-size: 13px; }
  .top-navbar h4 { font-size: 14px; }
  .filter-bar .row > div { margin-bottom: 8px; }
}

/* Print */
@media print {
  .sidebar, .hamburger-btn, .btn-action, .filter-bar, .top-navbar, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 10px; }
  .stat-card { break-inside: avoid; }
}
