/* ClinicOS Design System - Complete CSS */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:          #1E6FD9;
  --primary-dark:     #1558B0;
  --primary-light:    #E8F1FB;
  --secondary:        #00C98D;
  --secondary-dark:   #00A874;
  --secondary-light:  #E6FBF5;
  --white:            #FFFFFF;
  --bg:               #F4F7FD;
  --surface:          #FFFFFF;
  --border:           #DDE4F0;
  --text-primary:     #1A2340;
  --text-secondary:   #5A6A8A;
  --text-muted:       #9AABC2;
  --danger:           #E53E3E;
  --warning:          #F6AD55;
  --sidebar-bg:       #0F1E3D;
  --sidebar-text:     #A8BBDA;
  --sidebar-active:   #1E6FD9;
  --shadow-sm:        0 2px 8px rgba(30,111,217,0.08);
  --shadow-md:        0 4px 20px rgba(30,111,217,0.12);
  --shadow-lg:        0 8px 40px rgba(30,111,217,0.16);
  --radius:           12px;
  --radius-sm:        8px;
  --radius-lg:        20px;
  --transition:       all 0.25s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
}
.sidebar-brand span {
  font-size: 17px; font-weight: 700; color: white; letter-spacing: -0.3px;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section-label {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(168,187,218,0.4);
  padding: 14px 14px 6px;
}
.nav-item { margin-bottom: 2px; }
.nav-item > a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}
.nav-item > a:hover {
  background: rgba(255,255,255,0.07);
  color: white;
  transform: translateX(3px);
}
.nav-item > a.active {
  background: var(--sidebar-active);
  color: white;
  box-shadow: 0 4px 15px rgba(30,111,217,0.4);
}
.nav-item > a i { font-size: 17px; width: 22px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white; flex-shrink: 0;
}
.sidebar-user .info .name { font-size: 13px; font-weight: 600; color: white; }
.sidebar-user .info .role-label {
  font-size: 10.5px; color: var(--sidebar-text); opacity: 0.7;
}

/* ---- MAIN CONTENT ---- */
.main-content { margin-left: 260px; min-height: 100vh; }
.topbar {
  background: white;
  height: 64px;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 999;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.hamburger {
  display: none; background: none; border: none;
  font-size: 20px; color: var(--text-primary); cursor: pointer;
  padding: 4px;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer;
  transition: var(--transition); font-size: 17px; color: var(--text-secondary);
  border: none;
}
.topbar-icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 1.5px solid white;
}
.page-content { padding: 28px; }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.page-header-left h4 {
  font-size: 22px; font-weight: 700; margin: 0 0 4px;
}
.breadcrumb { margin: 0; font-size: 12px; }
.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { transform: scaleX(1); }
.stat-card.green::before { background: var(--secondary); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-icon {
  width: 54px; height: 54px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary-dark); }
