:root {
  color-scheme: light;
  --brand-primary: #0066CC;
  --brand-dark: #004999;
  --brand-light: #3385FF;
  --brand-accent: #00B8D4;
  --brand-success: #00C853;
  --brand-warning: #FFB300;
  --brand-danger: #E53935;
  
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;
  --border-dark: #94A3B8;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border-light: #334155;
    --border-medium: #475569;
    --border-dark: #64748B;
  }
}
* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 24px; 
}

.header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 16px; 
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

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

.brand .logo { 
  height: 48px; 
  width: auto; 
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand h1 { 
  margin: 0; 
  font-size: 26px; 
  font-weight: 700;
  letter-spacing: -0.5px; 
  color: var(--brand-primary);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.header nav a { 
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.header nav a:hover {
  background: var(--bg-tertiary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}
.camera-section { position: relative; aspect-ratio: 4/3; background: #111; border-radius: 12px; overflow: hidden; margin: 16px 0; }
.camera-section.small { max-width: 480px; }
video { width: 100%; height: 100%; object-fit: cover; }
.mirror { transform: scaleX(-1); }
.overlay { position: absolute; inset: 0; border: 4px solid rgba(0, 85, 166, 0.55); border-radius: 12px; pointer-events: none; }
.face-circle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(60vmin, 70%); height: min(60vmin, 70%); border: 4px dashed rgba(0, 85, 166, 0.6); border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0,0,0,0.1) inset; pointer-events: none; }
.controls { display: flex; align-items: center; gap: 12px; }
button { 
  position: relative;
  overflow: hidden;
  padding: 12px 24px; 
  border-radius: var(--radius-md); 
  border: none; 
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-light) 100%);
  color: white; 
  font-weight: 600;
  font-size: 15px;
  cursor: pointer; 
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.3px;
}

button:hover { 
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-primary) 100%);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

button:active { 
  transform: translateY(0px); 
  box-shadow: var(--shadow-sm);
}

