/*
 * Recherche produit alimentaire — v3.0.0
 * Base commune smartphone / desktop.
 * Les variations de mise en page sont dans desktop.css et mobile.css.
 */

.ia-off {
    --rpa-text: #222;
    --rpa-muted: #5f6671;
    --rpa-border: #cfd4da;
    --rpa-button-border: #8d949e;
    --rpa-button-hover: #f1f3f5;
    --rpa-search: #2869d1;
    --rpa-search-bg: #eef5ff;
    --rpa-history: #247b49;
    --rpa-history-bg: #eef9f1;
    --rpa-product: #7545bd;
    --rpa-product-bg: #f5efff;
    --rpa-radius: 8px;
    --rpa-shadow: 0 2px 8px rgba(0, 0, 0, .08);

    box-sizing: border-box;
    width: 100%;
    max-width: 1080px;
    color: var(--rpa-text);
    font-size: 14px;
    line-height: 1.45;
}

.ia-off *,
.ia-off *::before,
.ia-off *::after {
    box-sizing: border-box;
}

.ia-off [hidden],
.ia-off__confirm-overlay[hidden],
.ia-off__image-lightbox[hidden] {
    display: none !important;
}

/* ---------- Typography ---------- */
.ia-off h2,
.ia-off h3,
.ia-off p {
    max-width: none;
}

.ia-off h2 {
    font-size: 18px;
}

.ia-off h3 {
    font-size: 16px;
}

.ia-off__help,
.ia-off__status,
.ia-off__desktop-section-subtitle {
    color: var(--rpa-muted);
}

.ia-off__help,
.ia-off__status {
    margin: 6px 0;
    font-size: 12px;
    font-style: italic;
}

.ia-off__desktop-section-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
}

/* ---------- Three structural sections ---------- */
.ia-off__section-panel {
    width: 100%;
    margin: 0 0 14px;
    overflow: visible;
    border: 1px solid var(--rpa-border);
    border-radius: var(--rpa-radius);
    background: #fff;
    box-shadow: var(--rpa-shadow);
}

.ia-off__section-panel--search {
    border-color: #78a6ff;
}

.ia-off__section-panel--history {
    border-color: #90c5a0;
}

.ia-off__section-panel--product {
    border-color: #c9a9ee;
}

