/**
 * GDPR-Compliant Cookie Consent Banner Styles
 * Designed for accessibility and EU compliance
 */

/* Banner Container */
#cookie-consent-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

#cookie-consent-banner.cookie-consent-hidden {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Overlay */
.cookie-consent-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Main Container */
.cookie-consent-container {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content */
.cookie-consent-content {
    padding: 2rem;
}

/* Header */
.cookie-consent-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.cookie-consent-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
}

.cookie-consent-header p {
    font-size: 0.9375rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Categories */
.cookie-consent-categories {
    margin-bottom: 1.5rem;
}

.cookie-category {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s ease;
}

.cookie-category:hover {
    border-color: #d1d5db;
}

.cookie-category:last-child {
    margin-bottom: 0;
}

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

.cookie-category-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
}

.cookie-category-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.cookie-checkbox-custom {
    width: 20px;
    height: 20px;
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cookie-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.cookie-category-label input[type="checkbox"]:checked + .cookie-checkbox-custom {
    background: #4f46e5;
    border-color: #4f46e5;
}

.cookie-category-label input[type="checkbox"]:checked + .cookie-checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

.cookie-checkbox-custom.disabled {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.cookie-checkbox-custom.disabled::after {
    transform: rotate(45deg) scale(1);
    border-color: #9ca3af;
}

.cookie-category-label input[type="checkbox"]:focus + .cookie-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.cookie-category-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
}

.cookie-category-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: #059669;
    background: #d1fae5;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    margin-left: auto;
}

.cookie-category-description {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.5;
    margin: 0.5rem 0 0 0;
    padding-left: 2rem;
}

/* Action Buttons */
.cookie-consent-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.cookie-btn {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.cookie-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* Reject button - equal prominence to Accept per GDPR */
.cookie-btn-reject {
    background: #ffffff;
    color: #374151;
    border: 2px solid #d1d5db;
}

.cookie-btn-reject:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Save preferences button */
.cookie-btn-save {
    background: #ffffff;
    color: #4f46e5;
    border: 2px solid #4f46e5;
}

.cookie-btn-save:hover {
    background: #eef2ff;
}

/* Accept button */
.cookie-btn-accept {
    background: #4f46e5;
    color: #ffffff;
    border: 2px solid #4f46e5;
}

.cookie-btn-accept:hover {
    background: #4338ca;
    border-color: #4338ca;
}

/* Footer Links */
.cookie-consent-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.cookie-link {
    color: #6b7280;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cookie-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.cookie-separator {
    color: #d1d5db;
    margin: 0 0.5rem;
}

/* Settings Button (floating) */
.cookie-settings-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transition: all 0.2s ease;
    z-index: 9998;
}

.cookie-settings-button:hover {
    background: #4338ca;
    transform: scale(1.1);
}

.cookie-settings-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3), 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #cookie-consent-banner {
        padding: 0;
        align-items: flex-end;
    }

    .cookie-consent-container {
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }

    .cookie-consent-content {
        padding: 1.5rem;
    }

    .cookie-consent-header h2 {
        font-size: 1.25rem;
    }

    .cookie-consent-header p {
        font-size: 0.875rem;
    }

    .cookie-consent-actions {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
    }

    .cookie-category-description {
        padding-left: 0;
        margin-top: 0.75rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .cookie-consent-container {
        background: #1f2937;
    }

    .cookie-consent-header h2 {
        color: #f9fafb;
    }

    .cookie-consent-header p {
        color: #9ca3af;
    }

    .cookie-category {
        background: #374151;
        border-color: #4b5563;
    }

    .cookie-category:hover {
        border-color: #6b7280;
    }

    .cookie-category-name {
        color: #f9fafb;
    }

    .cookie-category-description {
        color: #9ca3af;
    }

    .cookie-checkbox-custom {
        background: #374151;
        border-color: #6b7280;
    }

    .cookie-checkbox-custom.disabled {
        background: #4b5563;
    }

    .cookie-btn-reject {
        background: #374151;
        color: #f9fafb;
        border-color: #6b7280;
    }

    .cookie-btn-reject:hover {
        background: #4b5563;
    }

    .cookie-btn-save {
        background: transparent;
    }

    .cookie-consent-footer {
        border-color: #4b5563;
    }

    .cookie-link {
        color: #9ca3af;
    }

    .cookie-separator {
        color: #4b5563;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #cookie-consent-banner,
    .cookie-consent-container,
    .cookie-btn,
    .cookie-checkbox-custom,
    .cookie-settings-button {
        animation: none;
        transition: none;
    }
}

/* High contrast mode */
@media (forced-colors: active) {
    .cookie-btn {
        border: 2px solid currentColor;
    }

    .cookie-checkbox-custom {
        border: 2px solid currentColor;
    }
}
