:root {
    --cookie-primary: #007AFF;
    --cookie-primary-hover: #0051D5;
    --cookie-secondary: #8E8E93;
    --cookie-text: #1D1D1F;
    --cookie-text-secondary: #86868B;
    --cookie-bg: rgba(255, 255, 255, 0.72);
    --cookie-bg-solid: #FBFBFD;
    --cookie-overlay: rgba(0, 0, 0, 0.4);
    --cookie-border: rgba(0, 0, 0, 0.04);
    --cookie-success: #34C759;
    --cookie-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

@supports (backdrop-filter: blur(20px)) {
    :root {
        --cookie-bg: rgba(255, 255, 255, 0.72);
    }
}

* {
    box-sizing: border-box;
}

.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--cookie-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: var(--cookie-shadow);
    z-index: 99999;
    padding: 24px;
    transform: translateY(calc(100% + 40px));
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 20px;
    border: 1px solid var(--cookie-border);
}

@supports not (backdrop-filter: blur(20px)) {
    .cookie-banner {
        background: var(--cookie-bg-solid);
    }
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.cookie-banner h2 {
    margin: 0 0 12px 0;
    font-size: 22px;
    color: var(--cookie-text);
    font-weight: 600;
    letter-spacing: -0.022em;
    line-height: 1.18;
}

.cookie-banner p {
    margin: 0 0 24px 0;
    color: var(--cookie-text-secondary);
    line-height: 1.47;
    font-size: 15px;
    letter-spacing: -0.016em;
}

.cookie-categories {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cookie-category {
    background: rgba(255, 255, 255, 0.5);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.cookie-category:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

.cookie-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.cookie-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-slider {
    position: relative;
    width: 51px;
    height: 31px;
    background: rgba(120, 120, 128, 0.16);
    border-radius: 16px;
    transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
}

.cookie-toggle input:checked + .toggle-slider {
    background: var(--cookie-success);
}

.cookie-toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.cookie-toggle input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-toggle:active input:not(:disabled) + .toggle-slider::before {
    width: 31px;
}

.cookie-toggle:active input:checked:not(:disabled) + .toggle-slider::before {
    transform: translateX(16px);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.toggle-label strong {
    color: var(--cookie-text);
    font-size: 15px;
    font-weight: 590;
    margin-bottom: 2px;
    letter-spacing: -0.016em;
}

.toggle-label small {
    color: var(--cookie-text-secondary);
    font-size: 13px;
    line-height: 1.38;
    font-weight: 400;
    letter-spacing: -0.008em;
}

.cookie-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 11px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 510;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-width: 120px;
    letter-spacing: -0.016em;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

.btn-primary {
    background: var(--cookie-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--cookie-primary-hover);
    transform: scale(1.01);
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-secondary {
    background: rgba(120, 120, 128, 0.12);
    color: var(--cookie-primary);
    border: none;
}

.btn-secondary:hover {
    background: rgba(120, 120, 128, 0.18);
}

.btn-secondary:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.cookie-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.cookie-links a {
    color: var(--cookie-primary);
    text-decoration: none;
    font-size: 13px;
    transition: opacity 0.2s;
    font-weight: 400;
    letter-spacing: -0.008em;
}

.cookie-links a:hover {
    opacity: 0.7;
}

.cookie-links a:active {
    opacity: 0.5;
}


@media (max-width: 768px) {
    .cookie-banner {
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        max-height: 85vh;
    }
    
    .cookie-banner h2 {
        font-size: 20px;
    }
    
    .cookie-banner p {
        font-size: 15px;
    }
    
    .cookie-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
    }
    
    .cookie-links {
        flex-direction: column;
        gap: 12px;
    }
}

@media (min-width: 769px) {
    .cookie-banner {
        max-width: 640px;
        left: 50%;
        transform: translateX(-50%) translateY(calc(100% + 40px));
    }
    
    .cookie-banner.show {
        transform: translateX(-50%) translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-banner,
    .toggle-slider,
    .toggle-slider::before,
    .btn {
        transition: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --cookie-primary: #0A84FF;
        --cookie-primary-hover: #409CFF;
        --cookie-text: #F5F5F7;
        --cookie-text-secondary: #A1A1A6;
        --cookie-bg: rgba(30, 30, 30, 0.72);
        --cookie-bg-solid: #1C1C1E;
        --cookie-border: rgba(255, 255, 255, 0.08);
        --cookie-success: #30D158;
        --cookie-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    
    .cookie-category {
        background: rgba(58, 58, 60, 0.5);
        border-color: rgba(255, 255, 255, 0.06);
    }
    
    .cookie-category:hover {
        background: rgba(58, 58, 60, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .toggle-slider {
        background: rgba(120, 120, 128, 0.24);
    }
    
    .btn-secondary {
        background: rgba(120, 120, 128, 0.24);
        color: var(--cookie-primary);
    }
    
    .btn-secondary:hover {
        background: rgba(120, 120, 128, 0.32);
    }
    
    .cookie-links {
        border-top-color: rgba(255, 255, 255, 0.06);
    }
}

.cookie-toggle:focus-within .toggle-slider {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
}

.cookie-links a:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
    border-radius: 4px;
}

.cookie-banner {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.cookie-banner::-webkit-scrollbar {
    width: 8px;
}

.cookie-banner::-webkit-scrollbar-track {
    background: transparent;
}

.cookie-banner::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.cookie-banner::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    .cookie-banner::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .cookie-banner::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

.cookie-settings-fab {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2147483640;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: none;
    background: #111111;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
}

.cookie-settings-fab:hover,
.cookie-settings-fab:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    opacity: 1;
    background: #222222;
    outline: none;
}

.cookie-settings-fab svg {
    pointer-events: none;
}

@media (max-width: 480px) {
    .cookie-settings-fab {
        left: 12px;
        bottom: 12px;
        width: 44px;
        height: 44px;
    }
}
