/* ============================================
   MaternityCRM - Main Stylesheet
   Theme: Pink (#FF6B9D) + Blue (#4A90E2)
   Font: Inter
   Mobile-first design
============================================ */

/* ── CSS Variables ── */
:root {
  --primary: #FF6B9D;
  --primary-dark: #e85c8a;
  --primary-light: #FFE0EC;
  --secondary: #4A90E2;
  --secondary-dark: #3278c8;
  --secondary-light: #EBF3FF;
  --accent: #FFA07A;

  --success: #48BB78;
  --success-light: #F0FFF4;
  --warning: #ECC94B;
  --warning-light: #FFFFF0;
  --error: #F56565;
  --error-light: #FFF5F5;
  --info: #4299E1;
  --info-light: #EBF8FF;

  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --text-primary: #1A202C;
  --text-secondary: #718096;
  --text-muted: #A0AEC0;

  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;
  --mobile-nav-height: 60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-pink: 0 4px 14px rgba(255,107,157,0.3);

  --transition: 0.2s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF0F6 0%, #EBF3FF 50%, #FFF0F6 100%);
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.login-brand {
  text-align: center;
}

.brand-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-pink);
}

.brand-icon i { color: #fff; font-size: 28px; }

.login-brand h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.login-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}

/* Demo Accounts */
.demo-accounts {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.demo-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 600;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: var(--surface);
}

.demo-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.demo-btn i { font-size: 11px; }

.login-footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ════════════════════════════════════════════
   APP LAYOUT
════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-light);
  min-height: 70px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.brand-logo i {
  color: var(--primary);
  font-size: 20px;
  min-width: 20px;
}

.brand-logo span {
  white-space: nowrap;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle-btn {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.user-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.user-info {
  overflow: hidden;
  flex: 1;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
  display: inline-block;
  margin-top: 2px;
  text-transform: capitalize;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item i {
  min-width: 18px;
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-top: 1px solid var(--border-light);
  transition: all var(--transition);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logout:hover {
  color: var(--error);
  background: var(--error-light);
}

.sidebar-logout i { min-width: 18px; font-size: 15px; }

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

.main-wrapper.collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ── Top Header ── */
.top-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-menu-btn {
  display: none;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 6px;
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  max-width: 400px;
}

.header-search i {
  color: var(--text-muted);
  font-size: 14px;
}

.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  padding: 9px 0;
  outline: none;
  color: var(--text-primary);
}

.header-search input::placeholder { color: var(--text-muted); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}

.header-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: var(--error);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
  padding-bottom: calc(var(--mobile-nav-height) + 16px);
}

/* ── Mobile Bottom Nav ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 150;
  padding: 0 8px;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.mobile-nav-item i { font-size: 18px; }

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item .nav-badge {
  position: absolute;
  top: 2px;
  right: 20%;
  background: var(--error);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-full);
  min-width: 14px;
  text-align: center;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}

/* ════════════════════════════════════════════
   COMPONENTS
════════════════════════════════════════════ */

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header-left p {
  color: var(--text-secondary);
  font-size: 13px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,107,157,0.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-pink); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); color: var(--text-primary); }

