/*
 * AGS v4 — Composants visuels accessibles (WCAG 2.1)
 * Cf. AGS_implementation_plan_v3.md §16.20.
 *
 * Pattern + couleur + icône + texte = 3 vecteurs distincts par tier
 * → daltonisme safe (deutéranopie / protanopie / tritanopie).
 * Contraste vérifié ≥ 4.5:1 sur tous les badges.
 */

.grc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1.5px solid transparent;
    /* Default — sera surchargé par le tier */
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Pass 8 fix : focus indicator WCAG 2.1 §2.4.7 (visible focus) */
.grc-badge:focus,
.grc-badge:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.grc-badge i {
    font-size: 1em;
}

.grc-badge__label {
    font-weight: 600;
}

.grc-badge__value {
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
    margin-left: 0.2rem;
}

/* Tier 1 : Haute fiabilité (GRC ≥ 0.85) — vert solide */
.grc-badge--high {
    background-color: #10b981;
    color: #ffffff;
    border-color: #047857;
}

/* Tier 2 : Fiable (0.70 ≤ GRC < 0.85) — jaune avec pattern rayé */
.grc-badge--medium {
    background-color: #fbbf24;
    color: #1f2937;                                       /* contraste 5.5:1 */
    border-color: #b45309;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0) 6px,
        rgba(255, 255, 255, 0.25) 6px,
        rgba(255, 255, 255, 0.25) 9px
    );
}

/* Tier 3 : Moyenne (0.55 ≤ GRC < 0.70) — orange foncé avec pattern pointillé.
   Pass 8 fix : background-color #fb923c (orange clair) → #c2410c (orange foncé)
   pour passer WCAG AA 4.5:1 avec text blanc (était 2.9:1 avec text gris foncé). */
.grc-badge--low {
    background-color: #c2410c;
    color: #ffffff;
    border-color: #7c2d12;
    background-image: radial-gradient(
        rgba(255, 255, 255, 0.20) 1.5px,
        transparent 2px
    );
    background-size: 7px 7px;
}

/* Tier 4 : Instable (GRC < 0.55) — rouge avec pattern hachuré + animation subtile */
.grc-badge--critical {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #7f1d1d;
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0) 4px,
        rgba(255, 255, 255, 0.3) 4px,
        rgba(255, 255, 255, 0.3) 5px
    );
    animation: grc-badge-blink 4s ease-in-out infinite;
}

@keyframes grc-badge-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Respect des préférences utilisateur — pas d'animation si reduce-motion */
@media (prefers-reduced-motion: reduce) {
    .grc-badge--critical {
        animation: none;
    }
}

/*
 * AGS Evolution chart — bandes CI 95% (§13.4)
 */
.ags-evolution-chart {
    position: relative;
    margin-bottom: 1.5rem;
}

.ags-evolution-toggle {
    display: inline-flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ags-evolution-toggle button {
    padding: 0.3rem 0.8rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.ags-evolution-toggle button.active {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4338ca;
}

/* Annotations verticales (changement calibration / pool juges) */
.ags-evolution-annotation {
    font-size: 0.75rem;
    font-weight: 600;
}

.ags-evolution-annotation--judge-change {
    color: #dc2626;
}

.ags-evolution-annotation--recalibration {
    color: #7c3aed;
}

/* Bandeau cache élevé. Pass 8 fix : color #92400e → #78350f pour passer WCAG AA. */
.ags-cache-high-warning {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #f59e0b;
    border-radius: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
}
