/* ============================================================
   Cookie Consent - RGPD / UE
   Banner minimalista, responsive y accesible para PuntoCar.
   ============================================================ */

.cookie-consent {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 24px;
    z-index: 100000;
    width: min(940px, calc(100% - 32px));
    padding: 18px;
    color: #1f2933;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(31, 41, 51, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
    transform: translate(-50%, 18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}

.cookie-consent .sr-only,
.cookie-preferences .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cookie-consent.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

.cookie-consent__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
}

.cookie-consent__title {
    margin: 0 0 6px;
    color: #111827;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.cookie-consent__text {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.55;
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.cookie-consent__button,
.cookie-preferences__button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.cookie-consent__button:hover,
.cookie-preferences__button:hover {
    border-color: #9aa5b1;
    background: #f7f8fa;
}

.cookie-consent__button:focus-visible,
.cookie-preferences__button:focus-visible,
.cookie-preferences__close:focus-visible,
.cookie-preferences__switch input:focus-visible + span {
    outline: 3px solid rgba(218, 38, 38, 0.28);
    outline-offset: 2px;
}

.cookie-consent__button--primary,
.cookie-preferences__button--primary {
    border-color: #da2626;
    background: #da2626;
    color: #ffffff;
}

.cookie-consent__button--primary:hover,
.cookie-preferences__button--primary:hover {
    border-color: #bb0000;
    background: #bb0000;
    color: #ffffff;
}

.cookie-preferences {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(17, 24, 39, 0.52);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.cookie-preferences.is-visible {
    opacity: 1;
    visibility: visible;
}

.cookie-preferences__dialog {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 24px;
    color: #1f2933;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
    transform: translateY(12px);
    transition: transform 0.24s ease;
}

.cookie-preferences.is-visible .cookie-preferences__dialog {
    transform: translateY(0);
}

.cookie-preferences__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cookie-preferences__title {
    margin: 0;
    color: #050505;
    font-size: 26px;
    font-weight: 900;
    line-height: 1.25;
}

.cookie-preferences__close {
    width: 36px;
    height: 36px;
    border: 1px solid #d8dee5;
    border-radius: 6px;
    background: #ffffff;
    color: #4b5563;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.cookie-preferences__text {
    margin: 0 0 18px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.55;
}

.cookie-preferences__category {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #e5e9ee;
}

.cookie-preferences__category h3 {
    margin: 0 0 4px;
    color: #050505;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.3;
}

.cookie-preferences__category p {
    margin: 0;
    color: #5b6673;
    font-size: 13px;
    line-height: 1.45;
}

.cookie-preferences__required {
    color: #5b6673;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.cookie-preferences__switch {
    position: relative;
    display: inline-flex;
    width: 50px;
    height: 28px;
}

.cookie-preferences__switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cookie-preferences__switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cfd6dd;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cookie-preferences__switch span::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.cookie-preferences__switch input:checked + span {
    background: #da2626;
}

.cookie-preferences__switch input:checked + span::before {
    transform: translateX(22px);
}

.cookie-preferences__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid #e5e9ee;
}

@media (max-width: 760px) {
    .cookie-consent {
        bottom: 12px;
        width: calc(100% - 24px);
        padding: 16px;
    }

    .cookie-consent__inner {
        grid-template-columns: 1fr;
    }

    .cookie-consent__actions,
    .cookie-preferences__actions {
        justify-content: stretch;
    }

    .cookie-consent__button,
    .cookie-preferences__button {
        flex: 1 1 100%;
    }

    .cookie-preferences {
        align-items: flex-end;
        padding: 12px;
    }

    .cookie-preferences__dialog {
        max-height: calc(100vh - 24px);
        padding: 20px;
    }

    .cookie-preferences__category {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent,
    .cookie-preferences,
    .cookie-preferences__dialog,
    .cookie-preferences__switch span,
    .cookie-preferences__switch span::before {
        transition: none;
    }
}
