/* AI Book Maker — Cookie Consent */

.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20050;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    opacity: 0;
    transform: translateY(110%);
    transition: opacity .35s ease, transform .35s cubic-bezier(.22, 1, .36, 1);
}

.cookie-consent.is-visible {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.cookie-consent__inner {
    max-width: 1220px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid rgba(228, 221, 211, .95);
    background:
        radial-gradient(ellipse 70% 120% at 0% 100%, rgba(196, 122, 58, .12), transparent 55%),
        linear-gradient(135deg, rgba(255, 255, 255, .98) 0%, rgba(250, 248, 244, .98) 100%);
    backdrop-filter: blur(14px);
    box-shadow:
        0 18px 50px rgba(23, 15, 13, .14),
        0 0 0 1px rgba(112, 57, 9, .04);
}

.cookie-consent__content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.cookie-consent__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #703909, #a06a3a);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(112, 57, 9, .22);
}

.cookie-consent__copy {
    min-width: 0;
}

.cookie-consent__title {
    margin: 0 0 4px;
    font-family: "Space Grotesk", "Manrope", system-ui, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #170f0d;
    letter-spacing: -.01em;
}

.cookie-consent__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #6b5d52;
}

.cookie-consent__text a {
    color: #703909;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(112, 57, 9, .25);
}

.cookie-consent__text a:hover {
    color: #4f2806;
    border-bottom-color: #703909;
}

.cookie-consent__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-consent__btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-family: "Manrope", system-ui, sans-serif;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
    white-space: nowrap;
}

.cookie-consent__btn:focus-visible {
    outline: 2px solid rgba(112, 57, 9, .35);
    outline-offset: 2px;
}

.cookie-consent__btn--ghost {
    border: 1px solid #e4ddd3;
    background: #fff;
    color: #6b5d52;
}

.cookie-consent__btn--ghost:hover {
    border-color: #c4a574;
    color: #170f0d;
    background: #faf8f4;
}

.cookie-consent__btn--primary {
    border: 1px solid transparent;
    background: linear-gradient(135deg, #703909, #4f2806);
    color: #fff;
    box-shadow: 0 10px 24px rgba(112, 57, 9, .22);
}

.cookie-consent__btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(112, 57, 9, .28);
}

/* Preferences modal */
.cookie-preferences {
    position: fixed;
    inset: 0;
    z-index: 20060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
}

.cookie-preferences.is-open {
    display: flex;
}

.cookie-preferences__dialog {
    width: min(520px, 100%);
    max-height: min(90vh, 680px);
    overflow: auto;
    border-radius: 18px;
    border: 1px solid #e4ddd3;
    background: #fff;
    box-shadow: 0 24px 70px rgba(23, 15, 13, .18);
    padding: 22px 22px 18px;
}

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

.cookie-preferences__head h3 {
    margin: 0;
    font-family: "Space Grotesk", "Manrope", system-ui, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #170f0d;
}

.cookie-preferences__close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #f6f3ee;
    color: #6b5d52;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-preferences__intro {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.55;
    color: #6b5d52;
}

.cookie-pref-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid #f0ebe4;
}

.cookie-pref-item:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.cookie-pref-item__copy strong {
    display: block;
    font-size: 14px;
    color: #170f0d;
    margin-bottom: 4px;
}

.cookie-pref-item__copy p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #6b5d52;
}

.cookie-pref-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f6f3ee;
    color: #703909;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.cookie-pref-toggle {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.cookie-pref-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-pref-toggle span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #e4ddd3;
    transition: background .2s ease;
    cursor: pointer;
}

.cookie-pref-toggle span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    transition: transform .2s ease;
}

.cookie-pref-toggle input:checked + span {
    background: #703909;
}

.cookie-pref-toggle input:checked + span::after {
    transform: translateX(20px);
}

.cookie-pref-toggle input:disabled + span {
    opacity: .65;
    cursor: not-allowed;
}

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

@media (max-width: 900px) {
    .cookie-consent__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .cookie-consent__actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .cookie-consent__btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 140px;
        justify-content: center;
    }

    .cookie-consent__btn--primary {
        flex-basis: 100%;
    }
}

@media (max-width: 520px) {
    .cookie-consent {
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .cookie-consent__inner {
        border-radius: 14px;
    }

    .cookie-consent__icon {
        width: 36px;
        height: 36px;
        font-size: 15px;
        border-radius: 10px;
    }

    .cookie-consent__title {
        font-size: 14px;
    }

    .cookie-consent__text {
        font-size: 12px;
    }

    .cookie-consent__actions {
        flex-direction: column;
    }

    .cookie-consent__btn {
        width: 100%;
        flex: none;
    }

    .cookie-preferences__actions {
        flex-direction: column;
    }

    .cookie-preferences__actions .cookie-consent__btn {
        width: 100%;
    }
}
