/* Design System & Core Typography */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Light Theme Palette - Elegant Slate & Indigo */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  
  --success-color: #10b981;
  --success-light: #d1fae5;
  --warning-color: #f59e0b;
  --warning-light: #fef3c7;
  --danger-color: #ef4444;
  --danger-light: #fee2e2;
  --info-color: #0ea5e9;
  --info-light: #e0f2fe;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 12px 24px rgba(99, 102, 241, 0.06), 0 4px 8px rgba(0, 0, 0, 0.02);
  --shadow-xl: 0 20px 32px rgba(99, 102, 241, 0.08), 0 8px 16px rgba(0, 0, 0, 0.03);
  
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 18px;
  --border-radius-xl: 28px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  --sidebar-width: 280px;
  --header-height: 70px;
}

/* Dark Theme Overrides */
html.dark-theme {
  --bg-primary: #090d16;
  --bg-secondary: #121824;
  --bg-tertiary: #1b2234;
  --border-color: #242f47;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #62728d;
  
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --success-color: #34d399;
  --success-light: rgba(52, 211, 153, 0.12);
  --warning-color: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.12);
  --danger-color: #f87171;
  --danger-light: rgba(248, 113, 113, 0.12);
  --info-color: #38bdf8;
  --info-light: rgba(56, 189, 248, 0.12);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 32px rgba(0, 0, 0, 0.6);
}

/* Reset and Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

/* App Shell Layout */
#app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-brand {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.sidebar-menu {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.menu-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.menu-item.active {
  background: linear-gradient(90deg, var(--primary-light) 0%, rgba(99, 102, 241, 0.05) 100%);
  color: var(--primary-color);
  font-weight: 600;
}

.menu-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.02);
}

/* User Profile Widget in Sidebar */
.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--border-radius-md);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

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

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

.user-role-badge {
  font-size: 10px;
  background-color: var(--primary-light);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-block;
  font-weight: 600;
  margin-top: 2px;
  text-transform: uppercase;
}

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

/* Header Styling */
.app-header {
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

html.dark-theme .app-header {
  background-color: rgba(22, 30, 46, 0.8);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* SSO / Role Switcher dropdown */
.role-switcher-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

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

.role-switcher-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

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

/* Main Content Container */
.content-container {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Cards & Layout Modules */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

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

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* Stats Widgets */
.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: transform var(--transition-normal);
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.08) rotate(3deg);
}

.stat-icon-wrapper.primary { background-color: var(--primary-light); color: var(--primary-color); }
.stat-icon-wrapper.success { background-color: var(--success-light); color: var(--success-color); }
.stat-icon-wrapper.warning { background-color: var(--warning-light); color: var(--warning-color); }
.stat-icon-wrapper.danger { background-color: var(--danger-light); color: var(--danger-color); }
.stat-icon-wrapper.info { background-color: var(--info-light); color: var(--info-color); }

/* Glowing Pastel Stats Cards */
.stat-card.glow-primary {
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.04);
}
.stat-card.glow-primary:hover {
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.08);
  border-color: var(--primary-color);
}
.stat-card.glow-success {
  border-left: 4px solid var(--success-color);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.04);
}
.stat-card.glow-success:hover {
  box-shadow: 0 15px 35px rgba(16, 185, 129, 0.08);
  border-color: var(--success-color);
}
.stat-card.glow-danger {
  border-left: 4px solid var(--danger-color);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.04);
}
.stat-card.glow-danger:hover {
  box-shadow: 0 15px 35px rgba(239, 68, 68, 0.08);
  border-color: var(--danger-color);
}
.stat-card.glow-warning {
  border-left: 4px solid var(--warning-color);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.04);
}
.stat-card.glow-warning:hover {
  box-shadow: 0 15px 35px rgba(245, 158, 11, 0.08);
  border-color: var(--warning-color);
}

