/* ============================================================
   VARIABLES GLOBALES
============================================================ */

:root {
    --icrea-bg: #f5f7fb;
    --icrea-card-bg: #ffffff;
    --icrea-border: #dde3ee;
    --icrea-border-soft: #e4e8f2;
    --icrea-text: #1f2933;
    --icrea-text-soft: #6b7280;
    --icrea-accent: #ff7a1a;
    --icrea-accent-soft: rgba(255, 122, 26, 0.12);
    --icrea-accent-dark: #e86609;
    --icrea-accent-2: #2563eb;
    --icrea-danger: #e11d48;
    --icrea-success: #059669;
    --icrea-radius-lg: 12px;
    --icrea-radius-pill: 999px;
    --icrea-shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.06);
    --icrea-shadow-modal: 0 18px 45px rgba(15, 23, 42, 0.22);
    --icrea-transition-fast: 150ms ease-out;
}

/* Reset léger pour le composant */
.icrea-battery-wrapper * {
    box-sizing: border-box;
}

/* ============================================================
   WRAPPER & HEADER
============================================================ */

.icrea-battery-wrapper {
    margin: 24px 0 40px;
    padding: 20px 20px 24px;
    background: var(--icrea-bg);
    border-radius: 16px;
    border: 1px solid var(--icrea-border-soft);
    box-shadow: var(--icrea-shadow-soft);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--icrea-text);
}

.icrea-battery-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.icrea-battery-header-left {
    flex: 1 1 260px;
    min-width: 220px;
}

.icrea-battery-title {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--icrea-text);
}

.icrea-battery-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--icrea-text-soft);
}

.icrea-battery-header-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icrea-battery-header-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--icrea-radius-pill);
    background: #ffffff;
    border: 1px solid var(--icrea-border-soft);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--icrea-text-soft);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.icrea-battery-header-pill .icn {
    font-size: 1rem;
}

/* ============================================================
   BARRE DE CRITÈRES & FILTRES
============================================================ */

.icrea-battery-criteria {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff, #f4f7ff);
    border-radius: 999px;
    border: 1px solid var(--icrea-border-soft);
}

.icrea-battery-criteria-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--icrea-text-soft);
    margin-right: 4px;
}

.icrea-battery-criteria-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--icrea-radius-pill);
    font-size: 0.78rem;
    color: var(--icrea-text-soft);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
    cursor: pointer;
    transition: background var(--icrea-transition-fast), border-color var(--icrea-transition-fast), color var(--icrea-transition-fast), box-shadow var(--icrea-transition-fast);
}

.icrea-battery-criteria-item input[type="checkbox"] {
    margin: 0;
    accent-color: var(--icrea-accent);
}

.icrea-battery-criteria-item:hover {
    background: var(--icrea-accent-soft);
    border-color: rgba(248, 113, 32, 0.5);
    color: var(--icrea-text);
    box-shadow: 0 2px 6px rgba(248, 113, 32, 0.18);
}

.icrea-battery-criteria-clear {
    margin-left: 6px;
    padding: 4px 10px;
    border-radius: var(--icrea-radius-pill);
    border: 1px dashed rgba(148, 163, 184, 0.8);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--icrea-text-soft);
    cursor: pointer;
    transition: background var(--icrea-transition-fast), color var(--icrea-transition-fast), border-color var(--icrea-transition-fast), transform var(--icrea-transition-fast);
}

.icrea-battery-criteria-clear:hover {
    background: rgba(239, 68, 68, 0.06);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.8);
    transform: translateY(-1px);
}

.icrea-battery-brand-filter {
    margin-left: auto;
    min-width: 160px;
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: var(--icrea-radius-pill);
    border: 1px solid var(--icrea-border);
    background: #ffffff;
    color: var(--icrea-text-soft);
}

/* ============================================================
   TABLEAU & SCROLL
============================================================ */

.icrea-battery-table-scroll {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

.icrea-battery-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--icrea-card-bg);
    border-radius: 14px;
    overflow: hidden;
    font-size: 0.85rem;
}

/* Envelopper le tableau dans un conteneur arrondi */
.icrea-battery-table thead {
    background: linear-gradient(135deg, #f9fafb, #eef2ff);
}

.icrea-battery-table thead th {
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    color: var(--icrea-text-soft);
    border-bottom: 1px solid var(--icrea-border);
    white-space: nowrap;
}

.icrea-battery-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.icrea-battery-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.icrea-battery-table tbody tr:hover {
    background: #f1f5f9;
}

.icrea-battery-table td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--icrea-border-soft);
}

/* Colonnes spécifiques */
.icrea-battery-table .col-logo {
    width: 80px;
    text-align: center;
}

.icrea-battery-table .col-img {
    width: 90px;
    text-align: center;
}

.icrea-battery-table .col-youtube {
    width: 120px;
    text-align: center;
}

.icrea-battery-table .col-actions {
    width: 220px;
}

/* Boutons de tri */
.icrea-sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px !important;
}

.icrea-sortable::after {
    content: "↕";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    opacity: 0.4;
}

.icrea-sortable[data-sort="asc"]::after {
    content: "↑";
    opacity: 0.9;
}

.icrea-sortable[data-sort="desc"]::after {
    content: "↓";
    opacity: 0.9;
}