button:disabled { 
  opacity: 0.5; 
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-sm);
}
.status { 
  margin-left: 8px; 
  margin-top: 8px;
  opacity: 0.95; 
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hidden { display: none; }
.card { 
  border: 1px solid var(--border-light); 
  padding: 28px; 
  border-radius: var(--radius-lg); 
  margin: 20px 0; 
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

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

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}

.card h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  border-radius: 2px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 12px; margin-bottom: 12px; }
label { 
  display: grid; 
  gap: 8px; 
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

input, select { 
  padding: 12px 16px; 
  border-radius: var(--radius-md); 
  border: 2px solid var(--border-light);
  width: 100%;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: all 0.2s ease;
  font-family: inherit;
}

input:hover, select:hover {
  border-color: var(--border-medium);
}

input::placeholder {
  color: var(--text-muted);
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-action { 
  padding: 10px 20px; 
  font-size: 14px; 
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-secondary { 
  background: linear-gradient(135deg, #64748B 0%, #475569 100%);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { 
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-danger { 
  background: linear-gradient(135deg, var(--brand-danger) 0%, #C62828 100%);
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover { 
  background: linear-gradient(135deg, #C62828 0%, #B71C1C 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-success { 
  background: linear-gradient(135deg, var(--brand-success) 0%, #00A346 100%);
  box-shadow: var(--shadow-sm);
}

.btn-success:hover { 
  background: linear-gradient(135deg, #00A346 0%, #00913E 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.table-wrap { 
  width: 100%; 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch; 
  border-radius: var(--radius-lg); 
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

table { 
  min-width: 720px; 
  width: 100%; 
  border-collapse: collapse;
}

th { 
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  position: sticky; 
  top: 0; 
  backdrop-filter: blur(8px);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--border-medium);
}

th, td { 
  padding: 14px 16px; 
  text-align: left;
}

td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 14px;
}
.footer { opacity: 0.8; font-size: 14px; }

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Mobile optimisations */
button { touch-action: manipulation; }
* { -webkit-tap-highlight-color: transparent; }

@supports (padding: max(0px)) {
  .container {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

@media (max-width: 640px) {
  .container { 
    max-width: none; 
    padding: 16px; 
  }
  
  .header { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 12px;
    padding: 16px;
  }
  
  .brand .logo { 
    height: 36px; 
  }
  
  .brand h1 { 
    font-size: 20px; 
  }
  
  .camera-section { 
    height: 62vh; 
    aspect-ratio: auto; 
  }
  
  .camera-section.small { 
    max-width: none; 
    width: 100%; 
  }
  
  .controls { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 10px; 
  }
  
  button { 
    width: 100%; 
    padding: 14px 20px; 
    font-size: 16px; 
  }
  
  .status { 
    font-size: 14px; 
  }
  
  .face-circle { 
    width: 70%; 
    height: 70%; 
  }
  
  table { 
    min-width: 600px; 
  }
  
  th, td { 
    padding: 10px 12px; 
    font-size: 13px;
  }
  
  /* Masquer la table des chantiers sur mobile - affichage readonly uniquement */
  #tblChantiers { 
    display: none; 
  }
  
  /* Ajustement de la grille des filtres de pointage */
  .grid[style*="grid-template-columns: 1fr 1fr 1fr auto"] {
    grid-template-columns: 1fr !important;
  }
  
  .card {
    padding: 16px;
    margin: 12px 0;
  }
  
  .card h2 {
    font-size: 18px;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .camera-section { height: 72vh; aspect-ratio: auto; }
  .brand h1 { font-size: 16px; }
}

/* Overlay de succès dans la zone caméra */
.success-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0, 61, 125, 0.92); color: #fff; z-index: 3; padding: 24px; border-radius: 12px; }
.success-overlay.show { display: flex; }
.success-card { text-align: center; max-width: 820px; }
.success-card h2 { margin: 0 0 12px; font-size: clamp(28px, 5vmin, 48px); letter-spacing: 0.4px; }
.success-card p { margin: 6px 0; font-size: clamp(18px, 3vmin, 24px); opacity: 0.95; }
.success-card .name { font-weight: 800; font-size: clamp(28px, 6vmin, 56px); letter-spacing: 0.6px; }
.success-card .meta { opacity: 0.9; font-weight: 600; }

/* Petit spinner pour états de chargement */
.spinner { 
  display: inline-block; 
  width: 16px; 
  height: 16px; 
  border: 3px solid var(--border-light); 
  border-top-color: var(--brand-primary); 
  border-radius: 50%; 
  vertical-align: -3px; 
  animation: spin 0.6s linear infinite; 
}

@keyframes spin { 
  to { 
    transform: rotate(360deg); 
  } 
}
/* Toasts */
.toast-container { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; display: grid; gap: 8px; z-index: 1000; width: min(92%, 560px); }
.toast { background: #0b1f33; color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.22); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.toast.success { background: #1d7f4e; }
.toast.error { background: #b83030; }
.toast .msg { flex: 1; }
.toast .close { background: transparent; border: 0; color: #fff; font-weight: 700; cursor: pointer; }

/* Cartes employés (mobile) */
.badge { 
  display: inline-block; 
  padding: 5px 12px; 
  border-radius: 999px; 
  font-size: 12px; 
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.badge:hover {
  transform: scale(1.05);
}

.badge.success { 
  background: linear-gradient(135deg, var(--brand-success) 0%, #00A346 100%);
  color: white;
}

.badge.danger { 
  background: linear-gradient(135deg, var(--brand-danger) 0%, #C62828 100%);
  color: white;
}
.emp-cards { 
  display: none; 
  grid-template-columns: 1fr; 
  gap: 12px; 
}

.emp-card { 
  border: 1px solid var(--border-light); 
  border-radius: var(--radius-lg); 
  padding: 16px; 
  background: var(--bg-secondary); 
  display: grid; 
  gap: 12px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.emp-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-medium);
}

.emp-card .title { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  font-weight: 800;
  color: var(--text-primary);
  font-size: 16px;
}

.emp-card .subtitle { 
  color: var(--text-muted); 
  font-size: 12px; 
  margin-left: 6px; 
  font-weight: 600;
  letter-spacing: 0.5px;
}

.emp-card .row { 
  display: grid; 
  gap: 8px;
  color: var(--text-secondary);
}

.emp-card .actions { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 8px; 
  margin-top: 4px; 
}
.btn-action { padding: 12px 10px; font-size: 14px; border-radius: 10px; }
.btn-secondary { background: #6b7a8a; }
.btn-secondary:hover { background: #566372; }
.btn-danger { background: #cf3b3b; }
.btn-danger:hover { background: #b83030; }
.btn-success { background: #2e8b57; }
.btn-success:hover { background: #257047; }

/* Appliquer le style d'actions mobile aussi au tableau desktop */
.emp-table .btnToggle, .emp-table .btnSave, .emp-table .btnDel {
  padding: 12px 10px;
  font-size: 14px;
  border-radius: 10px;
}
.emp-table .btnToggle { background: #6b7a8a; }
.emp-table .btnSave { background: #2e8b57; }
.emp-table .btnDel { background: #cf3b3b; }
.emp-table .btnToggle:hover { background: #566372; }
.emp-table .btnSave:hover { background: #257047; }
.emp-table .btnDel:hover { background: #b83030; }

@media (max-width: 640px) {
  /* Afficher cartes mobile, masquer table */
  .emp-cards { display: grid; }
  .table-wrap { display: none; }
}

/* Overlay d'erreur (périmètre chantier / localisation) */
.error-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(184, 48, 48, 0.92); color: #fff; z-index: 4; padding: 24px; border-radius: 12px; }
.error-overlay.show { display: flex; }
.error-card { text-align: center; max-width: 820px; }
.error-card h2 { margin: 0 0 12px; font-size: clamp(26px, 5vmin, 44px); letter-spacing: 0.3px; }
.error-card p { margin: 6px 0; font-size: clamp(16px, 3vmin, 22px); opacity: 0.95; }

/* Statistiques - Cartes */
.stats-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
  gap: 12px; 
  margin-top: 12px;
}

.stat-card {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.4s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.stat-value {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  animation: numberPop 0.5s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

/* Animations pour l'UX */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes numberPop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Amélioration des cartes */
.card {
  animation: fadeInUp 0.4s ease;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0, 85, 166, 0.08);
}

/* Amélioration des inputs et selects */
input:focus, select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
  background: var(--bg-secondary);
}

/* Effet de ripple visuel pour les boutons */
button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
  z-index: 0;
}

button:active::before {
  width: 300px;
  height: 300px;
}

button > * {
  position: relative;
  z-index: 1;
}

/* Amélioration des lignes de tableau */
tbody tr {
  animation: slideIn 0.3s ease;
  transition: all 0.2s ease;
}

tbody tr:hover {
  background-color: var(--bg-tertiary);
  transform: scale(1.01);
}

tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.01);
}

/* Status avec animations */
.status {
  transition: color 0.3s ease;
}

.status .spinner {
  animation: spin 0.8s linear infinite;
}

/* Amélioration responsive des statistiques */
@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-value {
    font-size: 28px;
  }
  
  .stat-label {
    font-size: 12px;
  }
}

/* Tableau d'historique de pointage */
#tblPointagesAdmin td:nth-child(5),
#tblPointagesAdmin td:nth-child(6),
#tblPointagesAdmin td:nth-child(7),
#tblPointagesAdmin td:nth-child(8) {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  text-align: center;
}

#tblPointagesAdmin td:nth-child(9) {
  background-color: rgba(46, 139, 87, 0.08);
  font-weight: 700;
  color: #2e8b57;
  text-align: center;
  font-size: 15px;
}

#tblPointagesAdmin th:nth-child(9) {
  background-color: rgba(46, 139, 87, 0.12);
  color: #1d7f4e;
}

/* Améliorer l'affichage du tableau opérateur */
#tblPointages td {
  font-size: 14px;
}

#tblPointages td:nth-child(5),
#tblPointages td:nth-child(6),
#tblPointages td:nth-child(7),
#tblPointages td:nth-child(8) {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  text-align: center;
}

#tblPointages td:nth-child(9) {
  background-color: rgba(46, 139, 87, 0.08);
  font-weight: 700;
  color: #2e8b57;
  text-align: center;
  font-size: 15px;
}

#tblPointages th:nth-child(9) {
  background-color: rgba(46, 139, 87, 0.12);
  color: #1d7f4e;
}

/* Effet de highlight sur les lignes importantes */
tbody tr:has(strong) {
  background-color: rgba(0, 85, 166, 0.02);
}

/* Navigation par onglets - Design Premium */
.tabs-nav {
  display: flex;
  gap: 12px;
  margin: 24px 0 20px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.tabs-nav::-webkit-scrollbar {
  height: 6px;
}

.tabs-nav::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.tabs-nav::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.tabs-nav::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

.tab-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
}

/* Effet de brillance au hover */
.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.tab-btn:hover::before {
  left: 100%;
}

.tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--brand-primary);
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-light) 100%);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}


/* Animation de pulse pour l'onglet actif */
@keyframes tabPulse {
  0%, 100% {
    box-shadow: var(--shadow-lg);
  }
  50% {
    box-shadow: var(--shadow-xl);
  }
}

.tab-btn.active {
  animation: tabPulse 2s ease-in-out infinite;
}

/* Icônes et labels des onglets */
.tab-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.tab-label {
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

.tab-btn:hover .tab-icon {
  transform: scale(1.15) rotate(5deg);
}

.tab-btn.active .tab-icon {
  transform: scale(1.2);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.tab-btn.active .tab-label {
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Compteur de badge optionnel */
.tab-btn[data-count]::before {
  content: attr(data-count);
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, var(--brand-danger) 0%, #C62828 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.5);
  z-index: 2;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Indicateur de progression sous les onglets */
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  transition: width 0.3s ease;
  border-radius: 2px;
}

.tab-btn:hover::after {
  width: 100%;
}

.tab-btn.active::after {
  width: 100% !important;
  background: white;
  height: 4px;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
  bottom: -2px;
  left: 0;
  transform: none;
}

.tab-content {
  display: none;
  animation: fadeInTab 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Responsive Tablette (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .tabs-nav {
    gap: 10px;
    padding: 6px;
    margin: 20px 0 16px;
  }
  
  .tab-btn {
    padding: 12px 18px;
    gap: 8px;
  }
  
  .tab-icon {
    font-size: 18px;
  }
  
  .tab-label {
    font-size: 13px;
  }
  
  .container {
    max-width: 95%;
    padding: 20px;
  }
  
  .header {
    padding: 18px 20px;
  }
  
  .card {
    padding: 24px;
  }
}

/* Responsive Mobile (< 640px) */
@media (max-width: 640px) {
  .btnChChangePwd {
    display: none !important;
  }
  
  .tabs-nav {
    gap: 6px;
    padding: 6px;
    margin: 16px 0 12px;
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
  }
  
  .tab-btn {
    flex-direction: column;
    padding: 12px 10px;
    gap: 6px;
    min-width: 75px;
    text-align: center;
    border-radius: var(--radius-sm);
  }
  
  .tab-icon {
    font-size: 24px;
  }
  
  .tab-label {
    font-size: 11px;
    line-height: 1.2;
  }
  
  .tab-btn.active::after {
    bottom: 0;
    width: 100% !important;
    height: 3px;
  }
  
  .tab-btn[data-count]::before {
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 2px 5px;
    min-width: 16px;
  }
  
  .tab-btn:hover .tab-icon {
    transform: scale(1.1);
  }
  
  .tab-btn.active .tab-icon {
    transform: scale(1.15);
  }
  
  .stat-value {
    font-size: 32px;
  }
  
  .stat-card {
    padding: 20px;
  }
}

/* Responsive Très petit mobile (< 380px) */
@media (max-width: 380px) {
  .tab-btn {
    padding: 10px 8px;
    min-width: 68px;
  }
  
  .tab-icon {
    font-size: 22px;
  }
  
  .tab-label {
    font-size: 10px;
  }
  
  .tabs-nav {
    gap: 4px;
    padding: 4px;
  }
}

/* Mode paysage mobile */
@media (max-width: 900px) and (orientation: landscape) {
  .tabs-nav {
    gap: 8px;
    padding: 4px;
    margin: 12px 0 10px;
  }
  
  .tab-btn {
    flex-direction: row;
    padding: 8px 16px;
    min-width: auto;
  }
  
  .tab-icon {
    font-size: 18px;
  }
  
  .tab-label {
    font-size: 12px;
  }
}

