/* ============================================================
   E-LEARNING PLATFORM — Reusable Components
   Buttons, Cards, Badges, Forms, Tables, Modals, Toast, etc.
   ============================================================ */

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 1rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(212, 168, 67, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  box-shadow: 0 4px 16px rgba(212, 168, 67, 0.4);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--navy-700);
  color: var(--white);
}
.btn-secondary:hover {
  background: var(--navy-600);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
}
.btn-outline:hover {
  border-color: var(--gold-500);
  color: var(--gold-500);
  background: rgba(212, 168, 67, 0.05);
}

.btn-outline-white {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.4);
}
.btn-outline-white:hover {
  border-color: var(--white);
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

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

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

.btn-sm { padding: 0.4rem 0.85rem; font-size: var(--font-size-xs); }
.btn-lg { padding: 0.85rem 1.75rem; font-size: var(--font-size-base); }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-md); }
.btn-icon:hover { background: var(--gray-100); }

/* ═══════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════ */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--gray-300);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}
.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.stat-card .stat-content { flex: 1; }
.stat-card .stat-value { font-size: var(--font-size-lg); font-weight: var(--font-weight-bold); color: var(--gray-900); line-height: 1; margin-bottom: var(--space-1); }
.stat-card .stat-label { font-size: var(--font-size-sm); color: var(--gray-500); }

.stat-card.stat-blue { border-left-color: var(--info); }
.stat-card.stat-blue .stat-icon { background: var(--info-light); color: var(--info); }
.stat-card.stat-green { border-left-color: var(--success); }
.stat-card.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.stat-gold { border-left-color: var(--gold-500); }
.stat-card.stat-gold .stat-icon { background: var(--gold-200); color: var(--gold-600); }
.stat-card.stat-red { border-left-color: var(--danger); }
.stat-card.stat-red .stat-icon { background: var(--danger-light); color: var(--danger); }

/* ═══════════════════════════════════════
   CONTENT CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { margin-bottom: 0; }
.card-body { padding: var(--space-5); }
.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Course Card */
.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}
.course-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-4px); }
.course-card .course-banner {
  height: 120px;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400); font-size: 2rem;
}
.course-card .course-info { padding: var(--space-4); }
.course-card .course-title { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-1); color: var(--gray-900); }
.course-card .course-meta { font-size: var(--font-size-sm); color: var(--gray-500); margin-bottom: var(--space-3); }
.course-card .course-progress { padding: 0 var(--space-4) var(--space-4); }

/* Task Card */
.task-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: var(--space-3);
  transition: all var(--transition-fast);
}
.task-card:hover { border-color: var(--gold-400); box-shadow: var(--shadow-sm); }
.task-card .task-status {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.task-card .task-status.pending { background: var(--warning); }
.task-card .task-status.submitted { background: var(--info); }
.task-card .task-status.graded { background: var(--success); }
.task-card .task-status.overdue { background: var(--danger); }
.task-card .task-info { flex: 1; }
.task-card .task-title { font-weight: var(--font-weight-medium); font-size: var(--font-size-sm); color: var(--gray-800); }
.task-card .task-deadline { font-size: var(--font-size-xs); color: var(--gray-500); margin-top: 2px; }

/* ═══════════════════════════════════════
   BADGES
   ═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.badge-primary { background: var(--navy-700); color: var(--white); }
.badge-gold { background: var(--gold-200); color: var(--gold-600); }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-info { background: var(--info-light); color: var(--info-dark); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

/* Notification dot */
.notif-dot {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--danger);
  color: var(--white);
  font-size: 10px; font-weight: var(--font-weight-bold);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}

/* ═══════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════ */
.progress { background: var(--gray-200); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  transition: width 0.8s ease-out;
}
.progress-bar.progress-success { background: linear-gradient(90deg, var(--success), var(--success-dark)); }
.progress-bar.progress-info { background: linear-gradient(90deg, var(--info), var(--info-dark)); }
.progress-bar.progress-danger { background: linear-gradient(90deg, var(--danger), var(--danger-dark)); }
.progress-label { display: flex; justify-content: space-between; margin-bottom: var(--space-1); font-size: var(--font-size-xs); color: var(--gray-500); }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}
.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--font-size-sm);
  color: var(--gray-800);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.form-control:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15); }
.form-control::placeholder { color: var(--gray-400); }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 2rem; }
.form-text { font-size: var(--font-size-xs); color: var(--gray-500); margin-top: var(--space-1); }
.form-error { font-size: var(--font-size-xs); color: var(--danger); margin-top: var(--space-1); }
.form-control.is-invalid { border-color: var(--danger); }

/* ═══════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  text-align: left;
}
.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-backdrop,
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop.active,
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  animation: scaleIn 0.25s ease-out;
}
.modal-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { margin: 0; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: all var(--transition-fast);
  cursor: pointer;
  font-size: 20px;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-800); }
.modal-body { padding: var(--space-5); }
.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */
.toast-container {
  position: fixed; top: var(--space-6); right: var(--space-6);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.toast {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: var(--space-3);
  min-width: 300px;
  animation: slideInRight 0.4s ease forwards;
  border-left: 4px solid var(--gray-400);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }
.toast-message { flex: 1; font-size: var(--font-size-sm); color: var(--gray-700); }

/* ═══════════════════════════════════════
   DISCUSSION THREAD
   ═══════════════════════════════════════ */
.discussion-bubble {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}
.discussion-bubble:hover { background: var(--gray-50); }
.discussion-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--navy-700);
  color: var(--gold-400);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-sm); font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
.discussion-content { flex: 1; }
.discussion-meta { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.discussion-author { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); color: var(--gray-800); }
.discussion-time { font-size: var(--font-size-xs); color: var(--gray-400); }
.discussion-text { font-size: var(--font-size-sm); color: var(--gray-600); line-height: var(--line-height-relaxed); }

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--gray-400);
}
.empty-state i { font-size: 3rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h4 { color: var(--gray-500); margin-bottom: var(--space-2); }
.empty-state p { font-size: var(--font-size-sm); color: var(--gray-400); margin-bottom: var(--space-4); }

/* ═══════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════ */
.breadcrumb {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-6);
}
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--gold-500); }
.breadcrumb .separator { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-800); font-weight: var(--font-weight-medium); }

/* ═══════════════════════════════════════
   FILE UPLOAD ZONE
   ═══════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--gold-500);
  background: rgba(212, 168, 67, 0.05);
}
.upload-zone i { font-size: 2rem; color: var(--gray-400); margin-bottom: var(--space-3); }
.upload-zone p { font-size: var(--font-size-sm); color: var(--gray-500); margin-bottom: var(--space-1); }
.upload-zone .upload-hint { font-size: var(--font-size-xs); color: var(--gray-400); }

/* ═══════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════ */
.avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--gray-200);
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-initials {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  color: var(--gold-400);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}

/* ═══════════════════════════════════════
   DROPDOWN
   ═══════════════════════════════════════ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  display: none;
  animation: fadeInDown 0.2s ease;
}
.dropdown-menu.active { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--gray-900); }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: var(--space-2) 0; }

/* ═══════════════════════════════════════
   TAB NAVIGATION
   ═══════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  gap: 0;
  margin-bottom: var(--space-6);
}
.tab-item {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab-item:hover { color: var(--gray-800); }
.tab-item.active {
  color: var(--gold-600);
  border-bottom-color: var(--gold-500);
}
