/* ================================================================
   Glamifix CRM — Main Stylesheet
   Aesthetic: Luxury clinic — rose gold, champagne, deep charcoal
   Fonts: Cormorant Garamond (headings) + DM Sans (body)
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --rose:        #c9847a;
  --rose-light:  #f0d5d1;
  --rose-dark:   #a8584f;
  --gold:        #c9a96e;
  --gold-light:  #f5ead4;
  --gold-dark:   #9c7a3e;
  --champagne:   #f9f3ec;
  --cream:       #fdfaf6;
  --charcoal:    #2c2829;
  --charcoal2:   #3d3638;
  --muted:       #7d6e6f;
  --border:      #e8ddd9;
  --sidebar-w:   260px;
  --topbar-h:    62px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 2px 16px rgba(44,40,41,0.08);
  --shadow-md:   0 4px 28px rgba(44,40,41,0.13);
  --transition:  0.2s ease;
  --font-head:   'Cormorant Garamond', Georgia, serif;
  --font-body:   'DM Sans', -apple-system, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--champagne);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--rose-dark); text-decoration: none; }
a:hover { color: var(--rose); }
img { max-width: 100%; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--charcoal);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-head);
  font-size: 1.35rem; font-weight: 700;
  color: #fff; letter-spacing: 0.5px;
}
.brand-sub { font-size: 0.7rem; color: rgba(255,255,255,0.45); letter-spacing: 0.3px; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section-label {
  font-size: 0.62rem; font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 14px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 0.87rem; font-weight: 400;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(201,132,122,0.5);
}
.nav-item.active {
  color: #fff;
  background: rgba(201,132,122,0.15);
  border-left-color: var(--rose);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--rose-dark), var(--gold-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.8rem; font-weight: 600;
  flex-shrink: 0;
}
.user-chip-name { font-size: 0.82rem; color: #fff; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 0.68rem; color: rgba(255,255,255,0.4); }
.btn-logout {
  color: rgba(255,255,255,0.4);
  padding: 6px; border-radius: 6px;
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

/* ── Main Wrapper ───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  box-shadow: 0 1px 8px rgba(44,40,41,0.06);
}
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--charcoal); font-size: 1.2rem;
  padding: 6px;
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 600;
  color: var(--charcoal); flex: 1;
}
.topbar-right {
  display: flex; align-items: center; gap: 16px;
}
.topbar-date { font-size: 0.8rem; color: var(--muted); }
.topbar-date i { margin-right: 5px; color: var(--rose); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content { flex: 1; padding: 28px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
  font-family: var(--font-head);
  font-size: 1.8rem; font-weight: 700;
  color: var(--charcoal);
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.kpi-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 14px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.kpi-icon.rose    { background: var(--rose-light); color: var(--rose-dark); }
.kpi-icon.gold    { background: var(--gold-light);  color: var(--gold-dark); }
.kpi-icon.green   { background: #e6f9f0; color: #2d7a5e; }
.kpi-icon.blue    { background: #e6f0fa; color: #2a5fa0; }
.kpi-icon.purple  { background: #f0e8f9; color: #7040a0; }
.kpi-icon.orange  { background: #fef0e6; color: #c05a1a; }
.kpi-value {
  font-family: var(--font-head);
  font-size: 1.9rem; font-weight: 700;
  color: var(--charcoal); line-height: 1.1;
}
.kpi-label { font-size: 0.78rem; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* ── Cards / Panels ─────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-header h2 {
  font-family: var(--font-head);
  font-size: 1.15rem; font-weight: 600;
  color: var(--charcoal);
}
.card-body { padding: 22px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.855rem;
}
.data-table thead tr {
  background: var(--champagne);
  border-bottom: 2px solid var(--border);
}
.data-table th {
  padding: 11px 14px;
  text-align: left; font-weight: 600;
  color: var(--charcoal2); white-space: nowrap;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--cream); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.2px;
}
.badge-new        { background: #e6f0fa; color: #2a5fa0; }
.badge-contacted  { background: #e8f5e9; color: #2e7d32; }
.badge-interested { background: var(--gold-light); color: var(--gold-dark); }
.badge-danger     { background: #fde8e8; color: #c62828; }
.badge-followup   { background: #fff3e0; color: #e65100; }
.badge-appt       { background: #f3e5f5; color: #6a1b9a; }
.badge-success    { background: #e8f5e9; color: #2e7d32; }
.badge-lost       { background: #f5f5f5; color: #757575; }
.badge-warning    { background: #fff8e1; color: #f57f17; }
.badge-default    { background: var(--border); color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.855rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn-primary {
  background: var(--rose-dark); color: #fff;
}
.btn-primary:hover { background: var(--rose); color: #fff; }
.btn-gold {
  background: var(--gold); color: #fff;
}
.btn-gold:hover { background: var(--gold-dark); color: #fff; }
.btn-outline {
  background: transparent; color: var(--charcoal);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--champagne); }
.btn-danger {
  background: #fde8e8; color: #c62828;
  border: 1px solid #f5c6c6;
}
.btn-danger:hover { background: #c62828; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-icon { padding: 7px 10px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 0.8rem; font-weight: 600; color: var(--charcoal2);
  letter-spacing: 0.2px;
}
.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.88rem;
  color: var(--charcoal);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(201,132,122,0.15);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 18px;
}
.filter-bar .form-control { min-width: 160px; max-width: 220px; }
.search-input { min-width: 220px !important; }

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; margin: 0 0 0 0;
  font-size: 0.875rem; font-weight: 500;
  position: relative;
}
.flash-success { background: #e8f5e9; color: #2e7d32; border-bottom: 1px solid #c8e6c9; }
.flash-error   { background: #fde8e8; color: #c62828; border-bottom: 1px solid #f5c6c6; }
.flash-info    { background: #e3f2fd; color: #1565c0; border-bottom: 1px solid #bbdefb; }
.flash-close {
  margin-left: auto; background: none; border: none;
  font-size: 1.1rem; cursor: pointer; opacity: 0.5; color: inherit;
}
.flash-close:hover { opacity: 1; }

/* ── Today's followup alert ──────────────────────────────────── */
.alert-followup {
  background: linear-gradient(135deg, var(--gold-light), var(--rose-light));
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
}
.alert-followup i { color: var(--gold-dark); font-size: 1.2rem; }
.alert-followup strong { color: var(--charcoal); }

