/* styles.css */

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

/* --- VARIABEL WARNA & UTILITY --- */
:root {
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Tema Terang (Default) */
  --bg-primary: #f6f8fc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --border-color: #e2e8f0;
  
  --primary: #2563eb; /* Royal Blue */
  --primary-light: #dbeafe;
  --primary-gradient: linear-gradient(135deg, #1e40af 0%, #10b981 50%, #f59e0b 100%);
  --primary-glow: rgba(37, 99, 235, 0.15);
  
  --accent: #f59e0b; /* Golden Yellow/Orange */
  --accent-light: #fef3c7;
  --success: #10b981; /* Emerald/Green */
  --success-light: #d1fae5;
  --warning: #d97706; /* Amber/Orange */
  --warning-light: #fef3c7;
  --theme-bot-bg: #fffbeb;
  
  --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(148, 163, 184, 0.1), 0 4px 6px -2px rgba(148, 163, 184, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(148, 163, 184, 0.15), 0 10px 10px -5px rgba(148, 163, 184, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-backdrop: blur(12px);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema Gelap */
body.dark-theme {
  --bg-primary: #090d16;
  --bg-card: #131c2e;
  --bg-card-hover: #1b263b;
  --bg-input: #1a2336;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  --border-color: #243049;
  
  --primary-light: rgba(37, 99, 235, 0.2);
  --primary-glow: rgba(37, 99, 235, 0.3);
  --accent-light: rgba(245, 158, 11, 0.2);
  --success-light: rgba(16, 185, 129, 0.2);
  --warning-light: rgba(217, 119, 6, 0.2);
  --theme-bot-bg: rgba(245, 158, 11, 0.08);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --glass-bg: rgba(19, 28, 46, 0.8);
  --glass-border: rgba(36, 48, 73, 0.5);
  --glass-backdrop: blur(16px);
}

/* --- RESET & GLOBAL STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: var(--transition);
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
}

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

/* --- BACKGROUND DECORATION --- */
.bg-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  transition: var(--transition);
}
.bg-blob-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -10%;
  right: -10%;
}
.bg-blob-2 {
  width: 400px;
  height: 400px;
  background: #ec4899;
  bottom: -10%;
  left: -10%;
}
body.dark-theme .bg-blob {
  opacity: 0.1;
}

/* --- AUTHENTICATION / LOGIN PAGE --- */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-backdrop);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 70px;
  height: 70px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: white;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.auth-title {
  font-size: 1.8rem;
  margin-bottom: 8px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 30px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 25px;
  border: 1px solid var(--border-color);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form-group {
  margin-bottom: 20px;
  text-align: left;
}

.auth-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-input-wrapper {
  position: relative;
}

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

.auth-input {
  width: 100%;
  padding: 14px 14px 14px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: var(--transition);
}

.auth-input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.auth-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
  margin-top: 10px;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-help {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- MAIN LAYOUT (APP PANELS) --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (Desktop) */
.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 40px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-logo i {
  -webkit-text-fill-color: var(--primary);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.profile-info {
  overflow: hidden;
}
.profile-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.profile-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item button {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.menu-item button:hover {
  background: var(--bg-input);
  color: var(--text-main);
  transform: translateX(4px);
}

.menu-item.active button {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-toggle-theme, .btn-logout {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
}

.btn-toggle-theme {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-toggle-theme:hover {
  background: var(--border-color);
}

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

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 260px;
  padding: 40px;
  min-height: 100vh;
  transition: var(--transition);
}

/* Mobile Bottom Navigation (Hidden on Desktop) */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--glass-bg);
  border-top: 1px solid var(--border-color);
  backdrop-filter: var(--glass-backdrop);
  z-index: 99;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-nav-item i {
  font-size: 1.25rem;
}

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

.mobile-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
}
.mobile-header-title {
  font-size: 1.1rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mobile-header-actions {
  display: flex;
  gap: 12px;
}
.btn-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

/* --- PAGE SECTIONS --- */
.page-section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.page-section.active {
  display: block;
}

.section-header {
  margin-bottom: 30px;
}
.section-title {
  font-size: 2rem;
  margin-bottom: 6px;
}
.section-desc {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Grid Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover::after {
  opacity: 1;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}
.stat-icon.accent {
  background: var(--accent-light);
  color: var(--accent);
}
.stat-icon.success {
  background: var(--success-light);
  color: var(--success);
}
.stat-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-content {
  flex: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- ARTICLES / EDUKASI SECTION --- */
.article-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 400px;
}
.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: var(--transition);
}
.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.search-bar i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.category-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 5px;
  max-width: 100%;
}
.filter-btn {
  padding: 8px 18px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border-color);
  white-space: nowrap;
  transition: var(--transition);
}
.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: white;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.article-card-header {
  padding: 24px 24px 12px;
}
.article-card-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.article-card-tag.umum { background: var(--primary-light); color: var(--primary); }
.article-card-tag.laki-laki { background: var(--primary-light); color: #3b82f6; }
.article-card-tag.perempuan { background: var(--accent-light); color: var(--accent); }
.article-card-tag.psikologi { background: var(--warning-light); color: var(--warning); }

.article-card-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
  line-height: 1.4;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-body {
  padding: 0 24px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-input);
}
.article-card-author {
  font-weight: 500;
}
.article-card-views {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Detail Artikel */
.article-detail-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  max-width: 800px;
  margin: 0 auto;
}
.article-detail-back {
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 25px;
  transition: var(--transition);
}
.article-detail-back:hover {
  color: var(--primary);
  transform: translateX(-4px);
}
.article-detail-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
}
.article-detail-title {
  font-size: 2.2rem;
  margin-bottom: 25px;
  line-height: 1.3;
}
.article-detail-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-main);
}
.article-detail-content p {
  margin-bottom: 20px;
}
.article-detail-content ul, .article-detail-content ol {
  margin-left: 20px;
  margin-bottom: 20px;
}
.article-detail-content li {
  margin-bottom: 8px;
}
.article-detail-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  color: var(--text-muted);
  font-style: italic;
  margin: 20px 0;
}

