/* ============================================================================
   Cookie Consent Banner & Settings Modal
   ============================================================================ */

/* Banner Styles */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-elevated, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    /* Prevent layout shift */
    will-change: transform;
    transform: translateZ(0);
}

@keyframes slideUp {
    from {
        transform: translateY(100%) translateZ(0);
        opacity: 0;
    }
    to {
        transform: translateY(0) translateZ(0);
        opacity: 1;
    }
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-consent-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary, #111827);
}

.cookie-consent-text p {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    color: var(--text-secondary, #6b7280);
}

.cookie-consent-text a {
    color: var(--primary-color, #3b82f6);
    text-decoration: underline;
}

.cookie-consent-text a:hover {
    color: var(--primary-hover, #2563eb);
}

.cookie-consent-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-consent-actions .btn {
    white-space: nowrap;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

/* Settings Modal - только специфичные стили */
.cookie-settings-intro {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 1.5rem;
}

.cookie-category {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: var(--surface, #ffffff);
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.cookie-category-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cookie-category h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #111827);
}

.cookie-category-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface-secondary, #f3f4f6);
    color: var(--text-secondary, #6b7280);
    border-radius: 4px;
}

.cookie-category-description {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color, #e5e7eb);
    border-radius: 24px;
    transition: background-color 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color, #3b82f6);
}

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

/* Hide trigger when banner is visible */
.cookie-consent-banner:not([style*="display: none"]) ~ [data-cookie-settings] {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 1rem;
    }
    
    .cookie-consent-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .cookie-consent-actions {
        flex-direction: column;
    }
    
    .cookie-consent-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-category {
        padding: 1rem;
    }
    
    .cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .cookie-consent-banner {
    background: var(--surface-elevated-dark, #1f2937);
    border-top-color: var(--border-color-dark, #374151);
}

[data-theme="dark"] .cookie-consent-text h3 {
    color: var(--text-primary-dark, #f9fafb);
}

[data-theme="dark"] .cookie-consent-text p {
    color: var(--text-secondary-dark, #d1d5db);
}

[data-theme="dark"] .cookie-category {
    background: var(--surface-dark, #111827);
    border-color: var(--border-color-dark, #374151);
}

[data-theme="dark"] .cookie-category h3 {
    color: var(--text-primary-dark, #f9fafb);
}

[data-theme="dark"] .cookie-category-description,
[data-theme="dark"] .cookie-settings-intro {
    color: var(--text-secondary-dark, #d1d5db);
}

/* Accessibility */
.cookie-consent-banner:focus-within {
    outline: 2px solid var(--primary-color, #3b82f6);
    outline-offset: 2px;
}

.toggle-switch:focus-within .toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Print Styles */
@media print {
    .cookie-consent-banner,
    .modal[id="cookie-settings-modal"] {
        display: none !important;
    }
}
