/* ==========================================================================
   SOBAT-AI - School Social Intelligence Dashboard Modern Style
   Tema: Teal/Green Primary (#0d9488) & Slate Secondary (#1e293b)
   Background: #f5f7fb
   ========================================================================== */

:root {
  --primary-color: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --primary-subtle: #ccfbf1;
  --secondary-color: #1e293b;
  --secondary-hover: #0f172a;
  --bg-app: #f5f7fb;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --sidebar-width: 260px;
  --navbar-height: 64px;
  
  /* Status Colors */
  --status-stable: #10b981;
  --status-stable-bg: #ecfdf5;
  --status-attention: #f59e0b;
  --status-attention-bg: #fffbeb;
  --status-review: #f97316;
  --status-review-bg: #fff7ed;
  --status-critical: #ef4444;
  --status-critical-bg: #fef2f2;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Layout Structure (CodeIgniter 3 Modern Admin Style)
   -------------------------------------------------------------------------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-brand {
  height: var(--navbar-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary-color), #14b8a6);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--secondary-color);
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.menu-category {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  list-style: none;
  margin-bottom: 2px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.nav-link-custom i {
  font-size: 1.1rem;
  color: #64748b;
  width: 22px;
  text-align: center;
  transition: color 0.15s ease-in-out;
}

.nav-link-custom:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.nav-link-custom:hover i {
  color: var(--primary-color);
}

.nav-link-custom.active {
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.nav-link-custom.active i {
  color: #ffffff;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
}

/* Sidebar Footer / User Profile Card */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
}

.user-mini-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left 0.3s ease-in-out;
}

/* Top Navbar */
.app-navbar {
  height: var(--navbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  background: #f1f5f9;
}

.system-title-tag {
  display: flex;
  flex-direction: column;
}

.system-title-tag .title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--secondary-color);
}

.system-title-tag .subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Quick Role Switcher Pill */
.role-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.role-pill.admin { background: #fee2e2; color: #b91c1c; }
.role-pill.guru { background: #e0e7ff; color: #4338ca; }
.role-pill.siswa { background: #ccfbf1; color: #0f766e; }
.role-pill.orangtua { background: #fef3c7; color: #b45309; }

/* Content Body */
.content-wrapper {
  flex: 1;
  padding: 1.5rem;
}

/* Breadcrumb & Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.breadcrumb-custom {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-custom a {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb-custom .separator {
  color: #cbd5e1;
}

/* White Card Style */
.card-modern {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card-modern:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.card-header-modern {
  padding: 1rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-modern {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body-modern {
  padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::before { background-color: var(--primary-color); }
.stat-card.success::before { background-color: var(--status-stable); }
.stat-card.warning::before { background-color: var(--status-attention); }
.stat-card.orange::before { background-color: var(--status-review); }
.stat-card.danger::before { background-color: var(--status-critical); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--secondary-color);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stat-desc {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary-color); }
.stat-icon.success { background: var(--status-stable-bg); color: var(--status-stable); }
.stat-icon.warning { background: var(--status-attention-bg); color: var(--status-attention); }
.stat-icon.orange { background: var(--status-review-bg); color: var(--status-review); }
.stat-icon.danger { background: var(--status-critical-bg); color: var(--status-critical); }

/* Status Badges */
.badge-status {
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-status.stable { background: var(--status-stable-bg); color: var(--status-stable); border: 1px solid #a7f3d0; }
.badge-status.attention { background: var(--status-attention-bg); color: #d97706; border: 1px solid #fde68a; }
.badge-status.review { background: var(--status-review-bg); color: #ea580c; border: 1px solid #fed7aa; }
.badge-status.high-attention { background: var(--status-critical-bg); color: var(--status-critical); border: 1px solid #fecaca; }

/* Tables Modern */
.table-modern {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.table-modern tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

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

/* Insight Callout Box */
.insight-box {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: #f8fafc;
  border-left: 4px solid var(--primary-color);
  margin-bottom: 1rem;
}

.insight-box.sociological { border-left-color: #0d9488; background: #f0fdfa; }
.insight-box.power { border-left-color: #6366f1; background: #eef2ff; }
.insight-box.inclusion { border-left-color: #0284c7; background: #f0f9ff; }
.insight-box.warning { border-left-color: #f59e0b; background: #fffbeb; }

.insight-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.insight-text {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

/* Canvas / SVG Social Network Area */
.network-container {
  width: 100%;
  height: 420px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.network-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.network-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Check-In Emoji / Slider Elements */
.checkin-emoji-group {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0;
}

.emoji-option {
  text-align: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  flex: 1;
}

.emoji-option:hover {
  background: var(--primary-light);
}

.emoji-option.selected {
  border-color: var(--primary-color);
  background: var(--primary-subtle);
  transform: translateY(-2px);
}

.emoji-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 0.25rem;
}

.emoji-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

/* Horizontal Feature Attribution Bar */
.xai-bar-item {
  margin-bottom: 0.75rem;
}

.xai-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.progress-thin {
  height: 8px;
  border-radius: 4px;
  background-color: #e2e8f0;
}

/* Reintegration Roadmap / Timeline */
.timeline-stepper {
  position: relative;
  padding-left: 1.75rem;
}

.timeline-stepper::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #cbd5e1;
}

.timeline-step {
  position: relative;
  margin-bottom: 1.5rem;
}

.step-marker {
  position: absolute;
  left: -1.75rem;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #94a3b8;
}

.timeline-step.completed .step-marker {
  border-color: var(--primary-color);
  background: var(--primary-color);
}

.timeline-step.current .step-marker {
  border-color: #f59e0b;
  background: #ffffff;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Buttons Theme */
.btn-sobat,
.btn-teman {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  transition: all 0.15s ease;
}

.btn-sobat:hover,
.btn-teman:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.btn-sobat-outline,
.btn-teman-outline {
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  transition: all 0.15s ease;
}

.btn-sobat-outline:hover,
.btn-teman-outline:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

/* Ethical AI & Human in the Loop Footer */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hitl-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Toast Container */
.toast-container-custom {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1080;
}
