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

:root {
  --sidebar-width: 280px;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --surface: #ffffff;
  --background: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* Glassmorphism Sidebar */
#sidebar-wrapper {
  min-height: 100vh;
  width: var(--sidebar-width);
  margin-left: 0;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  box-shadow: 4px 0 24px rgba(0,0,0,0.05);
}

#sidebar-wrapper .list-group-item {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 12px 24px;
  margin: 4px 12px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

#sidebar-wrapper .list-group-item:hover,
#sidebar-wrapper .list-group-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

#wrapper.toggled #sidebar-wrapper {
  margin-left: calc(0 * var(--sidebar-width));
  width: 0;
  padding: 0 !important;
  overflow: hidden;
}

/* Premium Cards */
.card {
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Calendar Grid Upgrade */
.clinic-col {
  min-width: 320px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.25rem;
  margin-right: 1.5rem;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.time-slot {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  margin-bottom: 4px;
}

.time-slot:hover {
  background: #e0e7ff;
  transform: translateX(4px);
  color: var(--primary);
}

.time-slot.selected {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.slot-booked {
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.slot-empty {
  font-size: 0.85rem;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  transition: all 0.2s;
}

.slot-empty:hover {
  background: #f8fafc;
  border-color: var(--primary);
  color: var(--primary);
  cursor: pointer;
}

.slots-container {
  max-height: 650px;
  overflow-y: auto;
  padding-right: 8px;
}

.slots-container::-webkit-scrollbar {
  width: 6px;
}
.slots-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* Animations */
.module-section {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Patient Row Card Design --- */
.patient-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.2s ease;
}

.patient-row:hover {
  background: #f8fafc;
}

.patient-row-expanded {
  background: #f0f7ff;
  border-left: 4px solid var(--primary);
}

.patient-row .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.patient-row .info {
  flex: 1;
  min-width: 0;
}

.patient-row .info .name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.patient-row .info .detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.patient-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px 80px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.patient-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 10px;
  min-width: 60px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  text-decoration: none;
}

.patient-action-btn:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(13, 110, 253, 0.1);
}

.patient-action-btn i {
  font-size: 1.1rem;
  color: var(--primary);
}

.patient-action-btn span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-main);
}

.patient-list-container {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* --- Calendar Appointment Cards --- */
.appt-card {
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.appt-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.appt-card-linked { border-color: #86efac; }
.appt-card-linked .appt-card-header { background: #f0fdf4; }
.appt-card-linked .appt-card-header:hover { background: #dcfce7; }
.appt-card-linked .appt-card-body { background: #ffffff; }

.appt-card-unlinked { border-color: #fcd34d; }
.appt-card-unlinked .appt-card-header { background: #fffbeb; }
.appt-card-unlinked .appt-card-header:hover { background: #fef3c7; }
.appt-card-unlinked .appt-card-body { background: #ffffff; }

.appt-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.appt-card-header .appt-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.appt-card-header .appt-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-card-header .appt-badge {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 600;
}

.appt-badge-linked { background: #dcfce7; color: #16a34a; }
.appt-badge-unlinked { background: #fef3c7; color: #d97706; }
.appt-status-scheduled { background: #e0f2fe; color: #0284c7; }
.appt-status-checkedin { background: #ccfbf1; color: #0d9488; }
.appt-status-attended { background: #ccfbf1; color: #0d9488; } /* legacy alias */
.appt-status-inprogress { background: #fef3c7; color: #d97706; }
.appt-status-completed { background: #dcfce7; color: #16a34a; }
.appt-status-noshow { background: #fee2e2; color: #dc2626; }
.appt-status-cancelled { background: #f1f5f9; color: #64748b; }

.appt-card-body {
  padding: 10px 12px 12px;
  border-top: 1px solid #f1f5f9;
}

.appt-card-body .appt-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.appt-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.appt-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: white;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
}

.appt-action-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.appt-action-btn.success {
  color: #16a34a;
  border-color: #bbf7d0;
  background-color: #f0fdf4;
}
.appt-action-btn.success:hover {
  background-color: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.appt-action-btn.danger {
  color: #dc2626;
  border-color: #fecaca;
  background-color: #fef2f2;
}
.appt-action-btn.danger:hover {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.appt-action-btn.warning {
  color: #d97706;
  border-color: #fde68a;
  background-color: #fffbeb;
}
.appt-action-btn.warning:hover {
  background-color: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

.appt-action-btn.info {
  color: #2563eb;
  border-color: #bfdbfe;
  background-color: #eff6ff;
}
.appt-action-btn.info:hover {
  background-color: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.appt-action-btn.disabled,
.appt-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #94a3b8 !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--primary);
  border: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

/* Redesigned Appointment Card Actions */
.appt-action-btn-new {
  font-size: 0.8rem !important;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.appt-action-btn-new.vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  font-size: 0.65rem !important;
  font-weight: 600;
  line-height: 1.2;
}

.appt-action-btn-new.vertical i {
  font-size: 1.15rem;
  margin-bottom: 2px;
}

.appt-action-btn-new.disabled,
.appt-action-btn-new:disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none;
}

.avatar-circle {
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.appt-detail-row {
  border-bottom: 1px solid rgba(241, 245, 249, 0.5);
}
.appt-detail-row:last-child {
  border-bottom: none;
}

/* Weekly and Monthly Views */
.weekly-table {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.weekly-table th {
  background-color: #f8fafc;
  color: #1e293b;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
}

.weekly-table td {
  vertical-align: middle;
  text-align: center;
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.weekly-day-cell {
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 8px;
  padding: 8px;
}

.weekly-day-cell:hover {
  background-color: #f0f9ff;
}

.monthly-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.monthly-day-header {
  text-align: center;
  font-weight: 600;
  color: #64748b;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 8px 0;
}

.monthly-cell {
  min-height: 100px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.monthly-cell:hover {
  border-color: var(--primary);
  background-color: #f8fafc;
  transform: translateY(-2px);
}

.monthly-cell.other-month {
  background: #f1f5f9;
  color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.monthly-cell.today-cell {
  border: 2px solid var(--primary);
  background-color: #eff6ff;
}

.monthly-date-num {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.monthly-counts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  width: 100%;
}

.monthly-count-badge {
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom 5-Column layout for statistics cards */
.col-5-custom {
  flex: 0 0 20%;
  max-width: 20%;
  padding-left: 8px;
  padding-right: 8px;
}
@media (max-width: 992px) {
  .col-5-custom {
    flex: 0 0 50%;
    max-width: 50%;
  }
}
@media (max-width: 576px) {
  .col-5-custom {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Practice Analytics Styles */
#module-analytics .card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#module-analytics .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08) !important;
}

/* Drag and Drop Customization Styles */
.draggable-item {
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}
.draggable-item:active {
  cursor: grabbing;
}
.draggable-item.dragging {
  opacity: 0.4;
  background-color: #f1f5f9;
  border: 1px dashed #cbd5e1;
}