/* Logo, image produit, brand tag */
.icrea-battery-logo {
    max-width: 48px;
    max-height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.icrea-battery-product {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    border-radius: 8px;
    background: #f3f4f6;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.icrea-battery-brand-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--icrea-radius-pill);
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Lien YouTube */
.icrea-battery-youtube-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--icrea-accent-2);
    font-size: 0.78rem;
}

.icrea-battery-youtube-thumb {
    height: 60px !important;   /* fixe la hauteur */
    width: auto !important;    /* garde le ratio */
    object-fit: contain;       /* évite toute déformation */
    display: block;
    margin: 0 auto;            /* centré */
}


/* ============================================================
   PRIX, PROMOS & SCORE
============================================================ */

.icrea-battery-price-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.icrea-price-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.icrea-price-normal {
    font-weight: 600;
    color: var(--icrea-text);
}

.icrea-price-eur-kwh {
    font-size: 0.75rem;
    color: var(--icrea-text-soft);
}

.icrea-price-promo-line {
    margin-top: 2px;
}

.icrea-price-promo {
    font-weight: 700;
    color: var(--icrea-success);
}

.icrea-price-discount {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--icrea-danger);
    padding: 1px 6px;
    border-radius: var(--icrea-radius-pill);
    background: rgba(248, 113, 113, 0.08);
}

/* Boutons actions */
.icrea-battery-offer-btn,
.icrea-battery-price-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    margin-top: 2px;
    border-radius: var(--icrea-radius-pill);
    border: none;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--icrea-transition-fast), color var(--icrea-transition-fast), transform var(--icrea-transition-fast), box-shadow var(--icrea-transition-fast);
}

.icrea-battery-offer-btn {
    background: var(--icrea-accent);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(248, 113, 32, 0.35);
}

.icrea-battery-offer-btn:hover {
    background: var(--icrea-accent-dark);
    transform: translateY(-1px);
}

.icrea-battery-price-btn {
    background: #ffffff;
    color: var(--icrea-text-soft);
    border: 1px solid var(--icrea-border);
}

.icrea-battery-price-btn:hover {
    background: #f9fafb;
    color: var(--icrea-text);
}

/* Score chip */
.icrea-score-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 3px 9px;
    border-radius: var(--icrea-radius-pill);
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.78rem;
    cursor: default;
}

.icrea-score-value {
    font-weight: 700;
    font-size: 0.85rem;
}

.icrea-score-unit {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Tooltip détail note */
.icrea-score-chip:hover .icrea-score-tooltip {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.icrea-score-tooltip {
    position: absolute;
    z-index: 50;
    left: 0;
    bottom: calc(100% + 8px);
    min-width: 220px;
    max-width: 280px;
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.6);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 120ms ease-out, transform 120ms ease-out;
}

.icrea-score-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 14px;
    width: 0;
    height: 0;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

.icrea-score-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

.icrea-score-tooltip ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.icrea-score-tooltip li {
    margin: 1px 0;
}

/* ============================================================
   MODALES
============================================================ */

.icrea-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9998;
    
    display: flex;                /* centrage horizontal + vertical */
    align-items: center;          /* vertical */
    justify-content: center;      /* horizontal */
}

.icrea-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* évite les clics sur la zone vide */
}

.icrea-modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    pointer-events: auto; /* permet de cliquer dans la modale */
    background: #fff;
    border-radius: 10px;
    max-width: 480px;
    width: 95%;
    padding: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    animation: icreaModalIn 0.15s ease-out;
}


@keyframes icreaModalIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.icrea-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.icrea-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--icrea-text);
}

.icrea-modal-close {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--icrea-text-soft);
}

.icrea-modal-close:hover {
    color: var(--icrea-text);
}

.icrea-modal-body {
    font-size: 0.85rem;
    color: var(--icrea-text-soft);
}

/* Offre promo modal */
.icrea-offer-text {
    margin-top: 0;
    margin-bottom: 10px;
}

.icrea-offer-code-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.icrea-offer-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    padding: 5px 10px;
    border-radius: var(--icrea-radius-pill);
    background: rgba(15, 23, 42, 0.96);
    color: #f9fafb;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.icrea-offer-copy.button {
    font-size: 0.78rem;
    padding: 4px 8px;
}

.icrea-offer-copy-feedback {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: var(--icrea-success);
}

.icrea-offer-link.button-primary {
    font-size: 0.85rem;
}

/* Form "meilleur prix" */
.icrea-price-form p {
    margin: 6px 0;
}

.icrea-price-form input[type="text"],
.icrea-price-form input[type="email"],
.icrea-price-form input[type="url"] {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.82rem;
}

.icrea-price-form-feedback {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--icrea-success);
}

/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 900px) {
    .icrea-battery-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .icrea-battery-criteria {
        border-radius: 12px;
    }

    .icrea-battery-table .col-actions {
        width: 260px;
    }
}

@media (max-width: 640px) {
    .icrea-battery-wrapper {
        padding: 14px 10px 16px;
        border-radius: 12px;
    }

    .icrea-battery-title {
        font-size: 1.15rem;
    }

    .icrea-battery-criteria {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .icrea-battery-brand-filter {
        margin-left: 0;
        align-self: flex-start;
    }

    .icrea-battery-table thead th,
    .icrea-battery-table td {
        padding: 6px 8px;
    }
}
.icrea-price-old {
    font-size: 0.8rem;
    color: var(--icrea-text-soft);
    text-decoration: line-through;
    opacity: 0.8;
}

.icrea-edit-pencil {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 4px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 12px;
    background: #ffffff;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.icrea-edit-pencil:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

