/* MASTER SPACE — Components */

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; border: none; border-radius: var(--radius-md); font-weight: 600; font-size: 0.9rem; transition: all var(--transition-normal); letter-spacing: 0.02em; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--yellow), var(--yellow-dark)); color: #000; box-shadow: var(--shadow-yellow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--yellow-light), var(--yellow)); box-shadow: 0 0 30px rgba(245,197,24,0.3); color: #000 !important; }
.btn-green { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; box-shadow: var(--shadow-green); }
.btn-green:hover { background: linear-gradient(135deg, var(--green-light), var(--green)); color: #fff !important; }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border-primary); color: var(--text-secondary); }
.btn-icon:hover { border-color: var(--yellow); color: var(--yellow); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card { background: var(--bg-card-glass, rgba(22, 22, 22, 0.4)); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border-card-glass, rgba(255, 255, 255, 0.05)); border-radius: var(--radius-lg); padding: 24px; transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal); box-shadow: var(--shadow-card-glass, 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03)); }
.card:hover { transform: translateY(-2px); border-color: var(--border-card-glass-hover, rgba(255, 255, 255, 0.12)); background: var(--bg-card-glass-hover, rgba(30, 30, 30, 0.45)); box-shadow: var(--shadow-card-glass-hover, 0 15px 35px rgba(0, 0, 0, 0.35)); }
.card-glow:hover { box-shadow: var(--shadow-yellow); border-color: var(--yellow-dark); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.session-card-actions { display: flex; gap: 8px; margin-top: 24px; align-items: center; }

/* ── Stat Cards ── */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--yellow), var(--green)); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-card .stat-icon.yellow { background: rgba(245,197,24,0.1); color: var(--yellow); }
.stat-card .stat-icon.green { background: rgba(57,167,81,0.1); color: var(--green); }
.stat-card .stat-icon.blue { background: rgba(59,130,246,0.1); color: #3B82F6; }
.stat-card .stat-icon.purple { background: rgba(139,92,246,0.1); color: #8B5CF6; }
.stat-value { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; margin-top: 12px; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}
.form-input:focus {
  border-color: var(--yellow);
  background: var(--bg-modal);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 0 0 4px rgba(245,197,24,0.15);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f5c518' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
  padding-right: 40px;
  cursor: pointer;
  background-color: var(--bg-card);
  transition: all var(--transition-fast);
}
select.form-input option {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  padding: 12px;
}
@media (max-width: 768px) {
  select.form-input, .form-input {
    font-size: 1rem; /* Better for iOS to prevent zoom */
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border-light);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
    background-color: var(--bg-card);
  }
  select.form-input:focus, .form-input:focus {
    border-color: var(--yellow);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 0 0 4px rgba(245,197,24,0.25);
  }
}

/* ── Tables ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-primary); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 14px 16px; text-align: left; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); background: var(--bg-secondary); border-bottom: 1px solid var(--border-primary); }
.data-table td { padding: 14px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--border-primary); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Sortable Columns ── */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}
.data-table th.sortable:hover { color: var(--yellow); background: rgba(245,197,24,0.06); }
.data-table th.sortable.sorted { color: var(--yellow); }
.data-table th.sortable .sort-icon {
  display: inline-block;
  opacity: 0.45;
  font-size: 0.8em;
  margin-left: 2px;
  transition: opacity var(--transition-fast);
}
.data-table th.sortable:hover .sort-icon,
.data-table th.sortable.sorted .sort-icon { opacity: 1; }

