/*
 * CodeLemon_CookieConsent banner critical CSS.
 *
 * Performance constraints:
 *  - content-visibility: auto keeps the banner off the rendering critical
 *    path until visible. Browsers that don't support it (Safari ≤ 16) fall
 *    back to normal block rendering.
 *  - contain-intrinsic-size reserves layout space so CV: auto doesn't
 *    cause layout shift.
 *  - No background-image, no @font-face — banner inherits site fonts.
 *  - The 3 buttons are styled identically (AEPD requirement: equal visual
 *    weight). No `.secondary` modifier. No outline / ghost variant.
 *
 * Loaded via Hyva's pub/static/frontend.../web/css path; CSP-safe (no
 * inline styles in the wrapper template).
 */

.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: #ffffff;
    color: #1f2937;
    border-top: 1px solid #d1d5db;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    padding: 1.25rem 1.5rem;
    content-visibility: auto;
    contain-intrinsic-size: 0 320px;
}

.cookie-consent-banner__inner {
    max-width: 64rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cookie-consent-banner__heading {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.cookie-consent-banner__body {
    font-size: 0.9375rem;
    line-height: 1.55;
    margin: 0;
}

.cookie-consent-banner__link-row {
    margin: 0;
    font-size: 0.875rem;
}

.cookie-consent-banner__link {
    color: #1d4ed8;
    text-decoration: underline;
}

.cookie-consent-banner__link:hover {
    text-decoration: none;
}

.cookie-consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

/*
 * AEPD-compliant: all three buttons share the SAME class and SAME styling.
 * Do NOT introduce a `.cookie-consent-banner__btn--secondary` variant for
 * Reject — that would re-create the "subtly nudge user to Accept" pattern
 * AEPD prohibits.
 */
.cookie-consent-banner__btn {
    flex: 1 1 0;
    min-width: 9rem;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    background: #111827;
    border: 1px solid #111827;
    border-radius: 0.375rem;
    cursor: pointer;
    text-align: center;
    transition: background 120ms ease-in-out, border-color 120ms ease-in-out;
}

.cookie-consent-banner__btn:hover {
    background: #1f2937;
    border-color: #1f2937;
}

.cookie-consent-banner__btn:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

[x-cloak] {
    display: none !important;
}

@media (max-width: 640px) {
    .cookie-consent-banner__actions {
        flex-direction: column;
    }

    .cookie-consent-banner__btn {
        flex: 1 1 auto;
        width: 100%;
    }
}

/*
 * Preferences modal.
 *
 * Higher z-index than the banner. content-visibility is NOT applied here
 * because once the modal is open it needs to render normally; the modal
 * also lives outside the rendering critical path because Alpine only
 * shows it on event.
 */
.cookie-consent-preferences {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-consent-preferences__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.cookie-consent-preferences__panel {
    position: relative;
    width: min(720px, 92vw);
    max-height: 86vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.cookie-consent-preferences__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.cookie-consent-preferences__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.cookie-consent-preferences__close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.cookie-consent-preferences__body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookie-consent-preferences__intro {
    margin: 0;
    color: #4b5563;
    font-size: 0.9375rem;
}

.cookie-consent-preferences__group {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.875rem 1rem;
}

.cookie-consent-preferences__group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-consent-preferences__group-meta {
    flex: 1 1 auto;
}

.cookie-consent-preferences__group-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.cookie-consent-preferences__group-desc {
    margin: 0.25rem 0 0;
    color: #4b5563;
    font-size: 0.875rem;
}

.cookie-consent-preferences__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.cookie-consent-preferences__toggle input[disabled] {
    opacity: 0.7;
}

.cookie-consent-preferences__group-details {
    margin-top: 0.75rem;
}

.cookie-consent-preferences__group-summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: #1d4ed8;
}

.cookie-consent-preferences__cookies {
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    border-collapse: collapse;
}

.cookie-consent-preferences__cookies th,
.cookie-consent-preferences__cookies td {
    border: 1px solid #e5e7eb;
    padding: 0.4rem 0.6rem;
    text-align: left;
    vertical-align: top;
}

.cookie-consent-preferences__cookies thead th {
    background: #f3f4f6;
    font-weight: 600;
}

.cookie-consent-preferences__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.cookie-consent-preferences__footer .cookie-consent-banner__btn {
    flex: 1 1 0;
    min-width: 9rem;
}

@media (max-width: 640px) {
    .cookie-consent-preferences__footer {
        flex-direction: column;
    }

    .cookie-consent-preferences__footer .cookie-consent-banner__btn {
        width: 100%;
    }

    .cookie-consent-preferences__cookies th,
    .cookie-consent-preferences__cookies td {
        font-size: 0.75rem;
        padding: 0.3rem 0.4rem;
    }
}