/* --- CONSULTATION / CHAT SECTION --- */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  height: calc(100vh - 180px);
  min-height: 500px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Chat Sidebar (Daftar Siswa untuk Guru) */
.chat-sidebar {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}
.chat-sidebar-search {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}
.chat-sidebar-search input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
}
.chat-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}
.chat-list-item {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-list-item:hover {
  background: var(--bg-input);
}
.chat-list-item.active {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}
body.dark-theme .chat-list-item.active {
  background: rgba(99, 102, 241, 0.15);
}
.chat-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
}
.chat-list-item.active .chat-item-avatar {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
}
.chat-item-info {
  flex: 1;
  overflow: hidden;
}
.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.chat-item-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.chat-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.chat-item-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0 5px;
}

/* Chat Main Window */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* Mengatasi grid item agar tidak meregang melebihi tinggi grid parent */
}
.chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}
.chat-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Chat Bubbles */
.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.chat-bubble-wrapper.sent {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-bubble-wrapper.received {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  line-height: 1.5;
}
.chat-bubble-wrapper.sent .chat-bubble {
  background: var(--primary-gradient);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble-wrapper.received .chat-bubble {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-bubble-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-input-area {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  gap: 12px;
  align-items: center;
}
.chat-input-area textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-main);
  font-size: 0.92rem;
  resize: none;
  height: 44px;
  max-height: 120px;
  transition: var(--transition);
}
.chat-input-area textarea:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}
.btn-send {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.btn-send:hover {
  transform: scale(1.05);
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  gap: 15px;
}
.chat-empty-state i {
  font-size: 3rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- GROWTH TRACKER SECTION --- */
.tracker-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 30px;
  align-items: start;
}

.tracker-main-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-sm);
}

.graph-container {
  width: 100%;
  margin: 20px 0 30px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px;
  position: relative;
}

