/* Cookie consent — Coneduka
   Regla: overflow-x prohibido; textos con minmax(0,1fr) + overflow-wrap;
   botones apilados en móvil; verificar 375px antes de dar por bueno. */

.cookies-consent,
.cookies-consent *,
.cookies-consent *::before,
.cookies-consent *::after {
    box-sizing: border-box;
}

body.cookies-modal-shown {
    overflow: hidden;
}

.cookies-consent {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: "Josefin Sans", system-ui, sans-serif;
}

.cookies-consent.hidden {
    display: none !important;
}

.cookies-consent__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 33, 68, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cookies-fade-in 0.35s ease both;
}

.cookies-consent__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: min(520px, 100%);
    max-height: min(92vh, 740px);
    margin: 0;
    padding: 1.1rem 1.15rem calc(1rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: contain;
    background: linear-gradient(180deg, #fffef7 0%, #fff8e8 55%, #fff4dc 100%);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -12px 40px rgba(30, 33, 68, 0.18);
    animation: cookies-slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cookies-consent__glow {
    position: absolute;
    top: -40px;
    left: 50%;
    width: min(180px, 50vw);
    height: 180px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(254, 211, 99, 0.55) 0%, rgba(254, 211, 99, 0) 70%);
    pointer-events: none;
}

.cookies-consent__body {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cookies-consent__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
    width: 100%;
    min-width: 0;
}

.cookies-consent__mascot {
    position: relative;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

.cookies-consent__cookie {
    width: 100%;
    height: 100%;
    display: block;
    animation: cookies-bob 2.8s ease-in-out infinite;
    filter: drop-shadow(0 8px 14px rgba(122, 63, 36, 0.22));
}

.cookies-consent__face {
    transform-origin: 58px 58px;
    animation: cookies-wiggle 3.4s ease-in-out infinite;
}

.cookies-consent__crumb {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e8a35a;
    box-shadow: inset -2px -2px 0 #c8843d;
    opacity: 0.9;
}

.cookies-consent__crumb--1 {
    top: 8px;
    right: 4px;
    animation: cookies-crumb 2.2s ease-in-out infinite;
}

.cookies-consent__crumb--2 {
    top: 22px;
    left: 2px;
    width: 7px;
    height: 7px;
    animation: cookies-crumb 2.6s ease-in-out 0.4s infinite;
}

.cookies-consent__crumb--3 {
    bottom: 14px;
    right: 10px;
    width: 8px;
    height: 8px;
    animation: cookies-crumb 2.4s ease-in-out 0.8s infinite;
}

.cookies-consent__intro {
    width: 100%;
    min-width: 0;
}

.cookies-consent__title {
    margin: 0;
    color: #1e2144;
    font-size: clamp(1.05rem, 4.2vw, 1.22rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cookies-consent__title--sm {
    font-size: clamp(1rem, 3.8vw, 1.1rem);
    margin-bottom: 0.75rem;
    text-align: center;
}

.cookies-consent__text {
    margin: 0.45rem 0 0;
    padding: 0 0.15rem;
    color: rgba(30, 33, 68, 0.72);
    font-size: 0.88rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-height: 28vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cookies-consent__text a {
    color: #f26743;
    text-decoration: underline;
    font-weight: 600;
}

.cookies-consent__step {
    width: 100%;
    min-width: 0;
}

.cookies-consent__step--prefs {
    padding-top: 0.15rem;
}

.cookies-consent__prefs {
    display: grid;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
}

.cookies-consent__pref {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(30, 33, 68, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cookies-consent__pref:hover {
    border-color: rgba(242, 103, 67, 0.35);
    box-shadow: 0 6px 18px rgba(30, 33, 68, 0.06);
}

.cookies-consent__pref-row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    column-gap: 0.7rem;
    align-items: start;
    width: 100%;
    min-width: 0;
}

.cookies-consent__switch {
    position: relative;
    display: block;
    width: 46px;
    height: 28px;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.cookies-consent__switch .cookies-checkbox {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.cookies-consent__prefs .check {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background-color: #d9a0a0;
    transition: background-color 0.2s ease;
    pointer-events: none;
}

.cookies-consent__prefs .check:before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(30, 33, 68, 0.18);
    transition: left 0.2s ease;
}

.cookies-consent__prefs input[type="checkbox"]:disabled + .check {
    background-color: #9aa0b5;
}

.cookies-consent__prefs input[type="checkbox"]:checked + .check {
    background-color: #ff742e;
}

.cookies-consent__prefs input[type="checkbox"]:checked + .check:before {
    left: 21px;
}

.cookies-consent__prefs input[type="checkbox"]:disabled {
    cursor: default;
}

.cookies-consent__pref-copy {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.cookies-consent__pref-name {
    display: block;
    color: #1e2144;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cookies-consent__pref-desc {
    display: block;
    margin: 0.35rem 0 0;
    color: rgba(30, 33, 68, 0.62);
    font-size: 0.8rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cookies-consent__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(30, 33, 68, 0.08);
}

.cookies-btn {
    appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cookies-btn:active {
    transform: scale(0.98);
}

.cookies-btn--primary {
    order: 1;
    background: #ff742e;
    color: #fffef7;
    border-color: #ff742e;
    box-shadow: 0 8px 18px rgba(255, 116, 46, 0.28);
}

.cookies-btn--primary:hover {
    background: #f26743;
    border-color: #f26743;
}

.cookies-btn--soft {
    order: 2;
    background: rgba(30, 33, 68, 0.06);
    color: #1e2144;
    border-color: rgba(30, 33, 68, 0.08);
}

.cookies-btn--soft:hover {
    background: rgba(30, 33, 68, 0.1);
}

.cookies-btn--ghost {
    order: 3;
    background: transparent;
    color: #1e2144;
    border-color: rgba(30, 33, 68, 0.22);
}

.cookies-btn--ghost:hover {
    background: rgba(30, 33, 68, 0.04);
}

.cookies-btn.hidden,
.cookies-consent__step.hidden {
    display: none !important;
}

@keyframes cookies-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cookies-slide-up {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cookies-bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes cookies-wiggle {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(-3deg); }
    60% { transform: rotate(3deg); }
}

@keyframes cookies-crumb {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.85; }
    50% { transform: translateY(-6px) scale(1.08); opacity: 1; }
}

/* Tablet+ : tarjeta centrada; botones en fila solo con hueco de verdad */
@media (min-width: 768px) {
    .cookies-consent {
        align-items: center;
        padding: 1.5rem;
    }

    .cookies-consent__panel {
        border-radius: 28px;
        padding: 1.5rem 1.4rem 1.3rem;
        box-shadow: 0 24px 60px rgba(30, 33, 68, 0.22);
        animation-name: cookies-pop-in;
    }

    .cookies-consent__hero {
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 1.15rem;
    }

    .cookies-consent__mascot {
        width: 112px;
        height: 112px;
    }

    .cookies-consent__title {
        font-size: 1.4rem;
    }

    .cookies-consent__text {
        font-size: 0.98rem;
    }

    .cookies-consent__title--sm {
        text-align: left;
        font-size: 1.25rem;
    }

    .cookies-consent__actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .cookies-btn {
        flex: 1 1 calc(33.333% - 0.5rem);
        min-width: 0;
    }

    .cookies-btn--ghost { order: 1; }
    .cookies-btn--soft { order: 2; }
    .cookies-btn--primary { order: 3; }
}

@keyframes cookies-pop-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookies-consent__backdrop,
    .cookies-consent__panel,
    .cookies-consent__cookie,
    .cookies-consent__face,
    .cookies-consent__crumb {
        animation: none !important;
    }
}