/* ── Skeleton Screens ── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-row td { padding: 12px 16px; vertical-align: middle; }
.skeleton-row td > .skeleton + .skeleton { margin-top: 5px; }


/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--status-pending); }
.badge-enrolled { background: rgba(59,130,246,0.15); color: var(--status-enrolled); }
.badge-training { background: rgba(139,92,246,0.15); color: var(--status-training); }
.badge-evaluated { background: rgba(249,115,22,0.15); color: var(--status-evaluated); }
.badge-certified { background: rgba(57,167,81,0.15); color: var(--status-certified); }
.badge-standard { background: rgba(245,197,24,0.15); color: var(--yellow); }
.badge-pro { background: rgba(57,167,81,0.15); color: var(--green); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity var(--transition-normal); }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-modal-glass, rgba(20, 20, 20, 0.6)); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border-modal-glass, rgba(255, 255, 255, 0.08)); border-radius: var(--radius-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; transform: translateY(24px) scale(0.96); transition: transform var(--transition-slow); box-shadow: var(--shadow-modal-glass, 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05)); }
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 28px 28px 0; }
.modal-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.modal-close { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border: none; background: var(--bg-card); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; transition: all var(--transition-fast); border: 1px solid var(--border-primary); flex-shrink: 0; }
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }
.modal-body { padding: 24px 28px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; padding: 0 28px 28px; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 16px 20px; border-radius: var(--radius-md); font-size: 0.9rem; font-weight: 500; box-shadow: var(--shadow-toast, 0 10px 30px rgba(0, 0, 0, 0.4)); animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s ease 3.7s forwards; min-width: 320px; display: flex; align-items: center; gap: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-toast-glass, rgba(255, 255, 255, 0.05)); position: relative; overflow: hidden; }
.toast-success { background: var(--bg-toast-success, rgba(57, 167, 81, 0.15)); color: var(--text-toast-success, #fff); border-left: 4px solid var(--green); }
.toast-error { background: var(--bg-toast-error, rgba(239, 68, 68, 0.15)); color: var(--text-toast-error, #fff); border-left: 4px solid var(--danger); }
.toast-info { background: var(--bg-toast-info, rgba(59, 130, 246, 0.15)); color: var(--text-toast-info, #fff); border-left: 4px solid #3b82f6; }
.toast::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; transform-origin: left; animation: toast-progress 3.7s linear forwards; }
.toast-success::after { background: var(--green); }
.toast-error::after { background: var(--danger); }
.toast-info::after { background: #3b82f6; }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Sidebar ── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: var(--bg-sidebar, rgba(17, 17, 17, 0.65)); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-right: 1px solid var(--border-primary); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid var(--border-primary); position: relative; }
.sidebar-logo { height: 40px; object-fit: contain; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; transition: all var(--transition-fast); cursor: pointer; margin-bottom: 4px; text-decoration: none; min-height: 48px; }
.nav-item:hover { background: var(--bg-nav-hover, rgba(255, 255, 255, 0.03)); color: var(--text-primary); }
.nav-item.active { background: rgba(245,197,24,0.1); color: var(--yellow); border-left: 3px solid var(--yellow); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border-primary); }
.main-content { margin-left: 280px; flex: 1; padding: 32px; min-height: 100vh; display: flex; flex-direction: column; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }
.page-header { margin-bottom: 32px; }
.page-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* ── Mobile Top-bar (Admin) ── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  z-index: 150;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
}

/* Left slot: hamburger button */
.mobile-topbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Center slot: logo only, no text */
.mobile-topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.mobile-topbar-center img { height: 30px; object-fit: contain; }

/* Right slot: logout (shown only on non-admin pages) */
.mobile-topbar-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 44px; /* keeps layout balanced */
}

/* Hide logout on admin pages (sidebar menu has it) */
.mobile-topbar.admin-topbar .mobile-topbar-right { visibility: hidden; }

/* Legacy support: .mobile-topbar-logo (keep for learner portal) */
.mobile-topbar-logo { display: flex; align-items: center; gap: 8px; }
.mobile-topbar-logo img { height: 28px; object-fit: contain; }
.mobile-topbar-logo span { color: var(--yellow); font-family: var(--font-display); font-weight: 800; font-size: 0.85rem; letter-spacing: 0.5px; }

.mobile-topbar-logout { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); font-size: 0.75rem; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-primary); transition: all var(--transition-fast); white-space: nowrap; min-height: 36px; }
.mobile-topbar-logout:hover { border-color: var(--danger); color: var(--danger); }

/* Sidebar toggle inside topbar (no absolute positioning needed) */
.mobile-topbar .sidebar-toggle {
  position: static !important;
  margin: 0 !important;
}