html.dark-theme .stat-card.glow-primary {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, var(--bg-secondary) 100%);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.08);
}
html.dark-theme .stat-card.glow-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, var(--bg-secondary) 100%);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.08);
}
html.dark-theme .stat-card.glow-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.03) 0%, var(--bg-secondary) 100%);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.08);
}
html.dark-theme .stat-card.glow-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, var(--bg-secondary) 100%);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.08);
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* Controls & Forms */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 280px;
  flex-wrap: wrap;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  padding-left: 42px; /* for search icon */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.select-control {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  min-width: 120px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-family: inherit;
}

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

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}
.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}
.btn-danger:hover {
  background-color: #dc2626;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}

.btn i {
  width: 16px;
  height: 16px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  margin-top: 16px;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background-color: var(--bg-secondary);
}

.app-table th {
  background-color: var(--bg-tertiary);
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.app-table td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.app-table tr:last-child td {
  border-bottom: none;
}

.app-table tr:hover td {
  background-color: rgba(99, 102, 241, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background-color: var(--success-light); color: var(--success-color); }
.badge-warning { background-color: var(--warning-light); color: var(--warning-color); }
.badge-danger { background-color: var(--danger-light); color: var(--danger-color); }
.badge-info { background-color: var(--info-light); color: var(--info-color); }

/* Toast Notifications styling */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 450px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  padding: 16px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateX(120%);
  transition: transform var(--transition-normal);
}

.toast.show {
  transform: translateX(0);
}

.toast-success { border-left-color: var(--success-color); }
.toast-success i { color: var(--success-color); }

.toast-error { border-left-color: var(--danger-color); }
.toast-error i { color: var(--danger-color); }

.toast-warning { border-left-color: var(--warning-color); }
.toast-warning i { color: var(--warning-color); }

.toast-info { border-left-color: var(--info-color); }
.toast-info i { color: var(--info-color); }

.toast-content {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.show {
  opacity: 1;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 550px;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-overlay.show .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

.modal-close-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  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;
}

/* Kanban Board Styling */
.kanban-board {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-column {
  flex: 1;
  min-width: 280px;
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.kanban-column-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-card-count {
  font-size: 11px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.kanban-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 150px;
}

.kanban-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.5;
  border: 2px dashed var(--primary-color);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.kanban-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.kanban-card-teacher {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kanban-card-teacher img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.kanban-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

/* Custom LINE Notification Mockup */
.line-mockup-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 350px;
}

.line-bubble {
  background-color: #242526;
  border: 1px solid #3a3b3c;
  border-radius: 18px;
  color: #e4e6eb;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateY(120%);
  opacity: 0;
  transition: all var(--transition-normal);
}

.line-bubble.show {
  transform: translateY(0);
  opacity: 1;
}

.line-bubble-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  position: relative;
}

.line-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
}

.line-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.line-sender-info {
  flex: 1;
}

.line-sender-name {
  font-size: 13px;
  font-weight: 600;
  color: #06c755; /* LINE green color */
}

.line-time {
  font-size: 10px;
  color: #b0b3b8;
}

.line-close-btn {
  background: none;
  border: none;
  color: #a0a0a0;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.line-bubble-body {
  font-size: 13px;
  background-color: #3a3b3c;
  padding: 12px 14px;
  border-radius: 0 16px 16px 16px;
  line-height: 1.5;
  color: white;
  word-break: break-all;
}

/* Forms & UI Elements specifically for Modules */
.grid-gap-md {
  display: grid;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Module Grid inside Manager */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.module-status-badge {
  position: absolute;
  top: 16px;
  right: 16px;
}

.module-roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* Attendance Check table radio styling */
.attendance-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attendance-radio {
  display: none;
}

.attendance-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.attendance-label:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.attendance-radio:checked + .attendance-label.label-present {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
  transform: scale(1.04);
}

.attendance-radio:checked + .attendance-label.label-late {
  background-color: var(--warning-color);
  border-color: var(--warning-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
  transform: scale(1.04);
}

.attendance-radio:checked + .attendance-label.label-absent {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
  transform: scale(1.04);
}

.attendance-radio:checked + .attendance-label.label-sick {
  background-color: var(--info-color);
  border-color: var(--info-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
  transform: scale(1.04);
}

/* Behavior Points Leaderboard List */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
}

.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-rank {
  width: 24px;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.leaderboard-rank.rank-1 { color: #f59e0b; font-size: 16px; }
.leaderboard-rank.rank-2 { color: #94a3b8; font-size: 15px; }
.leaderboard-rank.rank-3 { color: #b45309; font-size: 14px; }

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  :root {
    --sidebar-width: 260px;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main-wrapper {
    margin-left: 0;
  }
  
  .menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
  }
  
  /* Sidebar overlay when open on mobile */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 95;
    display: none;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 768px) {
  .grid-cols-3, .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-filter-group {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }
  
  .search-input-wrapper {
    max-width: none;
  }
  
  .action-buttons {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  
  .app-header {
    padding: 0 12px;
    height: 56px;
  }
  
  .content-container {
    padding: 12px;
  }

  /* Header overflow fixes */
  .page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .header-right {
    gap: 8px;
  }

  .active-user-badge .header-username {
    display: none;
  }

  .active-user-badge .profile-chevron {
    display: none;
  }

  .active-user-badge {
    padding: 4px !important;
    border-radius: 50%;
  }

  /* Stat card mobile adjustments */
  .stat-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-card {
    gap: 14px;
  }

  /* Toast notification fix */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 16px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  /* LINE notification mockup fix */
  .line-mockup-container {
    width: auto;
    max-width: calc(100vw - 24px);
    left: 12px;
    right: 12px;
  }

  /* Module manager grid fix */
  .modules-grid {
    grid-template-columns: 1fr;
  }

  /* Card hover disable on mobile (prevents jank) */
  .card:hover {
    transform: none;
  }

  /* Kanban board mobile */
  .kanban-column {
    min-width: 260px;
  }

  /* Select controls */
  .select-control {
    min-width: 0;
    width: 100%;
  }

  /* Modals as premium bottom sheets on mobile */
  .modal-overlay, .profile-modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-card, .profile-modal {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 85vh !important;
    transform: translateY(100%);
    animation: slideUpModalMobile 0.3s cubic-bezier(0.32, 0.94, 0.6, 1) forwards !important;
  }

  .modal-overlay.show .modal-card, .profile-modal-overlay.active .profile-modal {
    transform: translateY(0) !important;
  }

  .modal-body, .profile-modal-body {
    max-height: 60vh !important;
    padding: 16px 20px 24px 20px !important;
  }

  .modal-footer, .profile-modal-footer {
    padding: 12px 16px 24px 16px !important;
  }

  @keyframes slideUpModalMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Attendance radio buttons - larger touch targets */
  .attendance-label {
    padding: 10px 14px;
    font-size: 12px;
    min-height: 44px;
  }
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Premium Login Screen Design */
.login-container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  background: radial-gradient(circle at 10% 20%, var(--primary-light) 0%, var(--bg-primary) 90%);
  position: relative;
  overflow: hidden;
  padding: 20px;
  transition: background-color var(--transition-normal);
}

.login-backdrop-decor {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.decor-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  transition: all var(--transition-normal);
  animation: floatCircle 8s ease-in-out infinite alternate;
}

@keyframes floatCircle {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.1); }
}

.decor-1 {
  width: 500px;
  height: 500px;
  background-color: var(--primary-color);
  top: -150px;
  right: -100px;
  animation-delay: 0s;
}

.decor-2 {
  width: 600px;
  height: 600px;
  background-color: var(--info-color);
  bottom: -200px;
  left: -150px;
  animation-delay: -3s;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--border-radius-xl);
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  z-index: 10;
  position: relative;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition-normal);
}

html.dark-theme .login-card {
  background: rgba(22, 30, 46, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.login-card.shake {
  animation: shake 0.3s ease-in-out;
  border-color: var(--danger-color) !important;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.2);
}

.login-header-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--border-radius-lg);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
  margin-bottom: 20px;
  transform: rotate(-5deg);
  transition: transform 0.3s ease;
}

.login-logo-icon:hover {
  transform: rotate(0deg) scale(1.05);
}

.login-header-logo h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.login-header-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.input-icon-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  width: 20px;
  height: 20px;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.login-input {
  padding-left: 48px !important;
  height: 48px;
  border-radius: var(--border-radius-md) !important;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: all var(--transition-fast);
}

.login-input:focus {
  border-color: var(--primary-color);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.login-input:focus + .input-icon {
  color: var(--primary-color);
}

.login-submit-btn {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}

.login-demo-helper {
  margin-top: 36px;
  border-top: 1px solid var(--border-color);
  padding-top: 28px;
}

.demo-helper-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 0.06em;
}

.demo-accounts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.demo-account-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: left;
}

.demo-account-badge:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.demo-badge-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.demo-badge-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.demo-badge-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-badge-role {
  font-size: 8px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 700;
}

/* Header Redesign Components */
.active-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 9999px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.header-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.logout-btn {
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.logout-btn:hover {
  background-color: var(--danger-light);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

@media (max-width: 768px) {
  .logout-text {
    display: none;
  }
  .logout-btn {
    padding: 0;
    width: 40px;
    height: 40px;
  }
}

/* ═══════════════════════════════════════════════════════
   Profile Modal & Clickable Avatar
   ═══════════════════════════════════════════════════════ */

.clickable-profile {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 12px;
  padding: 4px 10px 4px 4px !important;
}
.clickable-profile:hover {
  background: var(--bg-tertiary);
}
.profile-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
  margin-left: 2px;
}
.clickable-profile:hover .profile-chevron {
  transform: translateY(2px);
}

/* Overlay */
.profile-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 24px;
  animation: profileFadeIn 0.25s ease;
}
.profile-modal-overlay.active {
  display: flex;
}
@keyframes profileFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Card */
.profile-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.15);
  animation: profileSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@keyframes profileSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}
.profile-modal-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.profile-modal-header h3 svg,
.profile-modal-header h3 i {
  width: 20px;
  height: 20px;
  color: var(--primary-color);
}
.profile-modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: all 0.15s ease;
}
.profile-modal-close:hover {
  background: var(--danger-light);
  color: var(--danger-color);
}

