/* =========================================
   NoSeumCode - Dashboard & Mon Espace
   Charte graphique harmonisée avec la page d'accueil
   ========================================= */

:root {
  --dash-bg: #f5f7fa;
  --dash-card-bg: #ffffff;
  --dash-card-border: rgba(0, 0, 0, 0.08);
  --dash-card-hover-border: var(--primary-green, #00ff87);
  --dash-text: #2d3748;
  --dash-text-muted: #718096;
  --dash-dark-navy: #0a1628;
  --dash-dark-blue: #1a2332;
  --dash-neon-green: #00ff87;
  --dash-neon-blue: #00d9ff;
  --dash-neon-pink: #ff007f;
  --dash-neon-yellow: #ffb800;
  --dash-neon-red: #ff3366;
}

body.dashboard-body {
  background-color: var(--dash-bg);
  color: var(--dash-text);
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  margin: 0;
  padding: 0;
  padding-top: var(--header-height, 115px);
}

@media (max-width: 768px) {
  body.dashboard-body {
    padding-top: var(--header-height, 80px);
  }
}

/* ─── Barre d'outils Utilisateur / Sous-Header ─── */
.dash-toolbar-container {
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: var(--header-height, 115px);
  z-index: 90;
}

@media (max-width: 768px) {
  .dash-toolbar-container {
    top: var(--header-height, 80px);
  }
}

.dash-toolbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dash-user-welcome {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff87, #00d9ff);
  color: #0a1628;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 255, 135, 0.35);
  flex-shrink: 0;
}

.dash-welcome-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dash-dark-navy);
  margin: 0 0 0.2rem 0;
}

.dash-role-tag-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dash-badge-student {
  background: rgba(0, 255, 135, 0.15);
  color: #00a85a;
  border: 1px solid rgba(0, 255, 135, 0.5);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.dash-badge-teacher {
  background: rgba(0, 217, 255, 0.15);
  color: #0284c7;
  border: 1px solid rgba(0, 217, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.dash-badge-admin {
  background: rgba(255, 184, 0, 0.15);
  color: #d97706;
  border: 1px solid rgba(255, 184, 0, 0.5);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.dash-user-email-text {
  font-size: 0.8rem;
  color: var(--dash-text-muted);
}

.dash-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

/* Notification Bell */
.notif-bell-btn {
  position: relative;
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--dash-dark-navy);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-bell-btn:hover {
  background: #e2e8f0;
  border-color: #00a85a;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff3366;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: max-content;
  min-width: 320px;
  max-width: min(440px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 18px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}

.notif-dropdown.show,
.notif-dropdown.open {
  display: block;
  animation: notifSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .notif-dropdown {
    position: fixed;
    top: calc(var(--header-height, 80px) + 64px);
    left: 12px;
    right: 12px;
    width: auto;
    min-width: unset;
    max-width: unset;
    max-height: calc(100dvh - 160px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
  }

  .notif-dropdown.show,
  .notif-dropdown.open {
    animation: notifMobileSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes notifMobileSlide {
    from {
      opacity: 0;
      transform: translateY(-12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

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

.notif-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dash-dark-navy);
}

.notif-mark-all-btn {
  background: none;
  border: none;
  color: #00a85a;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  transition: background 0.15s ease;
}

.notif-item:hover {
  background: #f8fafc;
}

.notif-item.unread {
  background: #f0fdf4;
}

.notif-content h5 {
  margin: 0 0 0.2rem 0;
  font-size: 0.85rem;
  color: var(--dash-dark-navy);
}

.notif-content p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--dash-text-muted);
  line-height: 1.4;
}

.notif-time {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

.dash-btn-logout {
  background: #fff0f3;
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.2);
  border-radius: 12px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.dash-btn-logout:hover {
  background: #ffe0e6;
  border-color: #ff3366;
}

/* ─── Main Container & Hero ─── */
.dash-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.dash-hero {
  background: linear-gradient(135deg, #0a1628 0%, #1a2332 100%);
  color: #ffffff;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

.dash-hero::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 255, 135, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.dash-hero-title {
  font-family: 'Bangers', cursive;
  font-size: 2.75rem;
  letter-spacing: 1px;
  margin: 0 0 0.5rem 0;
  color: #ffffff;
}

.dash-hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 750px;
  line-height: 1.6;
}

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-icon-wrapper.green { background: #dcfce7; }
.stat-icon-wrapper.blue { background: #e0f2fe; }
.stat-icon-wrapper.yellow { background: #fef3c7; }
.stat-icon-wrapper.pink { background: #fce7f3; }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--dash-dark-navy);
  line-height: 1.1;
  font-family: 'Poppins', sans-serif;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--dash-text-muted);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* ─── Sections & Titles ─── */
.dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-section-title {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: var(--dash-dark-navy);
  letter-spacing: 0.5px;
  margin: 0;
}

/* ─── Courses & Cards Grid ─── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.dash-course-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.dash-course-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 255, 135, 0.5);
}

.dash-course-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dash-course-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #00a85a;
  background: #dcfce7;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
}

.dash-course-body {
  padding: 0 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dash-course-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dash-dark-navy);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.dash-course-desc {
  font-size: 0.88rem;
  color: var(--dash-text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

.dash-progress-container {
  margin-bottom: 1.25rem;
}

.dash-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dash-text-muted);
  margin-bottom: 0.4rem;
}

.dash-progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.dash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff87, #00d9ff);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.dash-card-footer {
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ─── Alert Boxes ─── */
.alert-box {
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-box.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-box.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* ─── Modals ─── */
.dash-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dash-modal {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  color: var(--dash-text);
}

.dash-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dash-modal-header h3 {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  letter-spacing: 0.5px;
  color: var(--dash-dark-navy);
  margin: 0;
}

.dash-modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s ease;
}

.dash-modal-close:hover {
  color: #ff3366;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dash-dark-navy);
  margin-bottom: 0.4rem;
}

.form-input, .form-select {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--dash-dark-navy);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: #00ff87;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.2);
}

/* ========================================================
   Admin Interactive Tabs & Sortable Table Styles
   ======================================================== */
.stat-card-interactive {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 255, 135, 0.5);
}

.stat-card-interactive.active {
  border-color: #00ff87 !important;
  background: #ffffff !important;
  box-shadow: 0 8px 24px rgba(0, 255, 135, 0.22) !important;
}

.stat-card-interactive.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #00ff87, #00d9ff);
}

.status-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge-banned {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge-deleted {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.payment-badge-paid {
  display: inline-flex;
  align-items: center;
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.payment-badge-free {
  display: inline-flex;
  align-items: center;
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.payment-badge-pending {
  display: inline-flex;
  align-items: center;
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.payment-badge-refunded {
  display: inline-flex;
  align-items: center;
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.payment-badge-failed {
  display: inline-flex;
  align-items: center;
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

#admin-users-table th:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.course-title-link {
  color: var(--dash-dark-navy);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.course-title-link:hover {
  color: #00d9ff;
  text-decoration: underline;
}