/* ── Progress Bar ── */
.progress-bar { width: 100%; height: 8px; background: var(--bg-input); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-fill.yellow { background: linear-gradient(90deg, var(--yellow-dark), var(--yellow)); }
.progress-fill.green { background: linear-gradient(90deg, var(--green-dark), var(--green)); }

/* ── Share Card (Send Details) ── */
.share-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  animation: shareCardSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.share-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.share-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.share-card-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-primary);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.share-card-close:hover { color: var(--danger); border-color: var(--danger); }
.share-card-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.share-btn {
  flex: 1;
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  letter-spacing: 0.02em;
}
.share-btn:hover { transform: translateY(-2px); }
.share-btn:active { transform: translateY(0); }
.share-btn-email {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}
.share-btn-email:hover { box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45); }
.share-btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
}
.share-btn-whatsapp:hover { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45); }
.share-btn-icon { font-size: 1.2rem; }
@keyframes shareCardSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Shortcode Chips (Template Editor) ── */
.shortcode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.shortcode-chip:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(245, 197, 24, 0.08);
  transform: translateY(-1px);
}
.shortcode-chip:active { transform: translateY(0); }
.shortcode-chip code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--yellow);
  font-size: 0.75rem;
}
.shortcode-chip span {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.shortcode-chip:hover span { color: var(--text-secondary); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* ── Responsive — Tablet (1024px) ── */
@media (max-width: 1024px) {
  .main-content { padding: 24px 20px; }
  .page-title { font-size: 1.5rem; }
  .stat-value { font-size: 1.8rem; }
  .page-header.flex { flex-direction: column; align-items: flex-start !important; }
  .page-actions { width: 100%; }
}

/* ── Responsive — Tablet (1024px) ── */
@media (max-width: 1024px) {
  .main-content { padding: 24px 20px; }
  .page-title { font-size: 1.5rem; }
  .stat-value { font-size: 1.8rem; }
  .page-header.flex { flex-direction: column; align-items: flex-start !important; }
  .page-actions { width: 100%; }
}

/* ── Sidebar Toggle Button (Mobile) ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 300;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  color: var(--yellow);
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background var(--transition-fast), color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle:hover { background: var(--bg-card-hover); }
.sidebar-toggle.is-active {
  transform: rotate(180deg) scale(1.1);
  color: var(--danger);
  border-color: rgba(255,87,87,0.3);
  background: rgba(255,87,87,0.1);
}
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 199; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }

/* Mobile Sidebar Close Button */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 20px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 250;
  opacity: 0;
  transform: rotate(-90deg) scale(0.8);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close-btn:hover { background: rgba(255, 87, 87, 0.1); color: var(--danger); border-color: rgba(255, 87, 87, 0.3); }
.sidebar-close-btn:active { transform: scale(0.9); transition: all 0.1s; }
.sidebar-close-btn.is-active { opacity: 1; transform: rotate(0deg) scale(1); }
/* ── Responsive — Mobile (768px) ── */
@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas panel */
  .sidebar { transform: translateX(-100%); width: 280px; box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .sidebar-toggle { display: flex; }
  .sidebar-close-btn { display: flex; }
  /* When sidebar-toggle is inside mobile-topbar, don't show the standalone fixed one */
  body:has(.mobile-topbar) > .sidebar-toggle { display: none; }
  .mobile-topbar { display: flex; }

  /* Main content: no margin-left, padded for top bar (56px topbar + 16px gap) */
  .main-content {
    margin-left: 0 !important;
    padding: 24px 20px;
    padding-top: 76px;
    width: 100%;
  }

  /* Typography */
  .page-title { font-size: 1.25rem; }
  .page-subtitle { font-size: 0.85rem; }

  /* Stats */
  .stat-value { font-size: 1.6rem; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }

  /* Cards */
  .card { padding: 16px; }
  .card-header { flex-direction: row; flex-wrap: wrap; gap: 8px; }

  /* Tables — scroll the TABLE inside the wrapper, not the whole card */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); border: 1px solid var(--border-primary); }
  .data-table { min-width: 520px; }
  .data-table th, .data-table td { padding: 10px 10px; font-size: 0.8rem; white-space: nowrap; }

  /* Modals — mobile centered with good breathing room */
  .modal-overlay { padding: 24px; align-items: center; }
  .modal { max-width: 480px; width: 100%; border-radius: var(--radius-xl); }
  .modal-header { padding: 22px 20px 0; }
  .modal-body { padding: 18px 20px; }
  .modal-footer { padding: 0 20px 22px; flex-wrap: wrap; gap: 10px; }
  .modal-footer .btn { flex: 1; min-width: 100px; justify-content: center; }

  /* Buttons */
  .btn { padding: 10px 16px; font-size: 0.85rem; }
  .btn-lg { padding: 12px 24px; font-size: 0.95rem; }
  .btn-sm { padding: 8px 12px; font-size: 0.78rem; }

  /* Forms */
  .form-input { font-size: 1rem; }

  /* Page actions stack vertically */
  .page-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; }
  .page-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

  /* Search / filters */
  .search-box { min-width: 0; flex: 1; }
  .filter-select { width: 100%; }

  /* Grids */
  .grid-2 { grid-template-columns: 1fr !important; }

  /* Toasts */
  .toast-container { top: 68px; right: 12px; left: 12px; }
  .toast { min-width: auto; width: 100%; font-size: 0.82rem; padding: 10px 14px; }

  /* Share card buttons stack */
  .share-card-actions { flex-direction: column; }
  .share-btn { min-width: 0; }
}