.graph-title {
  font-size: 1rem;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.graph-legends {
  display: flex;
  gap: 15px;
  font-size: 0.8rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.legend-color.height { background: var(--primary); }
.legend-color.weight { background: var(--accent); }

/* SVG Graph Custom */
.svg-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 250px;
}
.chart-axis {
  stroke: var(--border-color);
  stroke-width: 1;
}
.chart-grid-line {
  stroke: var(--border-color);
  stroke-dasharray: 4, 4;
}
.chart-text {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-body);
}
.chart-line-height {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-line-weight {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-dot-height {
  fill: var(--bg-card);
  stroke: var(--primary);
  stroke-width: 3;
  cursor: pointer;
  transition: transform 0.2s;
}
.chart-dot-height:hover {
  transform: scale(1.5);
  fill: var(--primary);
}
.chart-dot-weight {
  fill: var(--bg-card);
  stroke: var(--accent);
  stroke-width: 3;
  cursor: pointer;
  transition: transform 0.2s;
}
.chart-dot-weight:hover {
  transform: scale(1.5);
  fill: var(--accent);
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.history-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.history-item {
  padding: 15px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
  transition: var(--transition);
}
.history-item:hover {
  border-color: var(--primary-light);
}
.history-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.history-item-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}
.history-stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.history-stat-box.bmi {
  border-color: var(--success);
  color: var(--success);
}
.history-item-signs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.badge-sign {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.history-item-notes {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border-color);
  padding-left: 10px;
  margin-top: 8px;
}

.btn-delete-log {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.btn-delete-log:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Form Growth Input (Guru/Konselor & Siswa) */
.form-growth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.form-growth-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
}
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}
.input-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}
.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input-field {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
}
.input-field:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}
.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.checkbox-item input {
  accent-color: var(--primary);
  cursor: pointer;
}

/* --- STUDENT DIRECTORY FOR TEACHER --- */
.student-grid, .students-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: var(--transition);
  cursor: pointer;
}
.student-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.student-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.student-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.student-avatar.male {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.student-avatar.female {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}
.student-avatar.admin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.student-card-title {
  overflow: hidden;
}
.student-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.student-nisn {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.student-meta-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 0;
}
.student-meta-item i {
  color: var(--primary);
  width: 14px;
}
.student-card-actions {
  display: flex;
  gap: 10px;
}
.btn-outline {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}
.btn-outline:hover {
  background: var(--primary);
  color: white;
}

/* --- BACKUP & CONFIG PANEL --- */
.config-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
@media (max-width: 768px) {
  .config-layout {
    grid-template-columns: 1fr;
  }
}
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.config-card h3 {
  margin-bottom: 10px;
}
.config-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.file-upload-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: 15px;
}
.file-upload-input {
  width: 100%;
  height: 50px;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  z-index: 2;
}
.file-upload-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  background: var(--bg-input);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}
.file-upload-input:hover + .file-upload-btn {
  background: var(--primary-light);
}