.btn-blue {
  background: var(--secondary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74,144,226,0.3);
}
.btn-blue:hover { background: var(--secondary-dark); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
}
.btn-ghost:hover { background: var(--bg); color: var(--primary); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-loader { display: inline-flex; }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  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: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-icon.pink { background: var(--primary-light); color: var(--primary); }
.kpi-icon.blue { background: var(--secondary-light); color: var(--secondary); }
.kpi-icon.green { background: var(--success-light); color: var(--success); }
.kpi-icon.orange { background: #FFF3E0; color: var(--accent); }
.kpi-icon.yellow { background: var(--warning-light); color: #C8961A; }
.kpi-icon.purple { background: #F0E8FF; color: #7C3AED; }

.kpi-info { flex: 1; }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--error); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.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-light);
  background: var(--bg);
}

/* ── Table ── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table thead th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}

.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody td {
  padding: 13px 16px;
  font-size: 13px;
  vertical-align: middle;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active { background: var(--success-light); color: #2F855A; }
.badge-lead { background: var(--warning-light); color: #B7791F; }
.badge-inactive { background: var(--border-light); color: var(--text-muted); }
.badge-graduated { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-pregnancy { background: var(--primary-light); color: var(--primary-dark); }
.badge-postpartum { background: #F0E8FF; color: #7C3AED; }

.badge-high { background: #FFF5F5; color: #C53030; }
.badge-medium { background: var(--warning-light); color: #B7791F; }
.badge-low { background: var(--success-light); color: #2F855A; }

.badge-pending { background: var(--warning-light); color: #B7791F; }
.badge-completed { background: var(--success-light); color: #2F855A; }
.badge-overdue { background: #FFF5F5; color: #C53030; }
.badge-snoozed { background: var(--border-light); color: var(--text-muted); }

.badge-admin { background: #FFF5F5; color: #C53030; }
.badge-manager { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-consultant { background: var(--primary-light); color: var(--primary-dark); }
.badge-teacher { background: var(--success-light); color: #2F855A; }

/* ── Avatar ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.xl { width: 68px; height: 68px; font-size: 26px; }

/* ── Forms ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group label .required { color: var(--error); margin-left: 2px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,157,0.12);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(245,101,101,0.12);
}

textarea.form-input { resize: vertical; min-height: 90px; }

select.form-input { appearance: none; cursor: pointer; }

.input-icon-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.input-icon-wrap .form-input { padding-left: 40px; }

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 4px;
  font-size: 14px;
}

.password-toggle:hover { color: var(--primary); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-error {
  font-size: 11px;
  color: var(--error);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Search & Filters Bar ── */
.search-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.search-input-wrap i { color: var(--text-muted); font-size: 14px; }

.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  padding: 9px 0;
  outline: none;
  color: var(--text-primary);
}

.filter-select {
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--primary); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  max-width: 300px;
}

/* ── Loading State ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.loading-state i { font-size: 28px; color: var(--primary); }
.loading-state p { font-size: 14px; }

/* ── Alert ── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: var(--error-light); color: #C53030; border: 1px solid #FC8181; }
.alert-success { background: var(--success-light); color: #2F855A; border: 1px solid #68D391; }
.alert-warning { background: var(--warning-light); color: #B7791F; border: 1px solid #F6C90E; }
.alert-info { background: var(--info-light); color: #2B6CB0; border: 1px solid #63B3ED; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.modal.modal-lg { max-width: 720px; }
.modal.modal-sm { max-width: 400px; }

.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: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg); color: var(--error); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--text-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  pointer-events: all;
  animation: slideLeft 0.3s ease;
}

.toast.success { background: #2D7D46; }
.toast.error { background: #C53030; }
.toast.warning { background: #B7791F; }
.toast.info { background: var(--secondary-dark); }

.toast-close {
  margin-left: auto;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Timeline ── */
.pregnancy-timeline {
  margin: 16px 0;
}

.timeline-track {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 12px 0;
}

.timeline-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.5s ease;
}

.timeline-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--primary);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.timeline-current-label {
  text-align: center;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Baby age timeline */
.baby-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F0E8FF;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 12px 0;
}

.baby-timeline i { color: #7C3AED; font-size: 20px; }
.baby-timeline-info { flex: 1; }
.baby-timeline-info strong { display: block; color: #553C9A; font-size: 14px; }
.baby-timeline-info span { font-size: 12px; color: #6B46C1; }

/* ── Interaction Feed ── */
.interaction-feed { display: flex; flex-direction: column; gap: 0; }

.interaction-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  position: relative;
}

.interaction-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 18px;
  top: 50px;
  width: 2px;
  height: calc(100% - 36px);
  background: var(--border);
}

.interaction-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  z-index: 1;
  background: var(--surface);
  border: 2px solid var(--border);
}