/* ── Responsive — Large Mobile (430px–768px) ── */
@media (max-width: 430px) {
  .main-content { padding: 18px 16px; padding-top: 74px; }
  .page-title { font-size: 1.1rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: 0.72rem; }
  .card { padding: 16px; border-radius: var(--radius-md); }
}

/* ── Responsive — Small Phone (< 390px) ── */
@media (max-width: 390px) {
  .main-content { padding: 14px 14px; padding-top: 70px; }
  .page-title { font-size: 1rem; }
  .stat-value { font-size: 1.3rem; }
  .card { padding: 14px; }
  .btn-sm { padding: 6px 10px; font-size: 0.72rem; }
  .btn-icon { width: 36px; height: 36px; }
  .badge { padding: 3px 7px; font-size: 0.65rem; }
  .nav-item { padding: 10px 14px; font-size: 0.85rem; }
  /* Modals fill screen nicely */
  .modal-overlay { padding: 16px; }
  .modal-header { padding: 18px 16px 0; }
  .modal-body { padding: 16px 16px; }
  .modal-footer { padding: 0 16px 18px; }
}

/* ── Touch-friendly targets ── */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 48px; }
  .nav-item { min-height: 48px; }
  .btn-icon { min-width: 48px; min-height: 48px; }
  .form-input { min-height: 48px; }
  .option-item { min-height: 52px; }
  .sidebar-toggle { min-width: 48px; min-height: 48px; width: 48px; height: 48px; }
  .modal-close { width: 48px; height: 48px; min-width: 48px; min-height: 48px; }
}

/* ════════════════════════════════════════════════════════════════════════
   PREMIUM MOBILE CARDS — Apprenants / Quiz / Attestations
   ════════════════════════════════════════════════════════════════════════ */

/* ── Learner Cards ── */
.learner-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}
.learner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.learner-card:active { transform: scale(0.985); }
.learner-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-light);
}
.learner-card-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), #f59e0b);
  color: #000;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -1px;
}
.learner-card-identity { flex: 1; min-width: 0; }
.learner-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learner-card-id {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--yellow);
  margin-top: 2px;
}
.learner-card-status { flex-shrink: 0; }
.learner-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.learner-card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}
.learner-card-meta-label {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 12px;
}
.learner-card-meta-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.learner-card-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: rgba(0,0,0,0.1);
}
.learner-card-btn {
  flex: 1;
  text-align: center;
  font-size: 0.78rem !important;
  padding: 8px 12px !important;
  justify-content: center;
}
.learner-card-btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Quiz Question Cards v2 ── */
.quiz-q-cards-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}
.quiz-q-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.quiz-q-card-v2-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quiz-q-card-v2-num {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.quiz-q-cat { font-size: 0.7rem !important; }
.quiz-q-card-v2-question {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.quiz-q-card-v2-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quiz-q-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  line-height: 1.4;
}
.quiz-q-option.correct {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.35);
  color: var(--green);
  font-weight: 600;
}
.quiz-q-opt-letter {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border-primary);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.quiz-q-option.correct .quiz-q-opt-letter {
  background: var(--green);
  color: #fff;
}
.quiz-q-card-v2-justif {
  font-size: 0.78rem;
  color: var(--blue);
  font-style: italic;
  background: rgba(96,165,250,0.08);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--blue);
  line-height: 1.5;
}
.quiz-q-card-v2-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.quiz-q-card-v2-actions .btn {
  flex: 1;
  font-size: 0.78rem !important;
  padding: 8px 10px !important;
  text-align: center;
  justify-content: center;
}