.ia-off__section-toggle {
    appearance: none;
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-family: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.ia-off__section-toggle:hover,
.ia-off__section-toggle:focus-visible,
.ia-off__section-toggle:active {
    box-shadow: none;
}

.ia-off__section-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.ia-off__section-number {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    line-height: 1;
}

.ia-off__desktop-entries-toggle-title,
.ia-off__desktop-search-toggle-title,
.ia-off__desktop-product-toggle-title {
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
}

.ia-off__desktop-entries-toggle {
    color: var(--rpa-search);
}

.ia-off__desktop-search-toggle {
    color: var(--rpa-history);
}

.ia-off__desktop-product-toggle {
    color: var(--rpa-product);
}

/*
 * Les titres de sections sont des contrôles structurels, pas des boutons
 * d'action. Le thème WordPress ne doit jamais remplacer leurs couleurs
 * lors du clic, du survol ou du focus.
 */
.ia-off__desktop-entries-toggle:hover,
.ia-off__desktop-entries-toggle:focus,
.ia-off__desktop-entries-toggle:focus-visible,
.ia-off__desktop-entries-toggle:active {
    background: transparent;
    color: var(--rpa-search);
}

.ia-off__desktop-search-toggle:hover,
.ia-off__desktop-search-toggle:focus,
.ia-off__desktop-search-toggle:focus-visible,
.ia-off__desktop-search-toggle:active {
    background: transparent;
    color: var(--rpa-history);
}

.ia-off__desktop-product-toggle:hover,
.ia-off__desktop-product-toggle:focus,
.ia-off__desktop-product-toggle:focus-visible,
.ia-off__desktop-product-toggle:active {
    background: transparent;
    color: var(--rpa-product);
}

.ia-off__desktop-entries-toggle .ia-off__section-number {
    background: var(--rpa-search);
}

.ia-off__desktop-search-toggle .ia-off__section-number {
    background: var(--rpa-history);
}

.ia-off__desktop-product-toggle .ia-off__section-number {
    background: var(--rpa-product);
}

.ia-off__desktop-entries-chevron,
.ia-off__desktop-search-chevron,
.ia-off__desktop-product-chevron {
    flex: 0 0 auto;
    margin-left: auto;
    font-weight: 700;
    line-height: 1;
}

/* ---------- Inputs ---------- */
.ia-off label {
    font-weight: 600;
}

.ia-off input[type="text"],
.ia-off input[type="search"],
.ia-off input[type="file"] {
    max-width: 100%;
    border: 1px solid #aeb4bd;
    border-radius: 5px;
    background: #fff;
    color: var(--rpa-text);
    font-family: inherit;
    font-size: 14px;
}

.ia-off input[type="text"],
.ia-off input[type="search"] {
    min-height: 38px;
    padding: 7px 10px;
}

.ia-off__search {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Action buttons ---------- */
.ia-off button:not(.ia-off__section-toggle):not(.ia-off__suggestion):not(.ia-off__image-lightbox-backdrop),
.ia-off .ia-off__import-button,
.ia-off .ia-off__upc-use,
.ia-off .ia-off__capture-button {
    appearance: none;
    display: inline-flex;
    width: auto;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 5px 11px;
    border: 1px solid var(--rpa-button-border);
    border-radius: 6px;
    background: #fff;
    color: var(--rpa-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.ia-off button:not(.ia-off__section-toggle):not(.ia-off__suggestion):not(.ia-off__image-lightbox-backdrop):hover,
.ia-off button:not(.ia-off__section-toggle):not(.ia-off__suggestion):not(.ia-off__image-lightbox-backdrop):focus-visible,
.ia-off .ia-off__import-button:hover,
.ia-off .ia-off__import-button:focus-within,
.ia-off .ia-off__upc-use:hover,
.ia-off .ia-off__upc-use:focus-visible,
.ia-off .ia-off__capture-button:hover,
.ia-off .ia-off__capture-button:focus-within {
    border-color: #747b85;
    background: var(--rpa-button-hover);
    color: var(--rpa-text);
}

.ia-off button:disabled {
    cursor: default;
    opacity: .5;
}

.ia-off__capture-input,
.ia-off__import-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.ia-off__actions,
.ia-off__storage-transfer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Search by name ---------- */
.ia-off__upc-search {
    padding: 14px;
    border: 1px solid #d7dce2;
    border-radius: 8px;
    background: #fafbfc;
}

.ia-off__upc-search h2 {
    margin: 0 0 10px;
}

.ia-off__upc-results {
    margin-top: 14px;
}

.ia-off__upc-result-list {
    display: grid;
    gap: 10px;
}

.ia-off__upc-result-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #dfe3e8;
    border-radius: 7px;
    background: #fff;
}

.ia-off__upc-result-photo {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    width: 76px;
    height: 76px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #eceff2;
    border-radius: 5px;
    background: #f7f8fa;
    color: #a5abb3;
}

.ia-off__upc-result-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ia-off__upc-result-main {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    gap: 2px;
    min-width: 0;
}

.ia-off__upc-result-main strong {
    overflow-wrap: anywhere;
}

.ia-off__upc-result-main span {
    color: #666;
    font-size: 12px;
}

.ia-off__upc-use {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
}

/* ---------- Camera/photo ---------- */
.ia-off__manual,
.ia-off__desktop-option,
.ia-off__mobile-option {
    min-width: 0;
    padding: 14px;
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.ia-off__manual label,
.ia-off__desktop-option h3,
.ia-off__mobile-option h3 {
    margin-top: 0;
}

.ia-off__photo-input {
    display: block;
    width: 100%;
    font-family: inherit;
}

.ia-off__photo-preview {
    display: block;
    max-width: 100%;
    max-height: 260px;
    margin-top: 10px;
    object-fit: contain;
}

.ia-off__video-wrap {
    margin-top: 10px;
}

.ia-off__video {
    display: block;
    width: 100%;
    max-width: 560px;
    max-height: 420px;
    background: #111;
    object-fit: cover;
}

.ia-off__scan-guide {
    position: relative;
}

/* ---------- Autocomplete ---------- */
.ia-off__autocomplete {
    position: relative;
}

.ia-off__suggestions {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
}

.ia-off__suggestion {
    appearance: none;
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid #e5e5e5;
    border-radius: 0;
    background: #fff;
    color: #222;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.ia-off__suggestion:last-child {
    border-bottom: 0;
}

.ia-off__suggestion:hover,
.ia-off__suggestion:focus-visible {
    background: #f2f2f2;
}

.ia-off__suggestion-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
}

.ia-off__suggestion-thumb {
    display: block;
    width: 38px;
    height: 48px;
    border: 1px solid #e0e4e8;
    border-radius: 4px;
    background: #fff;
    object-fit: contain;
}

.ia-off__suggestion-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.ia-off__suggestion-main {
    font-weight: 600;
}

.ia-off__suggestion-meta {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* ---------- History cards ---------- */
.ia-off__saved-item {
    margin-top: 12px;
    border: 1px solid #cfd4d8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .05);
}

.ia-off__saved-item-content {
    min-width: 0;
}

.ia-off__saved-item-heading h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
}

.ia-off__saved-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 4px 0;
    color: #5d6470;
    font-size: 12px;
}

.ia-off__saved-meta-line span {
    white-space: nowrap;
}

.ia-off__saved-thumb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e0e4e8;
    border-radius: 5px;
    background: #fff;
}

.ia-off__saved-thumb {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: contain;
    object-position: center;
}

.ia-off__saved-item-content > details {
    margin-top: 7px;
}

.ia-off__saved-item-content > details > summary {
    cursor: pointer;
}

/* ---------- Product card ---------- */
.ia-off__card {
    min-width: 0;
}

.ia-off__nova-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(70, 70, 70, .22);
    border-radius: 7px;
}

