/* =====================================================================
   COMPOSANTS UI
   Boutons, cartes glassmorphism, champs, badges, barres de competences.
   Design ultra-moderne Pro Dark avec micro-animations fluides.
   ===================================================================== */

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.75rem 1.75rem;
  background: var(--gradient);
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: all var(--dur-base) var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: var(--gradient-hover);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary, .btn-outline {
  /* Fond teinte de l'accent (jamais de gris neutre) : au repos comme au
     survol, le bouton porte la couleur du theme choisi. */
  background: var(--primary-soft);
  border: 1.5px solid var(--primary-line);
  color: var(--text-100);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover, .btn-outline:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--text-100);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-200);
  border: 1px solid transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text-100);
  border-color: var(--border);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--danger-soft);
}

.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0.375rem 1rem;
  font-size: var(--fs-xs);
}

.btn-block {
  width: 100%;
}

.btn-link {
  min-height: auto;
  padding: 0;
  background: none;
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
  box-shadow: none;
}

/* ---------- Cartes Glassmorphism ---------- */

.card, .card-ultimate {
  background: var(--bg-card);
  /* PAS de backdrop-filter ici : ~30 cartes floutees, recalculees a
     chaque image du defilement, c'etait le reste du scroll lent (meme
     mecanisme que le header). Le fond est deja opaque a 85-95 % : le
     flou etait invisible a l'oeil, mais paye plein pot. */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: all 0.35s var(--ease-spring);
  display: flex;
  flex-direction: column;
}

.card-hover:hover, .card-ultimate:hover {
  transform: translateY(-7px);
  border-color: var(--border-glow);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 25px var(--primary-soft);
}

.card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-100);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--primary);
  font-size: 1.1em;
}

.card-subtitle {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: var(--sp-2);
  font-weight: 700;
  display: block;
}

.card-text, .card-desc {
  color: var(--text-200);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

/* Boite d'icone eclatante */
.icon-box-glow {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--surface), var(--bg-card));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.35s var(--ease-spring);
  flex-shrink: 0;
}

.card:hover .icon-box-glow, .card-ultimate:hover .icon-box-glow {
  background: var(--gradient);
  color: #ffffff;
  transform: rotate(-5deg) scale(1.1);
  box-shadow: 0 10px 25px var(--primary-glow);
  border-color: transparent;
}

/* Carte avec accent lateral */
.card-border-left {
  border-left: 4px solid var(--secondary);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid var(--border-strong);
  color: var(--text-200);
  background: var(--surface);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  width: fit-content;
}

.badge-accent {
  color: #c4b5fd;
  border-color: var(--primary-line);
  background: var(--primary-soft);
}

.badge-tech {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.15);
}

.badge-ok     { color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); background: var(--ok-soft); }
.badge-warn   { color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); background: var(--warn-soft); }
.badge-danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35);  background: var(--danger-soft); }
.badge-info   { color: #93c5fd; border-color: rgba(59, 130, 246, 0.35); background: var(--info-soft); }

/* ---------- Barre de niveau (competences) ---------- */

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.meter-head span:first-child {
  color: var(--text-100);
}

.meter-head .meter-percent {
  color: var(--primary);
  font-weight: 700;
}

.meter, .progress-container {
  height: 8px;
  background: rgba(11, 17, 32, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.meter-fill, .progress-fill {
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: width var(--dur-slow) var(--ease-in);
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill, .progress-fill { transition: none; }
}

/* ---------- Champs de formulaire ---------- */

.field { margin-bottom: var(--sp-4); }

.field.has-error .input,
.field.has-error .textarea {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--fs-xs);
  color: #f87171;
  font-weight: 500;
}

.label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-100);
}

.input, .textarea, .select {
  width: 100%;
  font-size: max(16px, var(--fs-base));
  font-family: inherit;
  color: var(--text-100);
  background: rgba(11, 17, 32, 0.65);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  min-height: 2.875rem;
  transition: all var(--dur-fast) var(--ease-std);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-300);
}

.select {
  /* Le menu deroulant s'ouvre vers le BAS. Certains navigateurs
     (anciens Chromium) l'ouvraient vers le haut quand la liste etait
     proche du bas de la fenetre : direction: ltr + l'alignement forcent
     le sens attendu sans toucher au rendu. */
  direction: ltr;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Fleche discrete dessinee en CSS (aucune image, aucun style inline). */
  background-image: linear-gradient(45deg, transparent 50%, var(--text-300) 50%),
                    linear-gradient(135deg, var(--text-300) 50%, transparent 50%);
  background-position: right 1.15rem center, right 0.8rem center;
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
}

.select:focus {
  background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%),
                    linear-gradient(135deg, var(--primary) 50%, transparent 50%);
}

.input:hover, .textarea:hover, .select:hover {
  border-color: var(--primary-line);
  background: rgba(11, 17, 32, 0.85);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(11, 17, 32, 0.95);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: var(--lh-body);
}

/* Champ piege antispam invisible */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Messages et Alertes ---------- */

.notice {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
  backdrop-filter: blur(8px);
}

.notice-success { border-color: var(--ok);     background: var(--ok-soft);     color: #a7f3d0; }
.notice-error   { border-color: var(--danger); background: var(--danger-soft); color: #fecaca; }
.notice-warning { border-color: var(--warn);   background: var(--warn-soft);   color: #fde68a; }
.notice-info    { border-color: var(--info);   background: var(--info-soft);   color: #bfdbfe; }

/* ---------- Tableaux ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 34rem;
}

.table th, .table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  color: var(--text-200);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: var(--surface);
}

.table tbody tr:hover {
  background: var(--surface);
}

/* Utilitaires */
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-tight { gap: var(--sp-3); }
.muted { color: var(--text-300); font-size: var(--fs-xs); }