/**
 * Cookie Consent Banner & Modal Styles
 * Enterprise SaaS theme matching ThreatSpot design
 */

/* Banner Container */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 3px solid #4154f1;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

#cookie-consent-banner[aria-hidden="true"] {
    display: none;
}

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

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

.cookie-banner-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #012970;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.95rem;
    color: #444;
    line-height: 1.6;
}

.cookie-banner-text a {
    color: #4154f1;
    text-decoration: underline;
}

.cookie-banner-text a:hover {
    color: #2c3cdd;
}

/* Banner Actions */
.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.cookie-btn {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn:focus {
    outline: 2px solid #4154f1;
    outline-offset: 2px;
}

.cookie-btn-primary {
    background: #4154f1;
    color: #ffffff;
}

.cookie-btn-primary:hover {
    background: #2c3cdd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(65, 84, 241, 0.3);
}

.cookie-btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.cookie-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.cookie-btn-outline {
    background: transparent;
    color: #4154f1;
    border: 2px solid #4154f1;
}

.cookie-btn-outline:hover {
    background: #4154f1;
    color: #ffffff;
}

/* Preferences Modal */
#cookie-preferences-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#cookie-preferences-modal.show {
    display: flex;
}

#cookie-preferences-modal[aria-hidden="true"] {
    display: none;
}

.cookie-modal-content {
    background: #ffffff;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Modal Header */
.cookie-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #012970;
}

.cookie-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cookie-modal-close:hover {
    background: #f0f0f0;
    color: #012970;
}

.cookie-modal-close:focus {
    outline: 2px solid #4154f1;
    outline-offset: 2px;
}

/* Modal Body */
.cookie-modal-body {
    padding: 1.5rem;
}

.cookie-modal-intro {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #444;
    line-height: 1.6;
}

/* Cookie Category */
.cookie-category {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4154f1;
}

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

.cookie-category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #012970;
    margin: 0;
}

.cookie-category-required {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.cookie-category-description {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0.5rem 0 0 0;
}

/* Toggle Switch */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

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

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: #4154f1;
}

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

.cookie-toggle input:focus + .cookie-toggle-slider {
    box-shadow: 0 0 0 2px rgba(65, 84, 241, 0.3);
}

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

/* California-specific options */
#ca-specific-options {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fff3cd;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
}

#ca-specific-options h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #856404;
}

#ca-specific-options p {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #856404;
}

/* Modal Footer */
.cookie-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Notification */
.cookie-consent-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.cookie-consent-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    #cookie-consent-banner {
        padding: 1rem;
    }
    
    .cookie-banner-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cookie-banner-text {
        min-width: 100%;
    }
    
    .cookie-banner-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .cookie-btn {
        width: 100%;
        text-align: center;
    }
    
    .cookie-modal-content {
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 1rem;
    }
    
    .cookie-modal-footer {
        flex-direction: column;
    }
    
    .cookie-modal-footer .cookie-btn {
        width: 100%;
    }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
    #cookie-consent-banner {
        border-top-width: 4px;
    }
    
    .cookie-btn {
        border: 2px solid currentColor;
    }
    
    .cookie-toggle-slider {
        border: 2px solid #000;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #cookie-consent-banner,
    .cookie-btn,
    .cookie-toggle-slider,
    .cookie-toggle-slider:before,
    .cookie-consent-notification,
    .cookie-modal-content {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    #cookie-consent-banner,
    #cookie-preferences-modal {
        display: none !important;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    #cookie-consent-banner {
        background: #1a1a1a;
        border-top-color: #4154f1;
    }
    
    .cookie-banner-text h3 {
        color: #ffffff;
    }
    
    .cookie-banner-text p {
        color: #d0d0d0;
    }
    
    .cookie-modal-content {
        background: #1a1a1a;
    }
    
    .cookie-modal-header {
        border-bottom-color: #333;
    }
    
    .cookie-modal-header h2 {
        color: #ffffff;
    }
    
    .cookie-modal-body {
        color: #d0d0d0;
    }
    
    .cookie-category {
        background: #2a2a2a;
    }
    
    .cookie-category-title {
        color: #ffffff;
    }
    
    .cookie-category-description {
        color: #d0d0d0;
    }
    
    .cookie-modal-footer {
        border-top-color: #333;
    }
    
    #ca-specific-options {
        background: #3a3000;
        border-left-color: #ffc107;
    }
    
    #ca-specific-options h4,
    #ca-specific-options p {
        color: #ffd54f;
    }
}
