/* Comparateur de fibres — page, boutons et barre de sélection. */

.crc-page { --crc-navy: var(--cr-navy, #00205b); --crc-teal: var(--cr-green-dark, #007566); --crc-green: var(--cr-green, #00a98f); --crc-line: #e3e9ea; --crc-muted: #5b676c; padding: clamp(28px, 4vw, 56px) 0 72px; color: var(--crc-navy); }
.crc-page .cr-shell { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.crc-head h1 { margin: 6px 0 10px; font-size: clamp(32px, 4.4vw, 52px); line-height: 1.05; color: var(--crc-navy); }
.crc-lead { max-width: 760px; margin: 0 0 28px; color: var(--crc-muted); font-size: 17px; line-height: 1.55; }

/* Sélecteur */
.crc-picker { margin: 0 0 26px; padding: 18px 20px; border: 1px solid var(--crc-line); border-radius: 14px; background: #f6f9f9; }
.crc-picker label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.crc-picker__row { display: flex; gap: 10px; flex-wrap: wrap; }
.crc-picker input[type="search"] { flex: 1 1 280px; min-height: 46px; padding: 10px 14px; border: 1px solid #c9d6d8; border-radius: 10px; font: inherit; color: var(--crc-navy); background: #fff; }
.crc-picker input:focus-visible { outline: 3px solid rgba(0, 169, 143, .35); border-color: var(--crc-green); }
.crc-picker__msg { min-height: 1.2em; margin: 8px 0 0; font-size: 13px; color: var(--crc-teal); }

.crc-empty { padding: 40px 24px; border: 2px dashed var(--crc-line); border-radius: 16px; text-align: center; color: var(--crc-muted); }
.crc-empty h2 { margin: 0 0 8px; color: var(--crc-navy); font-size: 22px; }

/* Outils */
.crc-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 14px; }
.crc-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; cursor: pointer; }
.crc-toggle input { width: 18px; height: 18px; accent-color: var(--crc-green); }
.crc-toggle span { color: var(--crc-muted); font-weight: 400; }
.crc-tools__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crc-tools__actions .crc-btn { min-height: 40px; padding: 8px 16px; font-size: 13px; }
.crc-tools__status { flex-basis: 100%; margin: 0; min-height: 1em; font-size: 13px; color: var(--crc-teal); word-break: break-all; }

/* Tableau */
.crc-scroll { overflow-x: auto; border: 1px solid var(--crc-line); border-radius: 14px; background: #fff; }
.crc-scroll:focus-visible { outline: 3px solid rgba(0, 169, 143, .35); }
.crc-table { width: 100%; min-width: calc(220px + var(--crc-cols, 2) * 200px); border-collapse: separate; border-spacing: 0; font-size: 14px; }
.crc-table th, .crc-table td { padding: 12px 16px; border-bottom: 1px solid var(--crc-line); text-align: left; vertical-align: top; }
.crc-table tbody th { position: sticky; left: 0; z-index: 1; width: 220px; background: #fff; font-weight: 700; color: var(--crc-navy); }
.crc-table thead th { position: sticky; top: 0; z-index: 2; background: var(--crc-navy); color: #fff; vertical-align: bottom; }
.crc-table thead .crc-corner { left: 0; z-index: 3; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #b9d1df; }
.crc-prod { position: relative; padding-right: 40px !important; }
.crc-prod__family { display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8fd9c9; }
.crc-prod__title { color: #fff; font-size: 17px; font-weight: 700; text-decoration: none; }
.crc-prod__title:hover { text-decoration: underline; }
.crc-remove { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 50%; background: transparent; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.crc-remove:hover, .crc-remove:focus-visible { background: rgba(255, 255, 255, .15); }
.crc-table td { color: #22323a; font-variant-numeric: tabular-nums; }
.crc-row--group th { position: static !important; padding: 18px 16px 8px !important; background: #f6f9f9 !important; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--crc-teal) !important; }
.crc-row--meta td { color: var(--crc-muted); line-height: 1.5; }
.crc-row--meta a, .crc-link { color: var(--crc-teal); font-weight: 700; }
.crc-row--actions td { border-bottom: 0; }
.crc-row--actions .crc-btn { display: inline-flex; margin: 0 0 8px; min-height: 40px; padding: 8px 16px; font-size: 13px; }
.crc-link { display: block; font-size: 13px; }

/* Différences */
.crc-table tr.is-diff td { background: rgba(0, 169, 143, .07); font-weight: 700; color: var(--crc-navy); }
.crc-table tr.is-diff th { box-shadow: inset 4px 0 0 var(--crc-green); }
.crc-table td.is-missing { color: #9aa6aa; font-weight: 400 !important; }
.crc-table td.is-gated { background: repeating-linear-gradient(135deg, #f6f9f9 0 8px, #fff 8px 16px) !important; }
.crc-table.only-diff tr.is-same { display: none; }
.crc-note { margin: 10px 0 0; font-size: 13px; color: var(--crc-muted); }

/* Bouton sur les fiches et les résultats */
.crc-add-wrap { margin: 18px 0 0; }
.crc-add { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 16px; border: 1.5px solid var(--cr-green-dark, #007566); border-radius: 999px; background: #fff; color: var(--cr-green-dark, #007566); font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1.2; cursor: pointer; }
.crc-add:hover, .crc-add:focus-visible { background: #eef8f6; }
.crc-add[aria-pressed="true"] { background: var(--cr-green-dark, #007566); color: #fff; }
.crc-add.is-small { margin-top: 10px; min-height: 34px; padding: 6px 12px; font-size: 12px; }
.crc-with { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--cr-green-dark, #007566); }

/* Barre de sélection */
.crc-tray { position: fixed; left: 50%; bottom: 16px; z-index: 9999; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; width: min(1100px, calc(100% - 24px)); padding: 12px 16px; transform: translateX(-50%); border-radius: 16px; background: var(--cr-navy, #00205b); color: #fff; box-shadow: 0 18px 40px rgba(0, 32, 91, .28); }
.crc-tray[hidden] { display: none; }
.crc-tray__list { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.crc-tray__list li { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 6px 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: 13px; font-weight: 700; }
.crc-tray__list li.is-empty { padding: 4px 14px; border: 1px dashed rgba(255, 255, 255, .3); background: transparent; color: rgba(255, 255, 255, .45); }
.crc-tray__list button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; }
.crc-tray__actions { display: flex; align-items: center; gap: 10px; }
.crc-tray__go { min-height: 40px; padding: 8px 18px; }
.crc-tray__go.is-disabled { opacity: .55; }
.crc-tray__clear { border: 0; background: none; color: #b9d1df; font-size: 13px; text-decoration: underline; cursor: pointer; }
.crc-tray__msg { flex-basis: 100%; margin: 0; font-size: 13px; color: #8fd9c9; }
.crc-tray__msg:empty { display: none; }
body.has-crc-tray { padding-bottom: 96px; }

@media (max-width: 640px) {
	.crc-table tbody th { width: 150px; font-size: 13px; }
	.crc-table { min-width: calc(150px + var(--crc-cols, 2) * 170px); }
	.crc-tray { bottom: 0; width: 100%; border-radius: 16px 16px 0 0; }
	.crc-tray__list li span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Impression / PDF : seulement le tableau. */
@media print {
	body * { visibility: hidden; }
	.crc-page, .crc-page * { visibility: visible; }
	.crc-page { position: absolute; top: 0; left: 0; width: 100%; padding: 0; }
	.crc-picker, .crc-tools, .crc-remove, .crc-row--actions, .crc-tray { display: none !important; }
	.crc-scroll { overflow: visible; border: 0; }
	.crc-table { min-width: 0; font-size: 10.5pt; }
	.crc-table thead th { position: static; background: #fff; color: #00205b; border-bottom: 2px solid #00205b; }
	.crc-prod__title { color: #00205b; }
	.crc-prod__family { color: #007566; }
	.crc-table tbody th { position: static; }
	.crc-table tr { break-inside: avoid; }
	.crc-table.only-diff tr.is-same { display: none; }
}

/* Boutons autonomes (ne dépendent pas des styles du thème parent). */
.crc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 20px; border: 1.5px solid transparent; border-radius: 999px; font-family: inherit; font-weight: 700; font-size: 14px; line-height: 1.2; text-decoration: none !important; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.crc-btn--primary { background: var(--cr-green, #00a98f); border-color: var(--cr-green, #00a98f); color: var(--cr-navy, #00205b) !important; }
.crc-btn--primary:hover, .crc-btn--primary:focus-visible { background: #19c3a7; border-color: #19c3a7; }
.crc-btn--outline { background: #fff; border-color: #c9d6d8; color: var(--cr-navy, #00205b) !important; }
.crc-btn--outline:hover, .crc-btn--outline:focus-visible { border-color: var(--cr-green-dark, #007566); color: var(--cr-green-dark, #007566) !important; }
.crc-btn[disabled] { opacity: .5; cursor: not-allowed; }
.crc-page .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* ---------- 1.8 : sélection simplifiée ---------- */
.crc-add-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crc-similar { min-height: 42px; padding: 9px 18px; font-size: 14px; }

/* Liste à cocher par famille */
.crc-browse { margin-bottom: 18px; }
.crc-browse__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.crc-browse__head label { margin: 0 !important; font-weight: 700; font-size: 14px; }
.crc-browse__head select { min-height: 42px; padding: 8px 12px; border: 1px solid #c9d6d8; border-radius: 10px; font: inherit; color: var(--crc-navy); background: #fff; }
.crc-browse__count { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--crc-teal); }
.crc-browse__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 330px; margin: 0; padding: 2px; overflow-y: auto; list-style: none; }
.crc-browse__list label { display: flex !important; align-items: flex-start; gap: 10px; height: 100%; margin: 0 !important; padding: 10px 12px; border: 1px solid #dbe4e6; border-radius: 10px; background: #fff; font-weight: 400 !important; cursor: pointer; transition: border-color .2s, background .2s; }
.crc-browse__list label:hover { border-color: var(--crc-green); }
.crc-browse__list label.is-on { border-color: var(--crc-green); background: #eaf7f4; }
.crc-browse__list input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--crc-green); flex: none; }
.crc-browse__list input:disabled + span { opacity: .45; }
.crc-browse__list b { display: block; font-size: 14px; color: var(--crc-navy); }
.crc-browse__list small { display: block; margin-top: 2px; font-size: 12px; color: var(--crc-muted); }
.crc-picker.has-browse .crc-picker__row input { min-height: 40px; }

/* Case « Comparer » dans les résultats */
.crc-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 12px 6px 8px; border: 1px solid #c9d6d8; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--cr-navy, #00205b); cursor: pointer; user-select: none; }
.crc-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--cr-green, #00a98f); }
.crc-check.is-on { border-color: var(--cr-green-dark, #007566); background: #eaf7f4; color: var(--cr-green-dark, #007566); }

/* Barre : suggestion */
.crc-tray__suggest { padding: 0 !important; background: transparent !important; }
.crc-tray__suggest button { width: auto !important; height: auto !important; padding: 7px 12px; border: 1px dashed #8fd9c9 !important; border-radius: 999px !important; background: transparent !important; color: #8fd9c9 !important; font-weight: 700; font-size: 13px; }
.crc-tray__msg:empty { display: none; }
.crc-tray .crc-tray__go { min-height: 40px; padding: 8px 18px; white-space: nowrap; }
.crc-browse__list { padding: 2px 2px 8px; align-items: stretch; }
.crc-browse__list li { display: flex; }
.crc-browse__list label { flex: 1; height: auto; }