.interaction-icon.call { border-color: var(--success); color: var(--success); background: var(--success-light); }
.interaction-icon.message { border-color: var(--secondary); color: var(--secondary); background: var(--secondary-light); }
.interaction-icon.meeting { border-color: #7C3AED; color: #7C3AED; background: #F0E8FF; }
.interaction-icon.note { border-color: var(--warning); color: #B7791F; background: var(--warning-light); }
.interaction-icon.email { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.interaction-content { flex: 1; }

.interaction-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.interaction-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.interaction-user {
  font-size: 12px;
  color: var(--text-secondary);
}

.interaction-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.interaction-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Task Item ── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--surface);
  transition: all var(--transition);
}

.task-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.task-item.completed { opacity: 0.6; }
.task-item.overdue { border-color: var(--error); background: var(--error-light); }

.task-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 2px;
  transition: all var(--transition);
}

.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); color: #fff; }

.task-content { flex: 1; }

.task-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

.task-meta a {
  color: var(--secondary);
  font-weight: 500;
}

.task-meta a:hover { text-decoration: underline; }

.task-actions {
  display: flex;
  gap: 4px;
}

/* ── Stats Charts ── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-container {
  position: relative;
  height: 240px;
}

/* ── Learner Card (mobile view) ── */
.learner-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: all var(--transition);
  cursor: pointer;
}

.learner-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.learner-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.learner-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.learner-card-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.learner-card-field i { font-size: 11px; color: var(--text-muted); }

/* ── Team Performance Table ── */
.performance-table tr td:first-child { font-weight: 600; }

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 80px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.5s ease;
}

/* ── Detail Page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.detail-sidebar-card {
  position: sticky;
  top: calc(var(--header-height) + 24px);
}

.learner-profile-header {
  text-align: center;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.learner-profile-header .avatar.xl { margin: 0 auto 12px; }

.learner-profile-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-info-list { padding: 16px 20px; }

.profile-info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.profile-info-item:last-child { border-bottom: none; }

.profile-info-item i {
  color: var(--primary);
  width: 16px;
  text-align: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.profile-info-item .info-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

/* ── Automation Rule Cards ── */
.rule-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}

.rule-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }

