/* CVGator — UI kit d'interaction (commun à toutes les pages)
 * ─────────────────────────────────────────────────────────────────────────────
 * Couche transverse, chargée APRÈS les styles de page. Elle ne redessine pas les
 * composants : elle garantit les états d'interaction communs (focus clavier,
 * cibles tactiles, sélection, désactivé, confirmation) et porte les composants
 * partagés (cartes de choix, lien-bouton, coût en crédits, modale de confirmation).
 * Charte : #00A78E (primaire) · #009880 (survol) · #293651 (texte) ;
 * #005C4C (= --md-on-primary-container) quand du vert doit être lu comme du texte.
 */

/* ── 1. Focus clavier visible, identique partout ───────────────────────────── */
html body :is(a, button, summary, [role="button"], [role="tab"], [role="radio"], [role="link"],
  [role="menuitem"], [role="option"], [tabindex]:not([tabindex="-1"]),
  input[type="checkbox"], input[type="radio"], input[type="range"]):focus-visible {
  outline: 2px solid #293651 !important;
  outline-offset: 2px !important;
}
html.dark body :is(a, button, summary, [role="button"], [role="tab"], [role="radio"], [role="link"],
  [role="menuitem"], [role="option"], [tabindex]:not([tabindex="-1"]),
  input[type="checkbox"], input[type="radio"], input[type="range"]):focus-visible {
  outline-color: #7DD3C4 !important;
}

/* ── 1 bis. Couches fermées : invisibles = hors de la tabulation ──────────────
 * Menu du compte, modales de nouveau-projet, croix « effacer » vides : fermés par
 * opacity:0, leurs boutons restaient atteignables au Tab (focus invisible).
 * visibility:hidden les retire de l'ordre clavier ; le fondu d'ouverture est conservé. */
.s-settings-menu { visibility: hidden; transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms; }
.s-profile-wrap.open .s-settings-menu { visibility: visible; transition-delay: 0s; }
.dialog-overlay:not(.open) { visibility: hidden; transition: opacity .25s, visibility 0s linear .25s; }
.dialog-overlay.open { visibility: visible; transition-delay: 0s; }
.sb-field:not(.has-value) .sb-clear { visibility: hidden; }