/* ── Highlight interested leads ──────────────────────────────── */
tr.hot-lead td { background: rgba(201,169,110,0.06) !important; }
tr.hot-lead td:first-child { border-left: 3px solid var(--gold); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex; gap: 6px; align-items: center;
  padding: 16px 22px; border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-link {
  padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 0.8rem; color: var(--charcoal);
  transition: all var(--transition);
}
.page-link:hover, .page-link.active {
  background: var(--rose-dark); color: #fff; border-color: var(--rose-dark);
}

/* ── Login Page ──────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: var(--charcoal);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 44px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo .brand-icon {
  width: 58px; height: 58px; font-size: 24px;
  margin: 0 auto 12px;
}
.login-logo h1 {
  font-family: var(--font-head);
  font-size: 2rem; font-weight: 700;
  color: var(--charcoal);
}
.login-logo p { font-size: 0.82rem; color: var(--muted); }
.login-card .form-group { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 0.95rem; }

/* ── Two-column layout ───────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Quick stat row ──────────────────────────────────────────── */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-chip {
  background: var(--champagne);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem; color: var(--muted);
}
.stat-chip strong { color: var(--charcoal); font-weight: 600; }

/* ── Overlay & Mobile ────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  .main-content { padding: 18px; }
  .two-col, .three-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 32px 22px; }
  .filter-bar .form-control { min-width: 140px; }
}
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-success { color: #2e7d32; }
.text-danger  { color: #c62828; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.w-100 { width: 100%; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 50px 20px;
  color: var(--muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; display: block; }
.empty-state p { font-size: 0.9rem; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%; max-width: 580px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: scale(0.93) translateY(-10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);      opacity: 1; }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-head);
  font-size: 1.15rem; font-weight: 600;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--muted);
}
.modal-close:hover { color: var(--charcoal); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Charts placeholder ──────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; }