.rule-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.rule-icon.pregnancy { background: var(--primary-light); color: var(--primary); }
.rule-icon.postpartum { background: #F0E8FF; color: #7C3AED; }
.rule-icon.inactive { background: var(--bg); color: var(--text-muted); }

.rule-content { flex: 1; }

.rule-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-description { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

.rule-meta {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

.rule-meta strong { color: var(--text-secondary); }

.rule-actions { display: flex; gap: 6px; align-items: flex-start; }

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Dashboard Widgets ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.tasks-today-list { max-height: 300px; overflow-y: auto; }

/* ── User Mgmt ── */
.user-row-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* ════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
════════════════════════════════════════════ */

/* TABLET */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-sidebar-card {
    position: static;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* MOBILE */
@media (max-width: 768px) {
  .page-content { padding: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 22px; }

  .form-row { grid-template-columns: 1fr; }

  .search-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrap { max-width: 100%; }

  .data-table { display: none; }

  .modal { margin: 10px; }
  .modal-body { padding: 16px; }

  .header-search { display: none; }

  .pagination {
    flex-direction: column;
    align-items: center;
  }
}

/* SMALL MOBILE */
@media (max-width: 375px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .demo-grid { grid-template-columns: 1fr 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
}

/* ════════════════════════════════════════════
   UTILITY CLASSES
════════════════════════════════════════════ */

/* Hide text on mobile, show only icon */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

/* Rule card layout (automation) */
.rule-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--surface);
  transition: all var(--transition);
}
.rule-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }

.rule-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.rule-icon.pregnancy { background: var(--primary-light); color: var(--primary-dark); }
.rule-icon.postpartum { background: #F0E8FF; color: #7C3AED; }
.rule-icon.inactive { background: var(--border-light); color: var(--text-muted); }

.rule-content { flex: 1; min-width: 0; }
.rule-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.rule-description { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.rule-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.rule-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }

/* Interaction feed */
.interaction-feed { display: flex; flex-direction: column; gap: 0; }
.interaction-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
}
.interaction-item:last-child { border-bottom: none; }

.interaction-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.interaction-icon.call { background: #E6F7FF; color: #1890FF; }
.interaction-icon.message { background: #F6FFED; color: #52C41A; }
.interaction-icon.meeting { background: #FFF7E6; color: #FA8C16; }
.interaction-icon.note { background: #FFFBE6; color: #FAAD14; }
.interaction-icon.email { background: var(--secondary-light); color: var(--secondary); }

/* Pregnancy timeline */
.pregnancy-timeline { padding: 12px 0; }
.timeline-current-label { font-size: 13px; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 8px; }
.timeline-track { position: relative; height: 8px; background: var(--border-light); border-radius: 99px; margin: 0 8px; }
.timeline-fill { height: 100%; background: linear-gradient(90deg, var(--primary-light), var(--primary)); border-radius: 99px; transition: width 0.6s ease; }
.timeline-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px; background: var(--primary); border: 3px solid #fff;
  border-radius: 50%; box-shadow: 0 2px 6px rgba(255,107,157,0.4);
}
.timeline-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: var(--text-muted); }

/* Baby timeline */
.baby-timeline {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: #F0E8FF; border-radius: 10px;
  border-left: 4px solid #7C3AED;
}
.baby-timeline i { font-size: 22px; color: #7C3AED; }
.baby-timeline-info { display: flex; flex-direction: column; gap: 2px; }
.baby-timeline-info strong { font-size: 13px; font-weight: 700; color: #553C9A; }
.baby-timeline-info span { font-size: 11px; color: #805AD5; }

/* Learner profile header */
.learner-profile-header { text-align: center; padding: 20px 20px 12px; }
.learner-profile-header .avatar { margin: 0 auto 12px; }
.learner-profile-header h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }

/* Profile info */
.profile-info-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.profile-info-item:last-child { border-bottom: none; }
.profile-info-item i { font-size: 14px; color: var(--primary); margin-top: 2px; flex-shrink: 0; width: 16px; text-align: center; }
.info-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }

/* Task item */
.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); margin-bottom: 8px;
  background: var(--surface); transition: all var(--transition);
}
.task-item:hover { border-color: var(--primary-light); }
.task-item.overdue { border-color: #FEB2B2; background: #FFF5F5; }
.task-item.completed { opacity: 0.65; }
.task-item.completed .task-title span { text-decoration: line-through; color: var(--text-muted); }

.task-checkbox {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-radius: 6px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin-top: 2px;
  transition: all 0.2s; color: #fff;
}
.task-checkbox:hover { border-color: var(--primary); background: var(--primary-light); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); }

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.task-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.task-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border-light); margin-bottom: 0; overflow-x: auto; }
.tab-item {
  padding: 12px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap; transition: all 0.2s; display: flex; gap: 6px; align-items: center;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* User row */
.user-row-avatar { display: flex; align-items: center; gap: 10px; }
.user-row-avatar .avatar { flex-shrink: 0; }

/* Detail task item */
.detail-task-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; font-size: 13px;
}

/* Nav badge */
.nav-badge {
  background: var(--error); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 99px; display: inline-flex;
  align-items: center; justify-content: center;
  padding: 0 4px; margin-left: auto;
}

/* Import dropzone */
#import-dropzone:hover { border-color: var(--primary); background: var(--primary-light) !important; }

/* Responsive page-actions */
@media (max-width: 600px) {
  .page-actions { gap: 6px; }
  .page-actions .btn-sm { padding: 6px 10px; }
}

