/* ============================================================
   Comparateur aliments — préfixe .fl- pour éviter tout conflit
   avec EasyAdmin et les autres pages custom
   ============================================================ */

.fl-wrap {
    --fl-brand: #6366f1;
    --fl-brand-d: #4f46e5;
    --fl-brand-soft: #eef0fe;
    --fl-ink: #23263a;
    --fl-mut: #6b7080;
    --fl-line: #e6e7f1;
    --fl-card: #fff;

    font-family: 'Public Sans', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--fl-ink);
    box-sizing: border-box;
}

.fl-wrap *, .fl-wrap *::before, .fl-wrap *::after {
    box-sizing: border-box;
}

.fl-head {
    margin-bottom: 20px;
}
.fl-head h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.025em;
}
.fl-head p {
    margin: 6px 0 0;
    color: var(--fl-mut);
    font-size: 14px;
}

.fl-form {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    max-width: 520px;
}
.fl-form input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--fl-line);
    border-radius: 10px;
    font-size: 14px;
}
.fl-form input[type="text"]:focus {
    outline: none;
    border-color: var(--fl-brand);
}
.fl-form button {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: var(--fl-brand);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s ease;
}
.fl-form button:hover {
    background: var(--fl-brand-d);
}

.fl-sources {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.fl-source {
    min-width: 0;
    background: var(--fl-card);
    border: 1px solid var(--fl-line);
    border-radius: 16px;
    padding: 20px;
}
.fl-source h2 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fl-source h2 i {
    color: var(--fl-brand-d);
}

.fl-empty {
    margin: 0;
    color: var(--fl-mut);
    font-size: 13px;
}

.fl-table-wrap {
    overflow-x: auto;
}

.fl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.fl-table th, .fl-table td {
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--fl-line);
}
.fl-table th:first-child, .fl-table td:first-child {
    text-align: left;
    white-space: normal;
}
.fl-refqty {
    color: var(--fl-mut);
    font-size: 12px;
    font-weight: 600;
}
.fl-table th {
    color: var(--fl-mut);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.fl-label {
    display: block;
    font-weight: 600;
}
.fl-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.fl-ref {
    display: inline-flex;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--fl-brand-soft);
    color: var(--fl-brand-d);
    font-size: 11px;
    white-space: nowrap;
}
.fl-ref strong {
    font-weight: 700;
}

.fl-meta {
    display: block;
    color: var(--fl-mut);
    font-size: 12px;
}

/* ════ Fiche produit (résultat d'un scan code-barres) ════ */
.fl-product-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--fl-card);
    border: 1px solid var(--fl-line);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.fl-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.fl-product-media {
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--fl-brand-soft);
}
.fl-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fl-product-media-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--fl-mut);
    font-size: 28px;
}
.fl-product-media-empty span {
    font-size: 12px;
    font-weight: 600;
}
.fl-product-body {
    flex: 1;
    min-width: 220px;
}
.fl-hero-cat {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--fl-brand-d);
}
.fl-product-body h2 {
    margin: 4px 0 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.02em;
}
.fl-hero-sub {
    margin-top: 2px;
    color: var(--fl-mut);
    font-size: 13.5px;
    font-weight: 600;
}
.fl-hero-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.fl-hero-score {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-left: 24px;
    border-left: 1px solid var(--fl-line);
    text-align: center;
    max-width: 200px;
}
.fl-score-lbl {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--fl-mut);
}
.fl-score-verdict {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}
.fl-score-hint {
    font-size: 12px;
    color: var(--fl-mut);
    font-weight: 600;
}

.fl-ns {
    display: inline-flex;
    gap: 4px;
}
.fl-ns-c {
    width: 30px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    background: #eef0f4;
    color: #b5bac7;
}
.fl-ns-c.on {
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.fl-ns-c--a.on { background: #038141; }
.fl-ns-c--b.on { background: #85bb2f; }
.fl-ns-c--c.on { background: #fecb02; color: #23263a; }
.fl-ns-c--d.on { background: #ee8100; }
.fl-ns-c--e.on { background: #e63e11; }

.fl-product-section {
    margin-top: 16px;
}
.fl-product-section h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--fl-mut);
}
.fl-product-section p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
}
.fl-chip {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f3f3fa;
    color: var(--fl-ink);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.fl-chip--tag {
    background: var(--fl-brand-soft);
    color: var(--fl-brand-d);
    font-family: ui-monospace, monospace;
    font-weight: 500;
}

/* Onglets Synthèse diététique / Valeurs détaillées */
.fl-seg {
    display: inline-flex;
    background: #eaebf3;
    border-radius: 12px;
    padding: 4px;
    gap: 3px;
}
.fl-seg > button {
    height: 38px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--fl-mut);
    cursor: pointer;
}
.fl-seg > button.on {
    background: #fff;
    color: var(--fl-brand-d);
    box-shadow: 0 1px 3px rgba(30, 30, 80, .12);
}

.fl-tab-panel[hidden] { display: none; }

.fl-synth-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
    align-items: start;
}
.fl-synth-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fl-card {
    background: var(--fl-card);
    border: 1px solid var(--fl-line);
    border-radius: 14px;
    padding: 16px 18px;
}
.fl-card-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--fl-mut);
    margin-bottom: 14px;
}
.fl-card-hd i { color: var(--fl-brand-d); }