.profile-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

/* Avatar Section */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.profile-avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: relative;
  overflow: visible;
}
.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.profile-avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
}
.profile-avatar-upload-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}
.profile-avatar-upload-btn svg,
.profile-avatar-upload-btn i {
  width: 16px;
  height: 16px;
}
.avatar-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* Form Groups */
.profile-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.profile-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.profile-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.profile-input-wrapper i,
.profile-input-wrapper svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.profile-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: inherit;
}
.profile-input-wrapper input::placeholder {
  color: var(--text-tertiary);
}

/* Footer */
.profile-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}
.profile-modal-footer .btn {
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
}
.profile-modal-footer .btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-modal-footer .btn-primary svg,
.profile-modal-footer .btn-primary i {
  width: 16px;
  height: 16px;
}

@media (max-width: 480px) {
  .profile-modal {
    max-width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
  }
  .profile-modal-body {
    padding: 16px !important;
  }

  /* Extra small screen fixes */
  .stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .stat-icon-wrapper svg,
  .stat-icon-wrapper i {
    width: 18px;
    height: 18px;
  }

  .stat-value {
    font-size: 18px;
  }

  .kanban-column {
    min-width: 220px;
  }

  .page-title {
    font-size: 14px;
    max-width: 100px;
  }

  .content-container {
    padding: 8px;
  }

  /* Login card responsive */
  .login-card {
    padding: 24px 20px;
  }

  .login-header-logo {
    margin-bottom: 24px;
  }

  /* Buttons touch-friendly */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .btn-icon {
    min-height: 44px;
    min-width: 44px;
  }

  /* Attendance labels even more compact */
  .attendance-options {
    gap: 6px;
  }

  .attendance-label {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════
   Dark Mode Contrast Fixes
   ═══════════════════════════════════════════════════════ */
html.dark-theme {
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
}

html.dark-theme .text-secondary,
html.dark-theme .stat-label,
html.dark-theme .dash-kanban-label,
html.dark-theme .dash-mini-label {
  color: #cbd5e1 !important;
}

html.dark-theme .dash-kanban-num,
html.dark-theme .dash-mini-value {
  color: #f8fafc !important;
}