.stat-icon.orange { background: #FFF3E6; color: #E87722; }
.stat-icon.red { background: #FEE8E8; color: var(--danger); }
.stat-info .label {
  font-size: 11px; color: var(--text-muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
}
.stat-info .value {
  font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2;
}
.stat-info .change { font-size: 11.5px; font-weight: 500; margin-top: 2px; }
.change.up { color: var(--secondary-dark); }
.change.down { color: var(--danger); }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header-custom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; margin: 0; }
.card-body-custom { padding: 22px; }

/* ---- BUTTONS ---- */
.btn {
  font-family: 'Poppins', sans-serif;
  font-weight: 500; font-size: 13.5px;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  transition: var(--transition);
  border: none; display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary); color: white;
  box-shadow: 0 4px 12px rgba(30,111,217,0.25);
}
.btn-primary:hover {
  background: var(--primary-dark); color: white;
  box-shadow: 0 6px 18px rgba(30,111,217,0.38);
  transform: translateY(-1px);
}
.btn-success {
  background: var(--secondary); color: white;
  box-shadow: 0 4px 12px rgba(0,201,141,0.25);
}
.btn-success:hover {
  background: var(--secondary-dark); color: white; transform: translateY(-1px);
}
.btn-outline-primary {
  border: 1.5px solid var(--primary); color: var(--primary); background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-lg { padding: 13px 30px; font-size: 15px; }
.btn-icon { padding: 8px 10px; }

/* ---- TABLES ---- */
.table-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.table { margin: 0; font-size: 13.5px; width: 100%; }
.table thead th {
  background: var(--bg); color: var(--text-secondary);
  font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  padding: 13px 16px; white-space: nowrap;
}
.table tbody td {
  padding: 13px 16px; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--primary-light); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---- STATUS BADGES ---- */
.badge {
  font-family: 'Poppins', sans-serif;
  font-size: 11px; font-weight: 600;
  padding: 4px 11px; border-radius: 20px; letter-spacing: 0.2px;
  display: inline-block;
}
.badge-pending   { background: #FFF3CD; color: #856404; }
.badge-confirmed { background: var(--primary-light); color: var(--primary); }
.badge-completed { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-cancelled { background: #FEE8E8; color: var(--danger); }
.badge-no-show   { background: #F0F0F0; color: #666; }
.badge-active    { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-inactive  { background: #F0F0F0; color: #888; }
.badge-new       { background: #E8F1FB; color: var(--primary); }
.badge-hot       { background: #FEE8E8; color: var(--danger); }

/* ---- FORMS ---- */
.form-label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13.5px; font-family: 'Poppins', sans-serif;
  color: var(--text-primary); background: white;
  transition: var(--transition);
  width: 100%;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,111,217,0.1);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.invalid-feedback { font-size: 11.5px; font-weight: 500; color: var(--danger); display: block; margin-top: 4px; }

/* ---- ALERTS ---- */
.alert {
  border: none; border-radius: var(--radius-sm);
  padding: 13px 18px; font-size: 13.5px; font-weight: 500;
  border-left: 4px solid;
  display: flex; align-items: center; gap: 10px;
  animation: slideDown 0.3s ease;
  margin-bottom: 1rem;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert-success { background: var(--secondary-light); border-left-color: var(--secondary); color: var(--secondary-dark); }
.alert-danger   { background: #FEE8E8; border-left-color: var(--danger); color: var(--danger); }
.alert-warning  { background: #FFF8EC; border-left-color: var(--warning); color: #9A6700; }
.alert-info     { background: var(--primary-light); border-left-color: var(--primary); color: var(--primary-dark); }

/* ---- SLOT PICKER ---- */
.slot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px; margin-top: 14px;
}
.slot-btn {
  padding: 9px 6px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: white;
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  text-align: center; cursor: pointer; transition: var(--transition);
  font-family: 'Poppins', sans-serif;
}
.slot-btn:hover:not(.booked) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.slot-btn.selected { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 12px rgba(30,111,217,0.3); }
.slot-btn.booked { background: #F5F5F5; color: var(--text-muted); cursor: not-allowed; text-decoration: line-through; }

/* ---- BOOKING STEPPER ---- */
.stepper { display: flex; align-items: center; margin-bottom: 36px; }
.step { display: flex; align-items: center; flex: 1; }
.step-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--text-muted);
  flex-shrink: 0; transition: var(--transition);
}
.step.active .step-circle { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 4px 15px rgba(30,111,217,0.35); }
.step.done .step-circle { background: var(--secondary); border-color: var(--secondary); color: white; }
.step-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); margin-left: 9px; white-space: nowrap; }
.step.active .step-label { color: var(--primary); }
.step.done .step-label { color: var(--secondary-dark); }
.step-connector { flex: 1; height: 2px; background: var(--border); margin: 0 10px; transition: background 0.4s; }
.step-connector.done { background: var(--secondary); }

/* ---- DOCTOR CARDS ---- */
.doctor-card {
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-align: center; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.doctor-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: var(--primary); transform: scaleX(0); transition: transform 0.3s;
}
.doctor-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.doctor-card:hover::after { transform: scaleX(1); }
.doctor-card.selected { border-color: var(--primary); background: var(--primary-light); }
.doctor-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; margin: 0 auto 12px;
  overflow: hidden;
}
.doctor-avatar img { width: 100%; height: 100%; object-fit: cover; }
.doctor-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.doctor-spec { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.doctor-meta { font-size: 11.5px; color: var(--text-secondary); }
.doctor-fee { font-size: 14px; font-weight: 700; color: var(--primary); margin-top: 8px; }

/* ---- MODAL ---- */
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

/* ---- KANBAN (CRM) ---- */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col {
  min-width: 260px; background: var(--bg);
  border-radius: var(--radius); padding: 16px; flex: 1;
}
.kanban-col-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 14px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: space-between;
}
.lead-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  margin-bottom: 10px; cursor: pointer; transition: var(--transition);
}
.lead-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.lead-name { font-size: 13.5px; font-weight: 600; }
.lead-phone { font-size: 12px; color: var(--text-muted); }

/* ---- TIMELINE (Visit History) ---- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-dot {
  position: absolute; left: -26px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
}
.timeline-date { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.timeline-title { font-size: 14px; font-weight: 700; margin: 4px 0; }

/* ---- BOOKING SUCCESS ---- */
.success-checkmark {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--secondary-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.success-checkmark i { font-size: 38px; color: var(--secondary-dark); animation: checkDraw 0.4s 0.3s both; }
@keyframes checkDraw { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }

/* ---- CHATBOT WIDGET ---- */
.chat-bubble-btn {
  position: fixed; bottom: 90px; right: 24px;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: white;
  border: none; font-size: 22px;
  box-shadow: 0 6px 20px rgba(30,111,217,0.4);
  cursor: pointer; transition: var(--transition); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.chat-bubble-btn:hover { transform: scale(1.1); }
.chat-panel {
  position: fixed; bottom: 160px; right: 24px;
  width: 340px; height: 460px;
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 9997;
  display: flex; flex-direction: column;
  transform: translateY(20px) scale(0.95); opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
.chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: all; }
.chat-panel-header {
  background: var(--primary); color: white;
  padding: 16px 18px; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.5; }
.chat-msg.bot { background: var(--bg); color: var(--text-primary); border-bottom-left-radius: 4px; align-self: flex-start; }
.chat-msg.user { background: var(--primary); color: white; border-bottom-right-radius: 4px; align-self: flex-end; }
.chat-input-row { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input-row input { flex: 1; border: 1.5px solid var(--border); border-radius: 20px; padding: 8px 16px; font-size: 13px; font-family: 'Poppins', sans-serif; outline: none; }
.chat-input-row input:focus { border-color: var(--primary); }
.chat-send-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.chat-send-btn:hover { background: var(--primary-dark); }

/* ---- WIDGET BOOK BUTTON ---- */
.book-widget-btn {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--secondary); color: white;
  border: none; padding: 14px 24px;
  border-radius: 30px; font-family: 'Poppins', sans-serif;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,201,141,0.4);
  cursor: pointer; transition: var(--transition); z-index: 9996;
  display: flex; align-items: center; gap: 8px;
}
.book-widget-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,201,141,0.5); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1199px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.25); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex !important; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stat-card { padding: 16px; }
  .stat-icon { width: 44px; height: 44px; font-size: 20px; }
  .stat-info .value { font-size: 22px; }
  .stepper { overflow-x: auto; padding-bottom: 8px; }
  .step-label { display: none; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .kanban-board { flex-direction: column; }
  .chat-panel { width: calc(100vw - 32px); right: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 575px) {
  .topbar-title { font-size: 14px; }
  .btn-lg { padding: 11px 22px; font-size: 14px; }
}