.fl-flag-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fl-flag {
    display: flex;
    gap: 12px;
}
.fl-flag-ic {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 15px;
}
.fl-flag--high .fl-flag-ic { background: #fdece7; color: #e63e11; }
.fl-flag--mid .fl-flag-ic { background: #fef3e2; color: #f08a1d; }
.fl-flag--ok .fl-flag-ic { background: #e6f4ec; color: #178042; }
.fl-flag-bd { flex: 1; min-width: 0; }
.fl-flag-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.fl-flag-top strong { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.fl-flag-badge {
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.fl-flag--high .fl-flag-badge { background: #fdece7; color: #e63e11; }
.fl-flag--mid .fl-flag-badge { background: #fef3e2; color: #f08a1d; }
.fl-flag--ok .fl-flag-badge { background: #e6f4ec; color: #178042; }
.fl-flag-val {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--fl-mut);
    margin-top: 2px;
}
.fl-flag-note {
    font-size: 12.5px;
    color: var(--fl-mut);
    line-height: 1.45;
    margin-top: 2px;
}

.fl-level-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.fl-level-t {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.fl-level-t strong { font-weight: 800; }
.fl-level-t--high { color: #e63e11; }
.fl-level-t--mid { color: #f08a1d; }
.fl-level-t--ok { color: #178042; }
.fl-level-tr {
    position: relative;
    height: 10px;
    border-radius: 99px;
    background: #eef0f4;
}
.fl-level-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 99px;
}
.fl-level-fill--high { background: #e63e11; }
.fl-level-fill--mid { background: #f08a1d; }
.fl-level-fill--ok { background: #178042; }
.fl-level-mark {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 16px;
    background: rgba(0, 0, 0, .12);
    border-radius: 2px;
}

.fl-advice {
    display: flex;
    gap: 12px;
    background: linear-gradient(135deg, var(--fl-brand-soft), #f4edff);
    border-color: #e2e0fb;
}
.fl-advice-ic {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--fl-brand), var(--fl-brand-d));
    color: #fff;
    display: grid;
    place-items: center;
}
.fl-advice strong { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.fl-advice p { margin: 5px 0 0; font-size: 13px; line-height: 1.55; color: #3a3d55; }

.fl-nutri-table { display: flex; flex-direction: column; }
.fl-nutri-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 2px;
    border-bottom: 1px solid var(--fl-line);
    font-size: 13.5px;
}
.fl-nutri-row span:first-child { font-weight: 700; }
.fl-nutri-row span:last-child { font-weight: 600; color: var(--fl-mut); font-variant-numeric: tabular-nums; }
.fl-nutri-row.sub span:first-child { padding-left: 14px; font-weight: 600; color: var(--fl-mut); }
.fl-nutri-row:last-child { border-bottom: 0; }

/* ════ Boutons photo + bandeau d'avertissement ════ */
.fl-photo-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.fl-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--fl-line);
    border-radius: 10px;
    background: var(--fl-card);
    color: var(--fl-ink);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.fl-photo-btn i {
    color: var(--fl-brand-d);
}
.fl-photo-btn:hover {
    border-color: var(--fl-brand);
    background: var(--fl-brand-soft);
}

.fl-notice {
    margin: 0 0 20px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fdecea;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
}

/* ════ Historique "Mes produits récents" ════ */
.fl-history {
    margin-bottom: 28px;
}
.fl-history h2 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--fl-mut);
    display: flex;
    align-items: center;
    gap: 8px;
}
.fl-history h2 i {
    color: var(--fl-brand-d);
}
.fl-history-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.fl-history-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--fl-line);
    border-radius: 999px;
    background: var(--fl-card);
    color: var(--fl-ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color .15s ease, background .15s ease;
}
.fl-history-item:hover {
    border-color: var(--fl-brand);
    background: var(--fl-brand-soft);
}
.fl-history-ic {
    color: var(--fl-brand-d);
    font-size: 13px;
}
.fl-history-date {
    color: var(--fl-mut);
    font-size: 11.5px;
    font-weight: 600;
}

/* ════ Modale photo (aliment / code-barres) ════ */
.fl-scrim {
    position: fixed; inset: 0; z-index: 1000; background: rgba(20, 22, 45, .5); backdrop-filter: blur(3px);
    display: grid; place-items: start center; padding: 70px 24px 24px;
}
.fl-scrim[hidden] { display: none; }

.fl-modal {
    width: 100%; max-width: 480px; background: #fff; border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 70px rgba(30, 25, 80, .32); color: var(--fl-ink); font-family: 'Public Sans', ui-sans-serif, system-ui, sans-serif;
}
.fl-modal-hd {
    display: flex; align-items: center; gap: 11px; padding: 18px 20px; border-bottom: 1px solid var(--fl-line);
}
.fl-modal-hd h3 {
    margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px;
}
.fl-modal-hd h3 i { color: var(--fl-brand-d); }
.fl-modal-x {
    margin-left: auto; width: 32px; height: 32px; border: 1px solid var(--fl-line); background: #fff; border-radius: 8px;
    color: var(--fl-mut); cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.fl-modal-body { padding: 20px; }

.fl-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    text-align: center; height: 190px; border: 2px dashed var(--fl-line); border-radius: 16px; cursor: pointer;
    color: var(--fl-mut); overflow: hidden; transition: all .12s;
}
.fl-drop:hover { border-color: var(--fl-brand); background: var(--fl-brand-soft); }
.fl-drop-icon {
    width: 52px; height: 52px; border-radius: 16px; background: var(--fl-brand-soft); color: var(--fl-brand-d);
    display: grid; place-items: center; font-size: 20px;
}
.fl-drop b { font-size: 15px; color: var(--fl-ink); }
.fl-drop span { font-size: 12.5px; }

.fl-manual-link {
    display: block; margin: 14px auto 0; background: none; border: none; color: var(--fl-brand-d);
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline;
}

.fl-preview {
    position: relative; height: 190px; border-radius: 16px; overflow: hidden; display: grid; place-items: center;
    color: #fff; background: linear-gradient(135deg, #818cf8, #7c3aed);
}
.fl-preview--sm { height: 110px; }
.fl-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fl-scan {
    position: absolute; inset: 0; background: linear-gradient(transparent, rgba(99, 102, 241, .28));
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 13.5px; font-weight: 700;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.fl-spin {
    width: 28px; height: 28px; border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%;
    animation: fl-spin .7s linear infinite;
}
@keyframes fl-spin { to { transform: rotate(360deg); } }

.fl-modal-error {
    margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #fdecea; color: #b91c1c; font-size: 13px; font-weight: 600;
}
.fl-modal-result {
    margin: 14px 0 0; font-size: 17px; font-weight: 800;
}
.fl-modal-conf {
    font-size: 12.5px; font-weight: 600; color: var(--fl-mut);
}
.fl-manual-input {
    width: 100%; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--fl-line); border-radius: 10px; font-size: 15px;
}
.fl-manual-input:focus { outline: none; border-color: var(--fl-brand); }

.fl-modal-ft {
    display: flex; gap: 10px; padding: 0 20px 20px;
}
.fl-modal-ft button {
    flex: 1; height: 46px; border-radius: 12px; font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; border: 0;
}
.fl-btn-secondary { background: #f3f3fa; color: var(--fl-mut); }
.fl-btn-primary { background: var(--fl-brand); color: #fff; }
.fl-btn-primary:hover { background: var(--fl-brand-d); }

/* ════════════════════════════════════════════════════════════
   Responsive — un palier tablette (≤ 820px) et un palier mobile
   (≤ 600px), regroupés ici plutôt qu'éparpillés dans le fichier
   ════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
    .fl-synth-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .fl-head h1 { font-size: 22px; }
    .fl-head p { font-size: 13px; }

    .fl-form { flex-direction: column; max-width: none; }
    .fl-form button { width: 100%; }

    .fl-photo-actions { flex-direction: column; }
    .fl-photo-btn { width: 100%; justify-content: center; }

    .fl-source, .fl-product-card { padding: 16px; border-radius: 14px; }

    .fl-hero { flex-direction: column; text-align: center; }
    .fl-hero-meta { justify-content: center; }
    .fl-hero-score {
        border-left: 0;
        border-top: 1px solid var(--fl-line);
        padding-left: 0;
        padding-top: 16px;
        max-width: none;
        width: 100%;
    }

    .fl-seg { display: flex; width: 100%; }
    .fl-seg > button { flex: 1; padding: 0 10px; }

    .fl-card { padding: 14px 16px; }

    .fl-scrim { padding: 20px 16px; align-items: center; }
    .fl-modal-ft { flex-direction: column; }
    .fl-modal-ft button { width: 100%; }
}
