.cookie-consent[hidden],
.cookie-preferences[hidden] {
    display: none !important;
}

.cookie-consent {
    position: fixed;
    z-index: 3000;
    right: 22px;
    bottom: max(22px, env(safe-area-inset-bottom));
    left: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.97);
    color: #ffffff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.3);
}

.cookie-consent-text {
    max-width: 700px;
}

.cookie-consent-text strong {
    display: block;
    margin-bottom: 6px;
    font-size: 17px;
}

.cookie-consent-text p {
    margin: 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.55;
}

.cookie-consent-text a {
    color: #93c5fd;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookie-consent-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
}

.cookie-button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #475569;
    border-radius: 11px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.cookie-button:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.cookie-button:active {
    transform: translateY(0);
}

.cookie-button:focus-visible,
.cookie-close:focus-visible,
.cookie-settings-link:focus-visible,
.cookie-category input:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

.cookie-button-primary {
    border-color: #2563eb;
    background: #2563eb;
}

.cookie-button-primary:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

.cookie-button-light {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #0f172a;
}

.cookie-button-light:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.cookie-preferences {
    position: fixed;
    z-index: 3100;
    inset: 0;
    display: grid;
    place-items: center;
    padding:
        max(20px, env(safe-area-inset-top))
        max(20px, env(safe-area-inset-right))
        max(20px, env(safe-area-inset-bottom))
        max(20px, env(safe-area-inset-left));
}

.cookie-preferences-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.cookie-preferences-dialog {
    position: relative;
    width: min(100%, 610px);
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
    overscroll-behavior: contain;
    padding: 28px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.35);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cookie-preferences-dialog::-webkit-scrollbar {
    width: 8px;
}

.cookie-preferences-dialog::-webkit-scrollbar-track {
    background: transparent;
}

.cookie-preferences-dialog::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}

.cookie-preferences-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.cookie-preferences-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 26px;
    line-height: 1.2;
}

.cookie-preferences-heading p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.55;
}

.cookie-close {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #0f172a;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.cookie-close:hover {
    background: #dbeafe;
    transform: rotate(3deg);
}

.cookie-close:active {
    transform: rotate(0);
}

.cookie-category {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 18px 0;
    border-top: 1px solid #e2e8f0;
}

label.cookie-category {
    cursor: pointer;
}

.cookie-category strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
}

.cookie-category p,
.cookie-category-description {
    display: block;
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.cookie-category input {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
}

.cookie-required {
    flex-shrink: 0;
    color: #16a34a;
    font-size: 12px;
    font-weight: 800;
}

.cookie-preferences-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.cookie-settings-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookie-settings-link:hover {
    text-decoration-thickness: 2px;
}

@media (max-width: 800px) {
    .cookie-consent {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 12px;
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        padding: 18px;
        border-radius: 16px;
    }

    .cookie-consent-actions,
    .cookie-preferences-actions {
        justify-content: stretch;
    }

    .cookie-button {
        flex: 1 1 140px;
    }
}

@media (max-width: 520px) {
    .cookie-preferences {
        padding:
            max(12px, env(safe-area-inset-top))
            max(12px, env(safe-area-inset-right))
            max(12px, env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left));
    }

    .cookie-preferences-dialog {
        max-height: calc(100vh - 24px);
        padding: 22px 18px;
        border-radius: 18px;
    }

    .cookie-preferences-heading h2 {
        font-size: 22px;
    }

    .cookie-category {
        gap: 14px;
    }

    .cookie-preferences-actions {
        flex-direction: column;
    }

    .cookie-preferences-actions .cookie-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-button,
    .cookie-close {
        transition: none;
    }
}