/**
 * H2J Cookies - Front CSS bandeau v1.0.9 (refonte portrait Axeptio-like)
 *
 * Modal portrait bloquant (1B) avec :
 * - Header bandeau colore (preset CUBX)
 * - Hero image rotative aleatoire (4 visuels)
 * - Body : titre + tagline + 2 paragraphes
 * - Footer : 2 boutons en bandeau colle (Je choisis | Accepter)
 *
 * @since v1.0.9 (Sprint 2 refonte)
 */

/* === Body scroll lock when banner open === */
body.h2jck-noscroll {
    overflow: hidden;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
}

/* === Root container === */
#h2jcookies-root {
    position: fixed;
    inset: 0;
    z-index: 999998;
    pointer-events: none;
}
#h2jcookies-root.h2jck-open {
    pointer-events: auto;
}
#h2jcookies-root:not(.h2jck-open) {
    display: none;
}

/* === Overlay avec blur === */
.h2jck-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    animation: h2jck-fade-in 0.3s ease-out;
    cursor: default;
}

/* === Modal portrait === */
.h2jck-modal--portrait {
    position: relative;
    z-index: 1;
    max-width: 440px;
    width: calc(100% - 32px);
    margin: 0 auto;
    margin-top: 4vh;
    background: #fff;
    color: #333;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    overflow: hidden;
    animation: h2jck-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER bandeau colore === */
.h2jck-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    flex: 0 0 auto;
    gap: 12px;
    min-height: 48px;
}
.h2jck-header__left {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    font-size: 11px;
}
.h2jck-header__certified {
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 9px;
}
.h2jck-header__brand {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.04em;
}
.h2jck-header__continue {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
.h2jck-header__continue:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === HERO image rotative === */
.h2jck-hero {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.h2jck-hero picture {
    display: block;
    width: 100%;
    height: 100%;
}
.h2jck-hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    display: block;
    animation: h2jck-zoom-in 6s ease-out forwards;
}
.h2jck-hero__fade {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* === BODY === */
.h2jck-modal__body {
    padding: 8px 28px 24px 28px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.h2jck-modal__title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.h2jck-modal__tagline {
    margin: 0 0 16px 0;
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    opacity: 0.85;
}
.h2jck-modal__paragraph {
    margin: 0 0 12px 0;
    font-size: 13px;
    line-height: 1.55;
}
.h2jck-modal__paragraph:last-child {
    margin-bottom: 0;
}

/* === Adult warning discret (mini bandeau ligne avant les boutons) === */
.h2jck-adult-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.75;
}
.h2jck-adult-note__icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
}
.h2jck-adult-note__text {
    flex: 1 1 auto;
}

/* === FOOTER : 2 boutons en bandeau === */
.h2jck-actions-bar {
    display: flex;
    flex: 0 0 auto;
    border-top: 1px solid #ececec;
    background: #fff;
    overflow: hidden;
}
.h2jck-actions-bar__btn {
    flex: 1 1 50%;
    padding: 16px 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: filter 0.15s, opacity 0.15s;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
}
.h2jck-actions-bar__btn:hover {
    filter: brightness(1.05);
    text-decoration: none !important;
}
.h2jck-actions-bar__btn:active {
    filter: brightness(0.95);
}
.h2jck-actions-bar__btn--customize {
    background: #fff;
}
.h2jck-actions-bar__btn--customize:hover {
    background: #f8f8f8;
    filter: none;
}
.h2jck-actions-bar__btn--accept {
    /* couleurs en inline style */
}

/* === Categories list (customize view) === */
.h2jck-categories {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.h2jck-cat {
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 10px;
}
.h2jck-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.h2jck-cat__title {
    font-weight: 600;
    font-size: 14px;
}
.h2jck-cat__essential {
    font-size: 11px;
    color: #4caf50;
    font-weight: 500;
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 12px;
}
.h2jck-cat__desc {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
}

/* === Toggle switch (utilise --h2jck-switch-on pour la couleur preset CUBX) === */
.h2jck-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
}
.h2jck-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.h2jck-switch__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    transition: 0.2s;
    border-radius: 24px;
}
.h2jck-switch__slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    transition: 0.2s;
    border-radius: 50%;
}
.h2jck-switch input:checked + .h2jck-switch__slider {
    background: var(--h2jck-switch-on, #c2185b);
}
.h2jck-switch input:checked + .h2jck-switch__slider::before {
    transform: translateX(20px);
}
.h2jck-switch input:disabled + .h2jck-switch__slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Floating Action Button (FAB) === */
.h2jck-fab {
    position: fixed;
    z-index: 99997;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #c2185b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.h2jck-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.h2jck-fab--bottom-left {
    bottom: 20px;
    left: 20px;
}
.h2jck-fab--bottom-right {
    bottom: 20px;
    right: 20px;
}
.h2jck-fab .material-icons {
    font-size: 24px;
}

/* === Megamenu widget (cookie certification card) === */
.h2jcookies-megamenu-widget {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 4px 0;
}

.h2jcookies-megamenu-widget__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--h2jcookies-widget-bg, #c2185b);
    justify-content: flex-start;
    text-decoration: none;
    border: 1px solid var(--h2jcookies-widget-border, rgba(255,255,255,0.14));
    box-shadow: none;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.h2jcookies-megamenu-widget__link:hover {
    filter: brightness(1.02);
    opacity: 0.98;
    text-decoration: none;
}

.h2jcookies-megamenu-widget__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.h2jcookies-megamenu-widget__icon .material-icons {
    font-size: 19px;
    line-height: 1;
    color: inherit;
}

.h2jcookies-megamenu-widget__badge {
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.2;
    color: #fff;
    text-transform: none;
}

@media (max-width: 767px) {
    .h2jcookies-megamenu-widget__link {
        min-height: 38px;
        padding: 8px 11px;
        gap: 8px;
    }
}

/* === Account card (hook displayCustomerAccount) === */
.h2jck-account-card .h2jck-account-card__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.15s;
}
.h2jck-account-card .h2jck-account-card__inner:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.h2jck-account-card__icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fce4ec;
    color: #c2185b;
    display: flex;
    align-items: center;
    justify-content: center;
}
.h2jck-account-card__title {
    font-weight: 600;
    font-size: 14px;
}
.h2jck-account-card__desc {
    font-size: 12px;
    color: #666;
}