/* Cases à cocher masquées derrière une étiquette-puce : le focus clavier se voit sur la puce */
.contract-chip input:focus-visible + label { outline: 2px solid #293651; outline-offset: 2px; }

/* ── 2. Éléments rendus cliquables au clavier par ui-kit.js ────────────────── */
[data-cvg-kbd] { cursor: pointer; }
[data-cvg-kbd][aria-disabled="true"] { cursor: not-allowed; }

/* ── 3. Désactivé : compréhensible, jamais « mort » en silence ─────────────── */
html body button:disabled, html body [aria-disabled="true"] { cursor: not-allowed; }
.cvg-disabled-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; line-height: 1.4; color: #646F87;
}
.cvg-disabled-hint .material-icons-round { font-size: 16px !important; color: #646F87; }
html.dark .cvg-disabled-hint, html.dark .cvg-disabled-hint .material-icons-round { color: #9AA0A6; }

/* ── 4. Lien-bouton : action discrète présentée comme un lien ──────────────── */
.cvg-linkbtn {
  display: inline; padding: 2px 0; margin: 0; border: 0; background: none;
  font: inherit; color: #005C4C; font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  cursor: pointer; border-radius: 3px;
}
.cvg-linkbtn:hover { color: #00A78E; text-decoration-thickness: 2px; }
.cvg-linkbtn--muted { color: #475569; font-weight: 500; }
.cvg-linkbtn--muted:hover { color: #293651; }
html.dark .cvg-linkbtn { color: #7DD3C4; }
html.dark .cvg-linkbtn--muted { color: #C4C7C5; }

/* ── 5. Cartes de choix (modes alternatifs : import CV/offre, source lettre/pitch)
 *      Normal #F3FAF8/#B8DDD6 · survol #E5F6F2/#00A78E · sélection #00A78E + ✓ ── */
.import-choice {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: stretch;
  gap: 10px;
  margin-bottom: 16px;
}
.import-opt {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: 92px; padding: 14px 12px 12px;
  font-family: inherit; text-align: center; white-space: normal;
  color: #293651;
  background: #F3FAF8;
  border: 1.5px solid #B8DDD6;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color .18s, border-color .18s, color .18s, box-shadow .18s, transform .18s;
}
.import-opt .imp-ico { font-size: 24px !important; color: #00A78E; margin-bottom: 2px; transition: color .18s; }
.import-opt .imp-title { font-size: 13px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.import-opt .imp-desc { font-size: 11.5px; font-weight: 400; line-height: 1.35; color: #646F87; overflow-wrap: anywhere; transition: color .18s; }
.import-opt .imp-check {
  position: absolute; top: 7px; right: 7px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: #00A78E;
  font-size: 14px !important; font-weight: 700;
  opacity: 0; transform: scale(.6);
  transition: opacity .18s, transform .18s;
}
.import-opt:hover { background: #E5F6F2; border-color: #00A78E; box-shadow: 0 2px 8px rgba(0,167,142,.12); transform: translateY(-1px); }
.import-opt:active { transform: translateY(0); box-shadow: none; }
.import-opt.active,
.import-opt.active:hover { background: #00A78E; border-color: #00A78E; color: #fff; }
.import-opt.active:hover { background: #009880; border-color: #009880; }
.import-opt.active .imp-ico,
.import-opt.active .imp-desc { color: #fff; }
.import-opt.active .imp-desc { opacity: .92; }
.import-opt.active .imp-check { opacity: 1; transform: scale(1); }
.import-or {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
  color: #646F87;
}
.import-or::before, .import-or::after { content: ''; flex: 1; width: 1px; min-height: 12px; background: #D5E6E2; }
html.dark .import-opt { background: #1E2A28; border-color: #2F4A45; color: #E8EAED; }
html.dark .import-opt:hover { background: #22332F; border-color: #7DD3C4; }
html.dark .import-opt .imp-ico { color: #7DD3C4; }
html.dark .import-opt .imp-desc { color: #9AA0A6; }
html.dark .import-opt.active,
html.dark .import-opt.active:hover { background: #00A78E; border-color: #00A78E; color: #fff; }
html.dark .import-opt.active .imp-ico,
html.dark .import-opt.active .imp-desc { color: #fff; }
html.dark .import-or::before, html.dark .import-or::after { background: #3C4043; }
@media (prefers-reduced-motion: reduce) { .import-opt, .import-opt * { transition: none !important; } .import-opt:hover { transform: none; } }
/* Conteneur trop étroit pour 2 cartes côte à côte : empilement + « ──── OU ──── » */
:has(> .import-choice) { container-type: inline-size; }
@container (max-width: 359px) {
  .import-choice { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .import-opt { min-height: 0; flex-direction: row; justify-content: flex-start; flex-wrap: wrap; column-gap: 10px; text-align: left; padding: 12px 36px 12px 14px; }
  .import-opt .imp-ico { margin: 0; }
  .import-opt .imp-desc { flex-basis: 100%; padding-left: 34px; }
  .import-or { flex-direction: row; }
  .import-or::before, .import-or::after { width: auto; height: 1px; min-height: 0; }
}

/* ── 6. Coût en crédits annoncé sur les boutons d'action IA facturée ───────── */
.cvg-cost {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: rgba(255,255,255,.22); color: inherit;
}
.cvg-cost-note { font-size: 12px; color: #646F87; margin-top: 6px; }
html.dark .cvg-cost-note { color: #9AA0A6; }

/* ── 7. Modale de confirmation commune (CVGUI.confirm) ─────────────────────── */
.cvg-confirm-overlay {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15,23,42,.45);
}
.cvg-confirm {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  padding: 24px 24px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.2);
  font-family: inherit; color: #293651;
}
.cvg-confirm h2 { margin: 0 0 8px; font-size: 17px; font-weight: 700; line-height: 1.35; display: flex; gap: 10px; align-items: center; }
.cvg-confirm h2 .material-icons-round { font-size: 22px !important; color: #DC2626; }
.cvg-confirm p { margin: 0 0 6px; font-size: 14px; line-height: 1.55; color: #475569; }
.cvg-confirm .cvg-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cvg-confirm button {
  min-height: 40px; padding: 0 18px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cvg-confirm .cvg-confirm-cancel { background: #F3FAF8; border: 1.5px solid #B8DDD6; color: #293651; }
.cvg-confirm .cvg-confirm-cancel:hover { background: #E5F6F2; border-color: #00A78E; }
.cvg-confirm .cvg-confirm-ok { background: #00A78E; border: 1.5px solid #00A78E; color: #fff; }
.cvg-confirm .cvg-confirm-ok:hover { background: #009880; border-color: #009880; }
.cvg-confirm .cvg-confirm-ok.is-danger { background: #DC2626; border-color: #DC2626; }
.cvg-confirm .cvg-confirm-ok.is-danger:hover { background: #B91C1C; border-color: #B91C1C; }
html.dark .cvg-confirm { background: #1E1F20; color: #E3E3E3; }
html.dark .cvg-confirm p { color: #C4C7C5; }
html.dark .cvg-confirm .cvg-confirm-cancel { background: #2D2E2F; border-color: #3C4043; color: #E3E3E3; }
@media (max-width: 420px) { .cvg-confirm .cvg-confirm-actions button { flex: 1 1 100%; } }

/* ── 8. Sidebar applicative : profil = bouton de menu, contrôles plus grands ── */
/* Bloc profil = bouton du menu du compte (l'engrenage existant signale le menu) :
   survol + état ouvert visibles, sans chevron qui tronquerait le nom. */
.s-profile[data-cvg-kbd]:hover { background: #F3FAF8; }
.s-profile-wrap.open .s-profile[data-cvg-kbd] { background: #E5F6F2; box-shadow: inset 0 0 0 1.5px #B8DDD6; }
html.dark .s-profile[data-cvg-kbd]:hover { background: #22332F; }
html.dark .s-profile-wrap.open .s-profile[data-cvg-kbd] { background: #22332F; box-shadow: inset 0 0 0 1.5px #2F4A45; }
.sidebar-toggle { min-width: 32px !important; min-height: 32px !important; border-color: #B8DDD6 !important; }
.s-settings-btn { min-width: 32px; min-height: 32px; }

/* ── 9. Icônes d'aide « info » : petites à l'œil, confortables au doigt ───── */
.material-icons-round[data-cvg-kbd] { position: relative; border-radius: 50%; }
.material-icons-round[data-cvg-kbd]::before { content: ''; position: absolute; inset: -12px; }
.material-icons-round[data-cvg-kbd]:hover { color: #00A78E !important; }

/* ── 10. Cibles tactiles (écrans tactiles uniquement : desktop inchangé) ───── */
@media (pointer: coarse) {
  .hero-carousel-dot { position: relative; }
  .hero-carousel-dot::before { content: ''; position: absolute; inset: -12px -6px; }
  .lang-dd-opt { min-height: 44px; }
  .sidebar-toggle, .s-settings-btn { min-width: 40px !important; min-height: 40px !important; }
  .toolbar-btn { min-height: 36px; }
  .filter-btn, .view-btn { min-height: 40px; }
  .contrib-year-tab { min-height: 32px; }
  /* Boutons d'action et contrôles compacts : ≥ 40 px de haut au doigt */
  .btn-filled, .btn-outlined, .btn-tonal, .btn-back, .lang-dd-btn { min-height: 40px; }
  .theme-pill { min-height: 34px; }
  #dp-close { min-width: 40px; min-height: 40px; }
  .step-item[data-cvg-kbd] { min-height: 40px; }
  .cvg-linkbtn { padding: 6px 2px; }
  /* En-tête des pages guides (SEO) et liens légaux : zone de toucher ≥ 32 px */
  .topbar-links a { display: inline-block; padding-top: 6px; padding-bottom: 6px; }
  .auth-footer a, .ssm-legal a { display: inline-block; padding-top: 8px; padding-bottom: 8px; }
  #system-status { min-width: 32px; min-height: 32px; justify-content: center; }
  #credits-balance { display: inline-block; min-width: 32px; min-height: 24px; text-align: right; }
}

/* ── 10 bis. Sélecteurs segmentés : survol et état actif lisibles ───────────── */
.filter-btn:not(.active):hover, .view-btn:not(.active):hover { background: rgba(255,255,255,.65); color: #293651; }
.filter-btn.active, .view-btn.active { font-weight: 600; }

/* ── 10 ter. Liens dans le texte courant : vert lisible (BTN-011) ─────────────
 * #00A78E en texte fin sur blanc = 3,04:1 (< 4,5:1 WCAG AA). Pour les liens insérés
 * dans les paragraphes et listes, variante foncée du vert CVGator #007A68 (5,3:1),
 * soulignée. Boutons, navigation et footer ne sont pas concernés. */
:is(p, li) > a:not([class]):not(nav *):not(footer *) {
  color: #007A68; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}
:is(p, li) > a:not([class]):not(nav *):not(footer *):hover { text-decoration-thickness: 2px; }
html.dark :is(p, li) > a:not([class]):not(nav *):not(footer *) { color: #7DD3C4; }

/* ── 11. Footer mobile : liens espacés (desktop inchangé) ──────────────────── */
@media (max-width: 640px) {
  footer a:not([class]), .footer-links a:not([class]), .ssm-legal a {
    display: inline-block; padding-top: 8px; padding-bottom: 8px;
  }
  .footer-social a { width: 40px !important; height: 40px !important; }
}

