#cookie-modal {
    max-width: 640px;
    width: 100%;
    border-radius: 10px;
    background: #f2f1ee;
    padding: 30px;
    z-index: 10000000000;
    position: fixed;
    top: 50%;
    left: 50%;
    height: fit-content;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 1s ease, opacity 0.6s ease;
    opacity: 0;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    overflow: hidden;
}

#cookie-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    /* soft gradient that mimics the fold/edge */
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.22) 0%,
        rgba(0, 0, 0, 0.12) 6%,
        rgba(255, 255, 255, 0.06) 10%,
        rgba(0, 0, 0, 0) 22%
    );
    opacity: 0;
    transform: translateZ(1px);
    /* sits slightly above content for a crisp edge */
}

/* Trigger: page turn IN (open from left like a book) */
#cookie-modal.show-cookie {
    animation: pageTurnIn 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

#cookie-modal.show-cookie::before {
    animation: pageShadeIn 2s ease forwards;
}

/* Trigger: page turn OUT (close to right like flipping over) */
#cookie-modal.hide-cookie {
    animation: pageTurnOut 2s cubic-bezier(0.55, 0.05, 0.55, 0.95) forwards;
}

#cookie-modal.hide-cookie::before {
    animation: pageShadeOut 2s ease forwards;
}

/* === Keyframes (keep your translate(-50%,-50%) centering) === */
@keyframes pageTurnIn {
    0% {
        transform-origin: 0 50%;
        /* left spine */
        transform: translate(-50%, -50%) perspective(1400px) rotateY(-92deg);
        opacity: 0;
        filter: blur(6px);
    }

    55% {
        transform-origin: 0 50%;
        transform: translate(-50%, -50%) perspective(1400px) rotateY(12deg);
        opacity: 1;
        filter: blur(0.5px);
    }

    100% {
        transform-origin: 0 50%;
        transform: translate(-50%, -50%) perspective(1400px) rotateY(0deg);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes pageTurnOut {
    0% {
        transform-origin: 100% 50%;
        /* right spine */
        transform: translate(-50%, -50%) perspective(1400px) rotateY(0deg);
        opacity: 1;
        filter: blur(0);
    }

    35% {
        transform-origin: 100% 50%;
        transform: translate(-50%, -50%) perspective(1400px) rotateY(-10deg);
        opacity: 0.92;
    }

    100% {
        transform-origin: 100% 50%;
        transform: translate(-50%, -50%) perspective(1400px) rotateY(92deg);
        opacity: 0;
        filter: blur(6px);
    }
}

/* Page-edge shadow animations */
@keyframes pageShadeIn {
    0% {
        opacity: 0.35;
        background-position: left;
    }

    60% {
        opacity: 0.18;
    }

    100% {
        opacity: 0;
    }
}

@keyframes pageShadeOut {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 0.18;
    }

    100% {
        opacity: 0.35;
    }
}

#cookie-modal .modal-close {
    display: flex;
    width: 34px;
    height: 34px;
    padding: 7px;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    border: none;
    background: none;
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    display: none;
}

#cookie-modal .modal-close svg path {
    stroke: white;
}

/* Content section */
#cookie-modal .content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#cookie-modal .icon-text-wrapper {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

#cookie-modal .content .icon {
    display: flex;
    max-width: 46px;
    width: 100%;
    height: auto;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#cookie-modal .content .icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#cookie-modal .content .cookie-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 30px;
    color: #000;
}

#cookie-modal .content .cookie-desc {
    width: 100%;
    color: #414141;
    font-size: 14px;
    font-weight: 400;
    line-height: 150%;
}

#cookie-modal .content .cookie-desc a {
    color: #414141;
    text-decoration: underline;
    font-weight: 700;
}

.terms-text-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    display: none;
}

.terms-text-wrapper .check-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
}

.terms-text-wrapper .terms-text {
    color: #414141;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 115%;
}

#cookie-modal .action-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

#cookie-modal .action-wrapper .cookie-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
    padding: 5px 20px !important;
    gap: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    width: fit-content;
}

#cookie-modal .action-wrapper .cookie-btn:active {
    transform: scale(0.97);
}

#cookie-modal .action-wrapper .cookie-btn:hover {
    transform: scale(0.97);
}

#cookie-modal .action-wrapper .cookie-btn img {
    flex-shrink: 0;
}

#decline-cookie {
    border: none;
    background: #fff;
    color: #000;
}

#cookie-button {
    background: #ff510e !important;
    color: #fff;
    border: none;
}

#cookie-button:hover img {
    transform: rotate(50deg);
}

@media screen and (max-width: 1024px) {
    #cookie-modal {
        width: 95%;
    }

    #cookie-modal .content {
        text-align: left;
    }
}

@media screen and (max-width: 540px) {
    #cookie-modal {
        max-width: 100%;
    }

    #cookie-modal .action-wrapper {
        flex-wrap: wrap;
    }

    #cookie-modal .action-wrapper .cookie-btn {
        width: 100%;
    }

    .icon-text-wrapper {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
    }

    .cookie-desc {
        text-align: center;
    }
}
