/* ===================================
   Cookie Consent Banner & Settings
   WCAG 2.1 AA Compliant
   =================================== */

/* Banner */
#cookieBanner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a1a;
    color: #fff;
    padding: 1.5rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

#cookieBanner.visible {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cookie-banner-text p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.5;
    margin: 0;
}

.cookie-banner-text a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-banner-text a:hover,
.cookie-banner-text a:focus {
    color: #c0003a;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Buttons - WCAG contrast compliant */
.cookie-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-height: 44px; /* WCAG touch target */
    min-width: 44px;
}

.cookie-btn:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.cookie-btn-primary {
    background: #c0003a;
    color: #fff;
    border-color: #c0003a;
}

.cookie-btn-primary:hover {
    background: #a00030;
    border-color: #a00030;
}

.cookie-btn-secondary {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.cookie-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.cookie-btn-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0.5rem;
}

.cookie-btn-link:hover {
    color: #fff;
}

/* Settings Modal */
#cookieSettings {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

#cookieSettings.visible {
    opacity: 1;
    visibility: visible;
}

.cookie-settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
}

.cookie-settings-modal {
    position: relative;
    background: #fff;
    color: #1a1a1a;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s;
}

#cookieSettings.visible .cookie-settings-modal {
    transform: scale(1);
}

.cookie-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e5e7;
}

.cookie-settings-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.cookie-settings-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #86868b;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.cookie-settings-close:hover {
    background: #f5f5f7;
    color: #1a1a1a;
}

.cookie-settings-close:focus {
    outline: 3px solid #c0003a;
    outline-offset: 2px;
}

.cookie-settings-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.cookie-category {
    padding: 1rem 0;
    border-bottom: 1px solid #e5e5e7;
}

.cookie-category:last-child {
    border-bottom: none;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.cookie-category-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.cookie-category-info p {
    font-size: 0.85rem;
    color: #86868b;
    margin: 0;
    line-height: 1.5;
}

/* Custom Toggle Switch - WCAG compliant */
.cookie-toggle {
    position: relative;
    flex-shrink: 0;
}

.cookie-toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.cookie-toggle-slider {
    display: block;
    width: 52px;
    height: 32px;
    background: #e5e5e7;
    border-radius: 16px;
    position: relative;
    transition: background 0.2s;
}

.cookie-toggle-slider::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #c0003a;
}

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

.cookie-toggle input:focus + .cookie-toggle-slider {
    outline: 3px solid #c0003a;
    outline-offset: 2px;
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background: #c0003a;
    opacity: 0.6;
    cursor: not-allowed;
}

.cookie-settings-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e5e7;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.cookie-settings-footer .cookie-btn-primary {
    background: #c0003a;
    color: #fff;
}

.cookie-settings-footer .cookie-btn-secondary {
    background: #f5f5f7;
    color: #1a1a1a;
    border-color: #e5e5e7;
}

.cookie-settings-footer .cookie-btn-secondary:hover {
    background: #e5e5e7;
}

/* Footer link to reopen settings */
.cookie-settings-link {
    cursor: pointer;
    text-decoration: underline;
}

.cookie-settings-link:hover {
    color: #c0003a;
}

/* Responsive */
@media (max-width: 768px) {
    #cookieBanner {
        padding: 1rem;
    }
    
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cookie-banner-text {
        min-width: auto;
    }
    
    .cookie-banner-actions {
        flex-direction: column;
    }
    
    .cookie-btn {
        width: 100%;
        text-align: center;
    }
    
    .cookie-settings-modal {
        width: 95%;
        max-height: 95vh;
    }
}

/* Skip Link for Screen Readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #c0003a;
    color: #fff;
    padding: 8px 16px;
    z-index: 10001;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #c0003a;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #cookieBanner,
    .cookie-settings-modal,
    .cookie-toggle-slider,
    .cookie-toggle-slider::after {
        transition: none;
    }
}
