/* =====================================================
   APPOINTPRO — Main CSS
   ===================================================== */

:root {
  --primary:    #4f46e5;
  --primary-d:  #3730a3;
  --primary-l:  #818cf8;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #3b82f6;

  --bg:         #f8fafc;
  --surface:    #ffffff;
  --surface2:   #f1f5f9;
  --border:     #e2e8f0;
  --border2:    #cbd5e1;

  --text:       #1e293b;
  --text2:      #64748b;
  --text3:      #94a3b8;

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);

  --font: 'Inter', sans-serif;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* =====================================================
   LAYOUT
   ===================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: #fff;
}
.sidebar-logo i { color: var(--primary-l); font-size: 22px; }
.sidebar-close {
  color: rgba(255,255,255,.4); font-size: 16px;
  display: none;
}

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar { font-size: 36px; color: var(--primary-l); }
.user-name { display: block; color: #fff; font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: 1px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: rgba(255,255,255,.6);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  font-size: 18px; color: var(--text2);
  display: none; padding: 6px;
}
.page-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  position: relative;
  transition: all .2s;
}
.topbar-btn:hover { background: var(--border); color: var(--primary); }
.topbar-btn .badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger);
  color: #fff; font-size: 9px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface2);
  font-size: 13px; font-weight: 500;
  transition: all .2s;
}
.topbar-user:hover { background: var(--border); }
.topbar-user i { font-size: 22px; color: var(--primary); }

/* ── PAGE CONTENT ── */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* =====================================================
   COMPONENTS
   ===================================================== */

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--info); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.yellow { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.purple { background: #f5f3ff; color: var(--primary); }
.stat-val  { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-lbl  { font-size: 12px; color: var(--text2); margin-top: 3px; }
.stat-change {
  font-size: 11px; margin-top: 4px;
  display: flex; align-items: center; gap: 3px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { filter: brightness(.9); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #f5f3ff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; }
.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 14px;
}
.input-icon .form-control { padding-left: 36px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text2);
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ── BADGES ── */
.badge-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-purple   { background: #f3e8ff; color: #6b21a8; }
.badge-gray     { background: #f1f5f9; color: #475569; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all .2s;
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── PAGINATION ── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  margin-top: 16px; justify-content: center;
}
.page-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: all .2s;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ── TABS ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 13px; font-weight: 500;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SEARCH BAR ── */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-input-wrap i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
}
.search-input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 13px; color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--primary); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text3);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 16px; color: var(--text2); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ── FLASH MESSAGES ── */
#flash-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.flash {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--info);
  font-size: 13px; min-width: 260px;
  animation: slideInRight .3s ease;
}
.flash-success { border-left-color: var(--success); }
.flash-error   { border-left-color: var(--danger);  }
.flash button {
  margin-left: auto; font-size: 16px;
  color: var(--text3); line-height: 1;
}

/* ── TOAST ── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff;
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; min-width: 240px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.warning { background: var(--warning); }

/* ── AUTH PAGES ── */
.auth-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo i { font-size: 40px; color: var(--primary); }
.auth-logo h1 { font-size: 22px; font-weight: 700; margin-top: 8px; }
.auth-logo p  { font-size: 13px; color: var(--text2); margin-top: 4px; }
.auth-footer {
  text-align: center; margin-top: 20px;
  font-size: 13px; color: var(--text2);
}
.auth-footer a { color: var(--primary); font-weight: 500; }

/* ── CALENDAR ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header { text-align: center; font-size: 11px; font-weight: 600; color: var(--text2); padding: 8px 0; }
.cal-day {
  min-height: 80px; padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: all .2s;
}
.cal-day:hover { border-color: var(--primary); background: #f5f3ff; }
.cal-day.today { border-color: var(--primary); background: #f5f3ff; }
.cal-day.other-month { background: var(--surface2); opacity: .5; }
.cal-date { font-size: 12px; font-weight: 600; color: var(--text2); }
.cal-appt {
  font-size: 10px; margin-top: 3px;
  background: var(--primary);
  color: #fff; border-radius: 3px;
  padding: 2px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-appt.completed { background: var(--success); }
.cal-appt.cancelled { background: var(--danger); }
.cal-appt.pending   { background: var(--warning); }

/* ── BOOKING WIZARD ── */
.wizard-steps {
  display: flex; gap: 0;
  margin-bottom: 32px;
}
.wizard-step {
  flex: 1; text-align: center;
  position: relative;
}
.wizard-step::after {
  content: '';
  position: absolute; top: 16px; left: 50%;
  width: 100%; height: 2px;
  background: var(--border);
}
.wizard-step:last-child::after { display: none; }
.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  margin: 0 auto 8px;
  position: relative; z-index: 1;
  transition: all .3s;
}
.wizard-step.active .step-circle   { background: var(--primary); color: #fff; }
.wizard-step.done .step-circle     { background: var(--success); color: #fff; }
.wizard-step.done::after           { background: var(--success); }
.step-label { font-size: 11px; color: var(--text2); font-weight: 500; }
.wizard-step.active .step-label    { color: var(--primary); }

/* ── SLOT PICKER ── */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.slot-btn {
  padding: 8px 4px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  text-align: center;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  background: var(--surface);
  transition: all .2s;
  cursor: pointer;
}
.slot-btn:hover:not(.taken) { border-color: var(--primary); color: var(--primary); background: #f5f3ff; }
.slot-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.slot-btn.taken { background: var(--surface2); color: var(--text3); cursor: not-allowed; text-decoration: line-through; }

/* ── SERVICE CARDS ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.service-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}
.service-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.service-card.selected { border-color: var(--primary); background: #f5f3ff; }
.service-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.service-duration { font-size: 12px; color: var(--text2); }
.service-price { font-size: 18px; font-weight: 700; color: var(--primary); margin-top: 8px; }

/* ── STAFF CARDS ── */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.staff-pick-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}
.staff-pick-card:hover { border-color: var(--primary); }
.staff-pick-card.selected { border-color: var(--primary); background: #f5f3ff; }
.staff-pick-card i { font-size: 36px; color: var(--primary); display: block; margin-bottom: 8px; }
.staff-pick-name { font-size: 13px; font-weight: 600; }
.staff-pick-title { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── NOTIFICATION LIST ── */
.notif-item {
  display: flex; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f8f7ff; border-radius: 8px; padding: 14px; margin-bottom: 4px; }
.notif-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.notif-title { font-size: 13px; font-weight: 600; }
.notif-msg   { font-size: 12px; color: var(--text2); margin-top: 2px; }
.notif-time  { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── CHARTS ── */
.chart-wrap { position: relative; min-height: 280px; }

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ── ANIMATIONS ── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: flex; }
  .main-content  { margin-left: 0; }
  .menu-toggle   { display: flex; }
  .form-row      { grid-template-columns: 1fr; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .page-content  { padding: 16px; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-day       { min-height: 50px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card  { padding: 28px 20px; }
}