.ia-off__nova-bar--1 { background: #eaf7ee; }
.ia-off__nova-bar--2 { background: #fff7d7; }
.ia-off__nova-bar--3 { background: #fff0dc; }
.ia-off__nova-bar--4 { background: #fdeaea; }
.ia-off__nova-bar--unknown { background: #f1f2f4; }

.ia-off__nova-label,
.ia-off__nova-right,
.ia-off__risk-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ia-off__nova-right {
    justify-content: flex-end;
}

.ia-off__nova-code {
    font-weight: 700;
}

.ia-off__risk-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.ia-off__risk-dot--none { background: #3b9a58; }
.ia-off__risk-dot--moderate { background: #d79d00; }
.ia-off__risk-dot--risk { background: #c44343; }
.ia-off__risk-dot--unknown { background: #9da3aa; }

.ia-off__score-logo {
    display: block;
    max-height: 38px;
    width: auto;
}

.ia-off__header {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.ia-off__header h2 {
    margin: 0 0 8px;
}

.ia-off__image {
    width: 130px;
    height: 130px;
    flex: 0 0 auto;
    background: #fff;
    object-fit: contain;
}

.ia-off__card-actions {
    min-width: 0;
}

.ia-off__save-form {
    display: grid;
    gap: 8px;
}

.ia-off__category-label {
    display: grid;
    gap: 5px;
}

/* ---------- Nutrition ---------- */
.ia-off__nutrition-heading {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ia-off__table-wrap {
    width: 100%;
    overflow-x: auto;
}

.ia-off__table {
    width: 100%;
    border-collapse: collapse;
}

.ia-off__table th,
.ia-off__table td {
    padding: 7px 9px;
    border: 1px solid #ccc;
    text-align: left;
    vertical-align: top;
}

.ia-off__table th {
    font-weight: 600;
}

.ia-off__nutrient-level {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.ia-off__nutrient-level--none { background: #e8f5e9; color: #246b2d; }
.ia-off__nutrient-level--moderate { background: #fff3cd; color: #765900; }
.ia-off__nutrient-level--risk { background: #fdeaea; color: #9d2929; }

/* ---------- Recalls ---------- */
.ia-off__recall-summary {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #d7dce2;
    border-radius: 8px;
    font-size: 14px;
}

.ia-off__recall-summary--alert { border-color: #efb14a; background: #fff9e8; }
.ia-off__recall-summary--clear { border-color: #9dceb0; background: #f2faf5; }
.ia-off__recall-summary--unknown { border-color: #e3ba6c; background: #fff8e9; }

.ia-off__recall-summary-icon {
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-weight: 700;
}

.ia-off__recall-summary-body {
    min-width: 0;
}

.ia-off__recall-details {
    margin-top: 4px;
}

.ia-off__recall-card {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #e2c16d;
    border-radius: 8px;
    background: #fffaf0;
}

.ia-off__recall-grid {
    display: grid;
    gap: 5px;
}

.ia-off__recall-source {
    color: var(--rpa-muted);
    font-size: 12px;
}

/* ---------- Messages ---------- */
.ia-off__message,
.ia-off__error {
    padding: 10px 12px;
    border-radius: 6px;
}

.ia-off__message--success { background: #eef9f1; color: #246b3b; }
.ia-off__message--error,
.ia-off__error { background: #fdecec; color: #8d2e2e; }

/* ---------- Sources/privacy ---------- */
.ia-off__admin-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.ia-off__product-sources {
    margin: 14px 0 0;
    padding-top: 10px;
    border-top: 1px solid #e1e4e8;
}

/* ---------- Standard modals ---------- */
.ia-off__modal:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ia-off__modal > .ia-off__modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .18);
}

.ia-off__modal-box {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(92vw, 680px);
    max-height: calc(100dvh - 36px);
    flex-direction: column;
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #aeb4bd;
    border-radius: 12px;
    background: #f8f9fb;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
}

.ia-off__modal-heading {
    position: relative;
    display: flex;
    min-height: 46px;
    align-items: center;
    margin: 0 0 14px;
    padding: 8px 92px 12px 0;
    border-bottom: 1px solid #d5d9df;
}

.ia-off__modal-heading h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.ia-off__modal-heading .ia-off__modal-close {
    position: absolute;
    top: 5px;
    right: 0;
}

.ia-off__additives-list,
.ia-off__nova-markers-list {
    margin: 0;
    padding-left: 20px;
}

.ia-off__additive-risk-item {
    margin-bottom: 10px;
}

.ia-off__additive-risk-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ia-off__risk-badge {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.ia-off__risk-badge--none { background: #e8f5e9; color: #246b2d; }
.ia-off__risk-badge--limited { background: #eef4ff; color: #315fa9; }
.ia-off__risk-badge--moderate { background: #fff3cd; color: #765900; }
.ia-off__risk-badge--risk { background: #fdeaea; color: #9d2929; }
.ia-off__risk-badge--unknown { background: #eceff2; color: #555; }

/* ---------- Confirmation modal ---------- */
.ia-off__confirm-overlay:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, .18);
}

.ia-off__confirm-box {
    width: min(92vw, 460px);
    padding: 18px;
    border: 1px solid #aeb4bd;
    border-radius: 12px;
    background: #f8f9fb;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
}

.ia-off__modal-icon {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    border: 1px solid #8d949e;
    border-radius: 50%;
    font-weight: 700;
}

.ia-off__modal-title {
    margin: 0 0 8px;
    text-align: center;
}

.ia-off__modal-message {
    text-align: center;
}

.ia-off__modal-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

/* ---------- Image lightbox ---------- */
.ia-off__zoomable-image {
    cursor: zoom-in;
    touch-action: manipulation;
}

.ia-off__image-lightbox:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ia-off__image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, .58);
    box-shadow: none;
}

.ia-off__image-lightbox-box {
    position: relative;
    z-index: 1;
    display: flex;
    max-width: min(92vw, 900px);
    max-height: 90dvh;
    padding: 50px 14px 14px;
    border: 1px solid #aeb4bd;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
}

.ia-off__image-lightbox-box img {
    display: block;
    max-width: 100%;
    max-height: calc(90dvh - 64px);
    object-fit: contain;
}

.ia-off__image-lightbox-close {
    position: absolute;
    top: 8px;
    right: 10px;
}

html.ia-off-image-open,
body.ia-off-image-open {
    overflow: hidden;
}

/* ---------- Secondary panels / details ---------- */
.ia-off__panel--saved {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid #cfd4da;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .05);
}

.ia-off__panel--saved > h2 {
    margin-top: 0;
}

.ia-off__saved-item[data-ia-off-saved-card] {
    cursor: pointer;
}

.ia-off__saved-item[data-ia-off-saved-card]:hover {
    background: #f7fbf8;
}

.ia-off__saved-item[data-ia-off-saved-card]:focus-visible {
    outline: 2px solid var(--rpa-history);
    outline-offset: 2px;
}

.ia-off__additives-scroll {
    min-width: 0;
}

.ia-off__additive-risk-note,
.ia-off__additive-risk-reason {
    margin: 4px 0;
    color: var(--rpa-muted);
    font-size: 12px;
}

.ia-off__additive-official-link,
.ia-off__recall-official-link {
    display: inline-block;
    margin-top: 5px;
}

.ia-off__local-result-empty {
    margin: 0;
}

.ia-off__nova-ingredients-count {
    white-space: nowrap;
}


/* Liens textuels ouvrant les fenêtres d'information. */
.ia-off .ia-off__text-link {
    appearance: none;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #365f9d;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.ia-off .ia-off__text-link:hover,
.ia-off .ia-off__text-link:focus-visible,
.ia-off .ia-off__text-link:active {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #244a7d;
}
