/* ================================================================
   Coding Keeda Admission CRM - Modern UI Design System
   ================================================================ */

:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --accent: #6366f1;
  --accent-light: #e0e7ff;
  --dark-bg: #0b0f19;
  --sidebar-bg: #0f172a;
  --card-bg: #ffffff;
  --body-bg: #f8fafc;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #0284c7;
  --info-light: #e0f2fe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ================= SIDEBAR ================= */
.app-layout {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 34px;
  width: auto;
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: #38bdf8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-category {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-preview {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-info-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.user-info-role {
  font-size: 0.7rem;
  color: #94a3b8;
}

.btn-logout {
  color: #94a3b8;
  padding: 6px;
  border-radius: 6px;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ================= MAIN CONTENT ================= */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.top-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-headline h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-headline p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.content-container {
  padding: 1.75rem 2rem 3rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ================= KPI CARDS ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.kpi-card.green::before { background: var(--primary); }
.kpi-card.blue::before { background: var(--info); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card.amber::before { background: var(--warning); }
.kpi-card.indigo::before { background: var(--accent); }

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-card.green .kpi-icon-wrap { background: var(--primary-light); color: var(--primary); }
.kpi-card.blue .kpi-icon-wrap { background: var(--info-light); color: var(--info); }
.kpi-card.purple .kpi-icon-wrap { background: var(--purple-light); color: var(--purple); }
.kpi-card.amber .kpi-icon-wrap { background: var(--warning-light); color: var(--warning); }
.kpi-card.indigo .kpi-icon-wrap { background: var(--accent-light); color: var(--accent); }

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  line-height: 1.2;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--body-bg);
  border-color: #cbd5e1;
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.25);
}

.btn-whatsapp:hover {
  background: #20ba5a;
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}

.btn-icon-only {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

/* ================= BADGES ================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-new { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-call { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-scheduled { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-attended { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.badge-enrolled { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-lost { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.badge-housefull { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-open { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* ================= CARDS & TABLES ================= */
.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Student / Lead Avatar */
.student-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-name {
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.student-phone {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ================= MODALS & FORMS ================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #ffffff;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

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

/* ================= TOAST NOTIFICATION ================= */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--primary);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .content-container {
    padding: 1.25rem 1rem;
  }
  .top-bar {
    padding: 0.75rem 1rem;
  }
}

/* Smart Notification Button State Styles */
.btn-sent-locked {
  background: #f1f5f9 !important;
  color: #059669 !important;
  border: 1px solid #bbf7d0 !important;
  font-weight: 700 !important;
  cursor: not-allowed !important;
  opacity: 0.9;
  font-size: 0.76rem !important;
  padding: 0.35rem 0.65rem !important;
  border-radius: 6px !important;
}

.interest-tag-high {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.interest-tag-med {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.interest-tag-low {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.notif-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-weight: 600;
}

.notif-pill.sent {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

/* ================= MOBILE BOTTOM NAVIGATION (Android App Bar) ================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.06);
  z-index: 999;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 0.2rem;
  flex: 1;
  height: 100%;
  transition: all 0.2s ease;
  position: relative;
}

.bottom-nav-item.active {
  color: #059669;
}

.bottom-nav-item.active svg {
  color: #059669;
  stroke-width: 2.5px;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  color: #64748b;
}

.bottom-nav-badge {
  position: absolute;
  top: 6px;
  right: 22%;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
}

/* ================= MOBILE LEAD CARDS ================= */
.mobile-cards-container {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.lead-card-mobile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
}

.lead-card-mobile.scheduled {
  border-left: 4px solid #8b5cf6;
}

.lead-card-mobile.enrolled {
  border-left: 4px solid #10b981;
}

.lead-card-mobile.new {
  border-left: 4px solid #3b82f6;
}

.lcm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.lcm-student-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
}

.lcm-student-phone {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 0.15rem;
}

.lcm-slot-box {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: #6d28d9;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lcm-notif-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lcm-notif-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lcm-action-bar {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
}

/* Floating Action Button (FAB) on Mobile */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 76px;
  right: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(5, 150, 105, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 998;
  border: none;
  cursor: pointer;
}

.mobile-fab svg {
  width: 26px;
  height: 26px;
}

/* Media Query for Mobile/Tablet (< 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: 70px;
  }

  .sidebar {
    display: none !important;
  }

  .bottom-nav {
    display: flex;
  }

  .mobile-fab {
    display: flex;
  }

  .table-responsive {
    display: none !important; /* Hide wide table on mobile */
  }

  .mobile-cards-container {
    display: flex; /* Show touch-friendly cards on mobile */
  }

  .top-bar {
    padding: 0.85rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .top-bar-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .top-bar-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .content-container {
    padding: 0.85rem 0.75rem;
  }

  .modal-box {
    margin: 1rem;
    padding: 1.25rem;
    max-height: 90vh;
  }
}