/* === Animations === */
@keyframes h2jck-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes h2jck-slide-up {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes h2jck-zoom-in {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

/* === Responsive : modal portrait remplit l'ecran en bas (bottom-sheet iOS/Android) === */
@media (max-width: 600px) {
    .h2jck-modal--portrait {
        width: 100%;
        max-width: 100%;
        margin: 0;
        margin-top: auto;
        border-radius: 20px 20px 0 0;
        max-height: 100dvh;
        align-self: flex-end;
    }
    #h2jcookies-root.h2jck-open {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
    .h2jck-header {
        padding: 8px 14px;
        min-height: 40px;
    }
    .h2jck-header__certified {
        font-size: 8px;
    }
    .h2jck-header__brand {
        font-size: 11px;
    }
    .h2jck-header__continue {
        font-size: 11px;
        padding: 4px 6px;
    }
    .h2jck-hero {
        /* Mobile : ratio 4/3 equilibre avec body */
        aspect-ratio: 4 / 3;
    }
    .h2jck-hero__img {
        /* Centre sur le logo iDYLL des images */
        object-position: center 50%;
    }
    .h2jck-modal__body {
        padding: 10px 18px 14px 18px;
    }
    .h2jck-modal__title {
        font-size: 17px;
        margin-bottom: 4px;
    }
    .h2jck-modal__tagline {
        font-size: 12px;
        margin-bottom: 10px;
    }
    .h2jck-modal__paragraph {
        font-size: 12px;
        margin-bottom: 8px;
        line-height: 1.45;
    }
    .h2jck-adult-note {
        margin-top: 10px;
        padding-top: 8px;
        font-size: 10px;
    }
    .h2jck-actions-bar__btn {
        padding: 14px 8px;
        font-size: 13px;
    }
    .h2jck-fab {
        width: 48px;
        height: 48px;
        bottom: 12px;
    }
    .h2jck-fab--bottom-left {
        left: 12px;
    }
    .h2jck-fab--bottom-right {
        right: 12px;
    }
}

/* =============================================================================
   PAGE /cookies-h2j (preferences + history) -- v1.0.27
   Buttons family (.h2jck-btn*) + history table + GDPR rights banner.
   ============================================================================= */

/* --- Buttons family ---
   `btn btn-primary h2jck-btn` = gold solid (CUBX accent via theme-core.css §9)
   `.h2jck-btn--outline`       = gold outline
   `.h2jck-btn--link`          = discreet text link with icon
   `.h2jck-btn--danger-outline`= red outline (delete actions)
   The base `.h2jck-btn` class normalizes padding, font, icon vertical-align.
*/
.h2jck-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--cubx-radius, 6px);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.h2jck-btn:hover { text-decoration: none; }
.h2jck-btn:focus-visible { outline: 2px solid var(--cubx-accent, #c9a227); outline-offset: 2px; }

.h2jck-btn__icon {
    font-size: 18px;
    line-height: 1;
}

/* Outline variant (gold border + gold text + transparent bg) */
.h2jck-btn--outline {
    color: var(--cubx-accent, #c9a227);
    border-color: var(--cubx-accent, #c9a227);
    background: transparent;
}
.h2jck-btn--outline:hover {
    background: var(--cubx-accent, #c9a227);
    color: #fff;
}

/* Link variant (discreet text + arrow icon, no border) */
.h2jck-btn--link {
    color: #666;
    background: transparent;
    padding: 10px 12px;
}
.h2jck-btn--link:hover {
    color: var(--cubx-accent, #c9a227);
    background: rgba(0, 0, 0, 0.03);
}

/* Danger outline (red border + red text, for delete actions) */
.h2jck-btn--danger-outline {
    color: #b71c1c;
    border-color: #ef9a9a;
    background: transparent;
}
.h2jck-btn--danger-outline:hover {
    background: #b71c1c;
    color: #fff;
    border-color: #b71c1c;
}

.h2jck-page {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 32px 40px;
    margin: 0 auto;
    max-width: 920px;
    width: 100%;
    box-sizing: border-box;
}

.h2jck-page__title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
}
.h2jck-page__title-icon {
    color: var(--cubx-accent, #c9a227);
    font-size: 32px;
}

.h2jck-page__intro {
    font-size: 15px;
    color: #555;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.h2jck-page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px 0 24px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 24px;
}
.h2jck-page__actions-spacer {
    flex: 1 1 auto;
}

.h2jck-page__categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Categories accordion (preferences page) --- */
.h2jck-prefs-cat {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px 20px;
}
.h2jck-prefs-cat[open] {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.h2jck-prefs-cat__head {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    list-style: none;
}
.h2jck-prefs-cat__head::-webkit-details-marker {
    display: none;
}
.h2jck-prefs-cat__title {
    flex: 0 0 auto;
}
.h2jck-prefs-cat__count {
    color: #999;
    margin-left: auto;
    font-size: 12px;
}
.h2jck-prefs-cat__badge {
    display: inline-block;
    padding: 2px 10px;
    background: #fff3cd;
    color: #856404;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.h2jck-prefs-cat__badge--essential {
    background: #d1ecf1;
    color: #0c5460;
}
.h2jck-prefs-cat__desc {
    margin: 12px 0 8px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

/* --- Cookies list table (inside category) --- */
.h2jck-prefs-cookies {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
}
.h2jck-prefs-cookies thead th {
    text-align: left;
    padding: 8px 10px;
    color: #777;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}
.h2jck-prefs-cookies tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    color: #444;
}
.h2jck-prefs-cookies tbody tr:last-child td {
    border-bottom: none;
}
.h2jck-prefs-cookies code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #c7254e;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.h2jck-prefs-cookies a {
    color: var(--cubx-accent, #c9a227);
    text-decoration: none;
}
.h2jck-prefs-cookies a:hover {
    text-decoration: underline;
}

/* --- History page specific --- */
.h2jck-history__flash {
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
}
.h2jck-history__flash--success {
    background: #e8f5e9;
    border-left-color: #2e7d32;
}
.h2jck-history__flash--success strong {
    color: #1b5e20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.h2jck-history__flash-icon {
    font-size: 18px;
}
.h2jck-history__flash-detail {
    margin: 6px 0 0;
    color: #555;
    font-size: 13px;
}

.h2jck-history__anon-notice {
    color: #888;
    font-size: 12px;
    font-style: italic;
    margin: 6px 0 16px;
}

.h2jck-history__delete-form {
    margin: 0;
}

.h2jck-history__table-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
.h2jck-history__table-scroll {
    overflow-x: auto;
}
.h2jck-history__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.h2jck-history__table thead {
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}
.h2jck-history__table thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.h2jck-history__table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}
.h2jck-history__table tbody td {
    padding: 12px;
    vertical-align: top;
}
.h2jck-history__date {
    color: #333;
}
.h2jck-history__categories {
    color: #555;
}
.h2jck-history__categories--empty {
    color: #999;
}
.h2jck-history__badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.h2jck-history__badge--accept { background: #e8f5e9; color: #1b5e20; }
.h2jck-history__badge--reject { background: #ffebee; color: #b71c1c; }
.h2jck-history__badge--custom { background: #fff8e1; color: #e65100; }
.h2jck-history__badge--gpc    { background: #e3f2fd; color: #0d47a1; }
.h2jck-history__badge--default{ background: #f5f5f5; color: #555; }

.h2jck-history__empty {
    padding: 60px 20px;
    text-align: center;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    color: #999;
}
.h2jck-history__empty-icon {
    font-size: 48px;
    color: #ccc;
    display: block;
    margin-bottom: 12px;
}
.h2jck-history__empty-title {
    margin: 0 0 8px;
    font-weight: 600;
    color: #666;
}
.h2jck-history__empty-text {
    margin: 0;
    font-size: 13px;
}
.h2jck-history__empty-cta {
    margin: 20px 0 0;
}

.h2jck-history__rights {
    margin-top: 24px;
    padding: 16px;
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    border-radius: 6px;
}
.h2jck-history__rights-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: #0d47a1;
    display: flex;
    align-items: center;
    gap: 6px;
}
.h2jck-history__rights-icon {
    font-size: 18px;
}
.h2jck-history__rights-list {
    margin: 0;
    padding-left: 20px;
    color: #555;
    font-size: 13px;
    line-height: 1.6;
}

/* Responsive mobile : reduce card padding + stack action bar */
@media (max-width: 600px) {
    .h2jck-page {
        padding: 20px 18px;
        border-radius: 12px;
    }
    .h2jck-page__title {
        font-size: 22px;
    }
    .h2jck-page__intro {
        font-size: 14px;
    }
    .h2jck-page__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .h2jck-page__actions-spacer {
        display: none;
    }
    .h2jck-btn {
        justify-content: center;
    }
    .h2jck-prefs-cookies,
    .h2jck-history__table {
        font-size: 12px;
    }
    .h2jck-prefs-cookies thead,
    .h2jck-history__table thead {
        display: none;
    }
    .h2jck-prefs-cookies,
    .h2jck-prefs-cookies tbody,
    .h2jck-prefs-cookies tr,
    .h2jck-prefs-cookies td,
    .h2jck-history__table,
    .h2jck-history__table tbody,
    .h2jck-history__table tr,
    .h2jck-history__table td {
        display: block;
        width: 100%;
    }
    .h2jck-prefs-cookies tr,
    .h2jck-history__table tr {
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #eee;
    }
    .h2jck-prefs-cookies td,
    .h2jck-history__table td {
        padding: 4px 0;
        border: none;
    }
}