/* --- MODAL DIALOG --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
  display: flex;
}
.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-main);
}
.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-input);
  color: var(--text-main);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover {
  background: var(--border-color);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  max-width: 400px;
  transform: translateX(120%);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.active {
  transform: translateX(0);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: var(--warning); }

/* PWA Install Button Floating */
.pwa-install-banner {
  position: fixed;
  bottom: 80px;
  left: 20px;
  right: 20px;
  background: var(--primary-gradient);
  color: white;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideUp 0.5s ease;
}
@media (min-width: 768px) {
  .pwa-install-banner {
    left: auto;
    right: 20px;
    bottom: 24px;
    width: 380px;
  }
}
.pwa-install-btn {
  background: white;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

/* --- MEDIA QUERIES & RESPONSIVENESS --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
  .sidebar-overlay.active {
    display: block;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.active {
    left: 0;
  }

  .main-wrapper {
    margin-left: 0;
    padding: 80px 15px 85px; /* Beri jarak di atas untuk header, bawah untuk bottom nav */
    width: 100%;
    min-width: 0;
  }
  
  .articles-grid, .dashboard-grid, .student-grid, .students-grid {
    grid-template-columns: 1fr !important;
  }
  
  .mobile-nav {
    display: flex; /* Tampilkan navigasi bawah */
  }
  
  .mobile-header {
    display: flex; /* Tampilkan mobile header */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 990;
    box-shadow: var(--shadow-sm);
  }
  
  .tracker-layout {
    grid-template-columns: 1fr;
  }
  
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 145px);
  }
  
  .chat-sidebar.active-chat-mode {
    display: none;
  }
  
  .chat-main {
    display: none;
  }
  
  .chat-main.active-chat-mode {
    display: flex;
  }
  
  .auth-card {
    padding: 30px 20px;
  }
  
  .section-title {
    font-size: 1.6rem;
  }

  /* --- RESPONSIVE CHAT WINDOW OVERRIDES --- */
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 145px);
    min-width: 0;
    max-width: 100%;
  }
  .chat-main {
    min-width: 0;
  }
  .chat-header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .chat-header-user {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 4px 12px;
    width: 100%;
  }
  #chat-header-name {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }
  #chat-header-status {
    font-size: 0.75rem !important;
  }
  .btn-close-session {
    grid-column: 3; /* Letakkan di kolom ketiga di bawah teks */
    justify-self: start;
    padding: 4px 10px;
    font-size: 0.7rem;
    margin-top: 2px;
    border-radius: 4px;
    width: fit-content;
    height: auto;
  }
  .chat-body {
    padding: 12px 10px;
    gap: 10px;
  }
  .chat-bubble-wrapper {
    max-width: 85%;
  }
  .chat-input-area {
    padding: 10px 12px;
    gap: 8px;
  }
  .chat-input-area textarea {
    padding: 8px 10px;
    font-size: 0.85rem;
    height: 38px;
  }
  .btn-send {
    width: 38px;
    height: 38px;
  }

  /* --- RESPONSIVE GRAPH OVERRIDES --- */
  .graph-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .graph-legends {
    gap: 10px;
    flex-wrap: wrap;
  }

  /* --- RESPONSIVE GROWTH TRACKER OVERRIDES --- */
  .tracker-main-panel, .tracker-side-panel, .history-card {
    padding: 15px !important;
  }
  .history-item-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .history-stat-box {
    flex: 1 1 calc(50% - 5px);
    justify-content: center;
    font-size: 0.8rem;
    padding: 6px 8px;
  }
  .history-stat-box.imt {
    flex: 1 1 100%;
  }

  /* --- RESPONSIVE MODAL & FORM OVERRIDES --- */
  .modal-container {
    margin: 10px;
    max-width: calc(100% - 20px) !important;
  }
  .modal-body {
    padding: 15px;
  }
  .modal-header, .modal-footer {
    padding: 12px 15px;
  }
  .input-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* --- LOGO BRAND STYLING --- */
.auth-logo-img {
  text-align: center;
  margin-bottom: 15px;
}
.auth-logo-img img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--primary-light);
  object-fit: cover;
  box-shadow: var(--shadow-md);
}
.logo-sidebar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  vertical-align: middle;
  margin-right: 8px;
  object-fit: cover;
}

/* --- KONSULTASI SESI STYLING --- */
.btn-create-session {
  display: block;
  width: calc(100% - 30px);
  margin: 15px;
  padding: 12px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-title);
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.btn-create-session:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 0.95;
}
.btn-close-session {
  margin-left: auto;
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid #ef4444;
  color: #ef4444;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-close-session:hover {
  background: #ef4444;
  color: white;
}
.closed-session {
  opacity: 0.8;
  border-left: 3px solid #9ca3af;
}
.bot-message-bubble .chat-bubble {
  border-left: 3px solid #d97706 !important;
  background-color: var(--theme-bot-bg) !important;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