/* ── Certificate Cards v2 ── */
.cert-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}
.cert-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.cert-card-v2-type {
  padding: 8px 16px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.cert-competence {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05));
  color: var(--green);
  border-bottom: 1px solid rgba(16,185,129,0.2);
}
.cert-participation {
  background: linear-gradient(135deg, rgba(245,197,24,0.15), rgba(245,197,24,0.05));
  color: var(--yellow);
  border-bottom: 1px solid rgba(245,197,24,0.2);
}
.cert-card-v2-num {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--yellow);
  font-weight: 700;
  padding: 12px 16px 4px;
}
.cert-card-v2-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  padding: 0 16px 6px;
}
.cert-card-v2-meta {
  display: flex;
  gap: 16px;
  padding: 0 16px 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.cert-card-v2-session {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0 16px 14px;
}
.cert-card-v2-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: rgba(0,0,0,0.1);
  flex-wrap: wrap;
}
.cert-card-v2-actions .btn {
  flex: 1;
  font-size: 0.72rem !important;
  padding: 7px 6px !important;
  text-align: center;
  justify-content: center;
  min-width: 60px;
}
.cert-card-delete-btn {
  background: rgba(239,68,68,0.12) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(239,68,68,0.3) !important;
  border-radius: var(--radius-sm);
  flex: 0 0 auto !important;
  min-width: 40px !important;
}

/* ════════════════════════════════════════════════════
   MOBILE — Page-specific fixes (≤ 768px)
   ════════════════════════════════════════════════════ */
@media (max-width: 768px) {


  /* ── 1. Apprenants — boutons compacts en ligne ── */
  .page-header { margin-bottom: 20px; }
  .page-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  /* Chaque bouton prend sa taille naturelle, pas toute la largeur */
  .page-actions .btn {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    font-size: 0.78rem;
    padding: 8px 12px;
  }
  /* Sauf le bouton principal qui peut être un peu plus large */
  .page-actions .btn-primary {
    flex: 1 1 auto !important;
    max-width: 200px;
  }

  /* ── 2. Sessions — carte plus large, éléments centrés ── */
  .session-card {
    max-width: 100% !important;
    width: 100% !important;
  }
  /* Override grid-3 (CSS Grid) to flex column on mobile */
  #sessions-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  /* Boutons de la session card en ligne alignée */
  .session-card-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 24px;
  }
  .session-card-actions .btn {
    flex: 1;
    font-size: 0.78rem;
    padding: 8px 8px;
    text-align: center;
  }

  /* 🔹 3. Responsive Data Tables (Card View for Apprenants, Quiz, Certs) 🔹 */
  .table-wrapper {
    overflow-x: hidden;
    border: none;
    border-radius: 0;
    padding: 0;
  }
  .responsive-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: block; width: 100%; }
  .responsive-table tr {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .responsive-table td {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light);
    text-align: right;
  }
  .responsive-table td:last-child {
    border-bottom: none;
    flex-direction: row;
    justify-content: flex-end;
    margin-top: 8px;
    gap: 8px;
  }
  .responsive-table td.block-cell {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    text-align: left;
    margin-right: 16px;
    flex-shrink: 0;
    margin-bottom: 4px;
  }
  
  /* Espace aéré entre éléments de config du Quiz */
  #quiz-config-form {
    flex-direction: column !important;
    gap: 14px !important;
    align-items: stretch !important;
  }
  #quiz-config-form .form-group { min-width: 0 !important; width: 100% !important; }
}

