/* ============================================================
   Help Home Care — Sales Panel  |  Main Stylesheet
   ============================================================ */

:root {
  --sidebar-w:         250px;
  --sidebar-bg:        #1B2D42;
  --sidebar-text:      rgba(255,255,255,.72);
  --sidebar-hover:     rgba(255,255,255,.07);
  --sidebar-active-bg: rgba(255,255,255,.11);
  --sidebar-accent:    #4A9EFF;
  --topbar-h:          62px;
  --page-bg:           #F2F5F9;
  --primary:           #1a5f8a;
  --primary-dark:      #134a6e;
  --shadow-card:       0 2px 16px rgba(0,0,0,.07);
  --radius:            12px;
}

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  color: #2d3748;
  background: var(--page-bg);
  margin: 0;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, #1B2D42 0%, #16253a 100%);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 28px rgba(0,0,0,.2);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

/* Brand */
.sb-brand {
  padding: 1.1rem 1.2rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none; flex-shrink: 0;
}
.sb-brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #3d9be9, #1a5f8a);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.15rem; flex-shrink: 0;
}
.sb-brand-name  { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sb-brand-sub   { color: rgba(255,255,255,.38); font-size: .65rem; letter-spacing: .3px; }

/* Nav scroll area */
.sb-nav {
  flex: 1; overflow-y: auto; padding: .5rem 0 .75rem;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 2px; }

/* Section labels */
.sb-section {
  padding: .85rem 1.2rem .2rem;
  font-size: .61rem; font-weight: 700;
  letter-spacing: 1.3px; text-transform: uppercase;
  color: rgba(255,255,255,.28);
}

/* Nav links */
.sb-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .575rem 1.2rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .855rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sb-link:hover  { background: var(--sidebar-hover); color: rgba(255,255,255,.92); }
.sb-link.active { background: var(--sidebar-active-bg); color: #fff; border-left-color: var(--sidebar-accent); }
.sb-link.active .sb-icon { color: var(--sidebar-accent); }
.sb-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sb-badge {
  margin-left: auto; background: #dc3545; color: #fff;
  font-size: .61rem; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; line-height: 1.5;
}

/* User footer */
.sb-user {
  padding: .8rem 1.2rem; flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .7rem;
}
.sb-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #3d9be9, #1a5f8a);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.sb-user-name { color: #fff; font-size: .8rem; font-weight: 600; }
.sb-user-role { color: rgba(255,255,255,.4); font-size: .67rem; text-transform: capitalize; }
.sb-logout { margin-left: auto; color: rgba(255,255,255,.4); font-size: .95rem; text-decoration: none; }
.sb-logout:hover { color: #ff6b6b; }

/* Mobile overlay */
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1039;
}
.sb-overlay.show { display: block; }

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

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: .6rem;
  position: sticky; top: 0; z-index: 1030;
  box-shadow: 0 1px 10px rgba(0,0,0,.05);
  flex-shrink: 0;
}
.topbar-toggle {
  display: none; background: none; border: none;
  font-size: 1.35rem; color: #64748b; cursor: pointer; padding: 0;
  line-height: 1;
}
.topbar-title { flex: 1; font-weight: 700; font-size: 1.02rem; color: #1B2D42; }
.topbar-btn {
  background: none; border: none;
  padding: .45rem .55rem; border-radius: 8px;
  color: #64748b; cursor: pointer; font-size: 1.1rem;
  position: relative; transition: background .15s, color .15s;
  line-height: 1;
}
.topbar-btn:hover { background: #f1f5f9; color: #1B2D42; }
.notif-dot {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: #dc3545; border-radius: 50%; border: 2px solid #fff;
  font-size: .58rem; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .65rem .35rem .45rem;
  border-radius: 8px; border: none; background: none;
  color: #374151; cursor: pointer; font-size: .855rem; font-weight: 600;
  transition: background .15s;
}
.topbar-user-btn:hover { background: #f1f5f9; }
.topbar-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3d9be9, #1a5f8a);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .73rem; font-weight: 700;
}

/* Notification dropdown */
.notif-dropdown {
  width: 340px; padding: 0 !important;
  border: none !important;
  box-shadow: 0 8px 30px rgba(0,0,0,.13) !important;
  border-radius: var(--radius) !important;
  overflow: hidden;
}
.notif-hdr {
  padding: .75rem 1rem; font-weight: 700; font-size: .83rem;
  border-bottom: 1px solid #f1f5f9; background: #fff;
  display: flex; justify-content: space-between; align-items: center;
}
.notif-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .65rem 1rem; border-bottom: 1px solid #f8fafc;
  text-decoration: none; color: inherit; transition: background .1s;
}
.notif-item:hover { background: #f8fafc; color: inherit; }
.notif-dot-type {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: .35rem;
}
.notif-title { font-size: .82rem; font-weight: 600; color: #1e293b; }
.notif-sub   { font-size: .75rem; color: #94a3b8; }
.notif-footer {
  padding: .6rem 1rem; text-align: center;
  font-size: .8rem; background: #f8fafc; color: var(--primary);
  text-decoration: none; display: block;
}
.notif-footer:hover { background: #eef4fb; }
.notif-empty { padding: 1.25rem 1rem; text-align: center; color: #94a3b8; font-size: .82rem; }

/* ── Page content ─────────────────────────────────────── */
.page-content { flex: 1; padding: 1.5rem; }

/* ── Page header ─────────────────────────────────────── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: .75rem;
  margin-bottom: 1.4rem;
}
.page-header h1 {
  font-size: 1.28rem; font-weight: 700; color: #1B2D42; margin: 0;
}

/* ── Cards ────────────────────────────────────────────── */
.card, .card-hhc {
  border: none !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  background: #fff;
}
.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-size: .845rem; font-weight: 600;
  background: #fff !important;
}

/* ── Stat cards ───────────────────────────────────────── */
.stat-card {
  border-radius: 14px !important;
  overflow: hidden; position: relative;
  padding: 1.15rem 1.3rem; color: #fff !important;
  box-shadow: 0 6px 24px rgba(0,0,0,.12) !important;
  cursor: default; transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.15) !important; }
.stat-card .stat-value { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .9px; opacity: .8; }
.stat-bg-icon {
  position: absolute; right: .8rem; top: 50%;
  transform: translateY(-50%); font-size: 3.8rem; opacity: .12; pointer-events: none;
}
.stat-grad-blue   { background: linear-gradient(135deg,#1a5f8a,#2176ae); }
.stat-grad-green  { background: linear-gradient(135deg,#16a34a,#22c55e); }
.stat-grad-purple { background: linear-gradient(135deg,#7c3aed,#a855f7); }
.stat-grad-teal   { background: linear-gradient(135deg,#0891b2,#22d3ee); }
.stat-grad-orange { background: linear-gradient(135deg,#ea580c,#fb923c); }

/* ── Tables ───────────────────────────────────────────── */
.table-hhc thead th {
  background: #f8fafc; color: #64748b;
  font-size: .71rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 2px solid #e2e8f0 !important;
  border-top: none; white-space: nowrap;
  padding: .65rem .75rem;
}
.table-hhc tbody tr { transition: background .1s; }
.table-hhc tbody tr:hover { background: #f0f6ff; }
.table-hhc td { vertical-align: middle; padding: .6rem .75rem; border-color: #f1f5f9; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-hhc {
  background: linear-gradient(135deg, var(--primary), #2176ae);
  color: #fff; border: none; border-radius: 8px;
  font-weight: 600; font-size: .855rem;
  transition: box-shadow .15s, transform .1s;
}
.btn-hhc:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; box-shadow: 0 4px 14px rgba(26,95,138,.35);
  transform: translateY(-1px);
}
.btn-hhc:active { transform: translateY(0); }

/* ── Badges ───────────────────────────────────────────── */
.badge { font-size: .73rem; border-radius: 6px; }

/* ── Follow-up timeline ───────────────────────────────── */
.followup-item {
  border-left: 3px solid var(--sidebar-accent);
  padding-left: 1rem; margin-bottom: 1.25rem; position: relative;
}
.followup-item::before {
  content: ''; width: 10px; height: 10px;
  background: var(--sidebar-accent);
  border-radius: 50%; position: absolute;
  left: -6.5px; top: 4px;
}
.followup-item .followup-meta { font-size: .77rem; color: #94a3b8; }

/* ── Forms ────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px; border: 1px solid #d1d5db;
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--sidebar-accent);
  box-shadow: 0 0 0 3px rgba(74,158,255,.15);
}
.form-label { font-size: .8rem; color: #374151; margin-bottom: .3rem; }

/* ── Alerts ───────────────────────────────────────────── */
.alert { border-radius: 10px; font-size: .875rem; border: none; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger   { background: #fff1f2; color: #be123c; }
.alert-warning  { background: #fffbeb; color: #b45309; }
.alert-info     { background: #eff6ff; color: #1d4ed8; }

/* ── Overdue / due today ──────────────────────────────── */
.overdue  { color: #dc3545 !important; font-weight: 600; }
.due-today{ color: #fd7e14 !important; font-weight: 600; }

/* ── Login page ───────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1B2D42 0%, #1a5f8a 60%, #2176ae 100%);
}
.login-card {
  width: 100%; max-width: 410px;
  border: none !important; border-radius: 18px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,.32) !important;
}

/* ── Cal grid (calendar page) ─────────────────────────── */
.cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 3px;
}
.cal-header { margin-bottom: 6px; }
.cal-dow {
  text-align: center; font-size: .67rem; font-weight: 700;
  color: #94a3b8; padding: 4px 0;
  text-transform: uppercase; letter-spacing: .5px;
}
.cal-cell {
  min-height: 78px; background: #fff;
  border: 1px solid #f1f5f9; border-radius: 8px;
  padding: 5px 4px; position: relative; transition: background .1s;
}
.cal-cell:hover { background: #f0f6ff; }
.cal-empty  { background: #fafbfc; border-color: #f5f6f8; }
.cal-weekend{ background: #fafbfd; }
.cal-past   { opacity: .6; }
.cal-today  { border-color: var(--primary) !important; border-width: 2px !important; }
.cal-today .cal-day-num {
  background: var(--primary); border-radius: 50%;
  width: 22px; height: 22px; display: flex;
  align-items: center; justify-content: center;
  color: #fff; font-size: .77rem;
}
.cal-selected { background: #eff6ff !important; border-color: var(--sidebar-accent) !important; }
.cal-day-num {
  font-size: .77rem; color: #374151; font-weight: 600;
  text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-bottom: 1px;
}
.cal-appt-pill {
  display: block; font-size: .65rem; color: #fff;
  border-radius: 4px; padding: 1px 5px; margin-bottom: 1px;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-appt-pill:hover { opacity: .85; color: #fff; filter: brightness(1.05); }
.cal-more-link { font-size: .64rem; color: var(--primary); text-decoration: none; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar        { transform: translateX(-100%); }
  .sidebar.open   { transform: translateX(0); }
  .main-wrapper   { margin-left: 0; }
  .topbar-toggle  { display: block; }
  .page-content   { padding: 1rem .85rem; }
  .stat-card .stat-value { font-size: 1.65rem; }
  .notif-dropdown { width: calc(100vw - 2rem); }
}
@media (min-width: 769px) {
  .topbar-toggle { display: none !important; }
}