/* ── Premium Mobile Modals (Centered) ── */
@media (max-width: 576px) {
  .modal-overlay {
    padding: 16px;
    align-items: center;
  }
  
  .modal {
    width: 100%;
    max-width: 400px;
    margin: auto;
    max-height: 90vh;
    border-radius: 20px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
  }
  
  .modal-overlay.active .modal {
    transform: scale(1) !important;
  }
  
  .modal-header {
    padding: 16px 16px 0;
  }
  
  .modal-title {
    font-size: 1.15rem;
  }

  .modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-footer {
    padding: 12px 16px 16px;
    background: transparent;
    border-top: none;
    flex-wrap: wrap;
  }
  
  .modal-footer .btn {
    flex: 1;
    min-width: 100px;
  }
}


/* ------------------------------------------------------------------------
   UI COMPONENTS OVERHAUL (Custom Dialogs, Selects, Radio Cards, Uploads)
   ------------------------------------------------------------------------ */

/* -- Custom UI Dialog (Replaces native confirm/alert) -- */
.ui-dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity var(--transition-normal);
}
.ui-dialog-overlay.active { opacity: 1; pointer-events: all; }
.ui-dialog-box {
  background: var(--bg-modal); border: 1px solid var(--border-primary); border-radius: var(--radius-xl);
  width: 100%; max-width: 420px;
  transform: translateY(20px) scale(0.95); transition: transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ui-dialog-overlay.active .ui-dialog-box { transform: translateY(0) scale(1); }
.ui-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 24px 16px; }
.ui-dialog-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--text-primary); flex: 1; margin-top: 2px; }
.ui-dialog-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; border-radius: var(--radius-sm);
  transition: all var(--transition-fast); margin-left: 12px;
}
.ui-dialog-close:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.ui-dialog-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: 16px; }
.ui-dialog-icon svg { width: 24px; height: 24px; }
.ui-dialog-body { padding: 0 24px 24px; }
.ui-dialog-message { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.5; }
.ui-dialog-footer { display: flex; gap: 12px; justify-content: flex-end; padding: 16px 24px; background: rgba(0,0,0,0.2); border-top: 1px solid var(--border-primary); }

/* Dialog Types */
.ui-dialog-box.type-danger .ui-dialog-icon { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.ui-dialog-box.type-warning .ui-dialog-icon { background: rgba(245, 158, 11, 0.15); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.3); }
.ui-dialog-box.type-info .ui-dialog-icon { background: rgba(59, 130, 246, 0.15); color: #3B82F6; border: 1px solid rgba(59, 130, 246, 0.3); }
.ui-dialog-box.type-success .ui-dialog-icon { background: rgba(16, 185, 129, 0.15); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }

@media (max-width: 576px) {
  .ui-dialog-overlay { align-items: flex-end; padding: 12px; }
  .ui-dialog-box { border-radius: var(--radius-xl); margin-bottom: 0; }
  .ui-dialog-footer { padding: 16px; flex-wrap: wrap; }
  .ui-dialog-footer .btn { flex: 1; min-width: 120px; padding: 12px; }
}

/* -- Custom Select (Replaces native OS dropdowns) -- */
.custom-select-wrapper { position: relative; width: 100%; user-select: none; }
.custom-select-wrapper select { display: none !important; }
.custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0 16px; height: var(--input-height, 48px);
  background: var(--bg-input); border: 1px solid var(--border-primary); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 0.95rem; cursor: pointer; transition: all var(--transition-fast);
}
.custom-select-trigger:focus, .custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}
.custom-select-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.custom-select-arrow { display: flex; align-items: center; justify-content: center; color: var(--yellow); margin-left: 12px; transition: transform var(--transition-normal); }
.custom-select-arrow svg { width: 16px; height: 16px; }
.custom-select-wrapper.open .custom-select-arrow { transform: rotate(180deg); }
.custom-select-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 100;
  background: var(--bg-modal); border: 1px solid var(--border-primary); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transform: translateY(-10px); transition: all var(--transition-fast);
}
.custom-select-wrapper.open .custom-select-dropdown { opacity: 1; pointer-events: all; transform: translateY(0); }
.custom-select-options { max-height: 240px; overflow-y: auto; padding: 8px; }
.custom-select-option {
  padding: 12px 16px; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; font-size: 0.9rem; transition: all var(--transition-fast);
}
.custom-select-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.custom-select-option.selected { background: rgba(245,197,24,0.1); color: var(--yellow); font-weight: 600; }
.custom-select-option.disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }

/* -- Radio Cards (Replaces standard radios) -- */
.radio-cards-group { display: flex; gap: 12px; flex-direction: column; }
@media (min-width: 640px) { .radio-cards-group.horizontal { flex-direction: row; } .radio-cards-group.horizontal .radio-card { flex: 1; } }
.radio-card { position: relative; cursor: pointer; }
.radio-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-card-content {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--bg-input); border: 2px solid var(--border-primary); border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}
.radio-card:hover .radio-card-content { border-color: var(--border-light); background: var(--bg-card-hover); }
.radio-card input[type="radio"]:checked + .radio-card-content {
  border-color: var(--yellow); background: rgba(245,197,24,0.05); box-shadow: 0 4px 12px rgba(245,197,24,0.1);
}
.radio-card-icon {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary); color: var(--text-secondary); font-size: 1.2rem; transition: all var(--transition-normal);
}
.radio-card input[type="radio"]:checked + .radio-card-content .radio-card-icon {
  background: var(--yellow); color: #000;
}
.radio-card-text { flex: 1; }
.radio-card-title { font-weight: 700; color: var(--text-primary); font-size: 1rem; margin-bottom: 2px; }
.radio-card-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.3; }

/* -- Number Stepper -- */
.number-stepper-wrapper { display: flex; align-items: center; background: var(--bg-input); border: 1px solid var(--border-primary); border-radius: var(--radius-md); overflow: hidden; height: var(--input-height, 48px); }
.number-stepper-wrapper:focus-within { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245,197,24,0.15); }
.number-stepper-btn {
  width: 48px; height: 100%; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; transition: all var(--transition-fast);
}
.number-stepper-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.number-stepper-wrapper input[type="number"] {
  flex: 1; min-width: 0; height: 100%; background: transparent; border: none; text-align: center; color: var(--text-primary); font-size: 1rem; font-weight: 600; padding: 0 8px; outline: none; -moz-appearance: textfield;
}
.number-stepper-wrapper input[type="number"]::-webkit-outer-spin-button, .number-stepper-wrapper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* -- Premium Upload Zone -- */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px;
  background: rgba(255,255,255,0.02); border: 2px dashed var(--border-primary); border-radius: var(--radius-lg);
  cursor: pointer; transition: all var(--transition-normal); text-align: center;
}
.upload-zone:hover, .upload-zone.drag-active {
  background: rgba(245,197,24,0.05); border-color: var(--yellow);
}
.upload-zone-icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 1.5rem; margin-bottom: 16px; box-shadow: var(--shadow-sm); transition: all var(--transition-normal);
}
.upload-zone:hover .upload-zone-icon, .upload-zone.drag-active .upload-zone-icon {
  background: var(--yellow); color: #000; transform: translateY(-4px); box-shadow: var(--shadow-yellow);
}
.upload-zone-text { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.upload-zone-hint { font-size: 0.8rem; color: var(--text-muted); }
.upload-preview {
  display: none; width: 100%; aspect-ratio: 1; max-width: 160px; margin: 0 auto;
  border-radius: var(--radius-md); overflow: hidden; position: relative;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-remove {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--transition-fast);
}
.upload-preview-remove:hover { background: var(--danger); }
.upload-zone.has-file .upload-zone-content { display: none; }
.upload-zone.has-file .upload-preview { display: block; }

/* -- Button Loading State -- */
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin-left: -10px; margin-top: -10px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
}
.btn-primary.btn-loading::after { border-color: rgba(0,0,0,0.2); border-top-color: #000; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -- Checkbox Toggle -- */
.checkbox-toggle { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.checkbox-toggle input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.toggle-slider {
  position: relative; width: 48px; height: 26px; background-color: var(--bg-card); border: 1.5px solid var(--border-light);
  border-radius: 26px; transition: .4s; margin-right: 12px;
}
.toggle-slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 2.5px;
  background-color: var(--text-muted); border-radius: 50%; transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
}
.checkbox-toggle input:checked + .toggle-slider { background-color: var(--yellow); border-color: var(--yellow); }
.checkbox-toggle input:checked + .toggle-slider:before { transform: translateX(22px); background-color: #000; }
.checkbox-toggle input:focus + .toggle-slider { box-shadow: 0 0 0 4px rgba(245,197,24,0.15); }
.toggle-label { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }

/* -- Formation Type Selector -- */
.formation-type-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}
.formation-toggle {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  min-height: 48px;
}
.formation-toggle:hover {
  border-color: var(--yellow-dark);
  color: var(--text-primary);
}
.formation-toggle.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

/* -- Invitation Code Styles -- */
.invite-code-text {
  font-family: var(--font-mono, monospace);
  font-size: 1.3rem;
  letter-spacing: 4px;
  color: var(--yellow);
  font-weight: 700;
}
.invite-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: 12px;
}
.invite-code-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.security-alert {
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

/* -- Formation Type Badges -- */
.badge-formation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 14px;
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-online {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
.badge-presentiel {
  background: rgba(57, 167, 81, 0.15);
  color: var(--green);
}

/* -- Notification Badge -- */
.notif-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  display: inline-block;
  min-width: 16px;
  text-align: center;
}

/* -- Camera & Format Hint -- */
.btn-camera {
  min-height: 48px;
  font-weight: 700;
}
.photo-format-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: #93C5FD;
}
.photo-format-hint .hint-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* -- Login Register Link -- */
.login-register-link {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* -- Drag Over on Upload Zone -- */
.upload-zone.drag-over {
  border-color: var(--yellow);
  background: rgba(245, 197, 24, 0.06);
  transform: scale(1.02);
}

/* --- Overrides for intl-tel-input (Dark Theme integration) --- */
.iti {
  display: block;
  width: 100%;
  --iti-hover-color: var(--bg-card-hover);
  --iti-border-color: var(--border-light);
  --iti-dialcode-color: var(--yellow);
  --iti-dropdown-bg: var(--bg-card);
  --iti-arrow-color: var(--text-secondary);
  --iti-text-color: var(--text-primary);
}

.iti__country-list {
  color: var(--text-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-primary);
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.iti__country {
  list-style: none !important;
}

.iti__search-input {
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.iti__search-input:focus {
  border-color: var(--yellow);
  outline: none;
}

.iti input[type="tel"] {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  width: 100%;
  height: var(--input-height);
  font-family: var(--font-primary);
  transition: all var(--transition-fast);
}

.iti input[type="tel"]:focus {
  border-color: var(--yellow);
  background: var(--bg-modal);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 0 0 4px rgba(245,197,24,0.15);
}

/* ════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   ════════════════════════════════════════════════ */
html.light-theme .badge-online { color: #7C3AED; background: rgba(124, 58, 237, 0.15); }
html.light-theme .badge-pending { color: #D97706; background: rgba(217, 119, 6, 0.15); }
html.light-theme .badge-enrolled { color: #2563EB; background: rgba(37, 99, 235, 0.15); }
html.light-theme .badge-training { color: #7C3AED; background: rgba(124, 58, 237, 0.15); }
html.light-theme .badge-evaluated { color: #EA580C; background: rgba(234, 88, 12, 0.15); }
html.light-theme .badge-certified { color: #16A34A; background: rgba(22, 163, 74, 0.15); }
html.light-theme .badge-standard { color: var(--yellow-dark); background: rgba(217, 119, 6, 0.15); }
html.light-theme .badge-pro, html.light-theme .badge-presentiel { color: var(--green-dark); background: rgba(21, 128, 61, 0.15); }
html.light-theme .security-alert {
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.3);
  color: #B45309;
}
html.light-theme .modal-overlay {
  background: rgba(255, 255, 255, 0.6);
}
html.light-theme .data-table th.sortable:hover {
  color: var(--yellow);
  background: var(--yellow-glow);
}
html.light-theme .btn-primary {
  background: linear-gradient(135deg, #F5C518, #E0A905) !important;
  color: #000000 !important;
  box-shadow: 0 4px 14px rgba(245, 197, 24, 0.25) !important;
}
html.light-theme .btn-primary:hover {
  background: linear-gradient(135deg, #FFD84D, #F5C518) !important;
  box-shadow: 0 6px 20px rgba(245, 197, 24, 0.4) !important;
  color: #000000 !important;
}
