/**
 * Professional Cookie Consent Styles for Africa Surveys
 * Modern, accessible, and mobile-responsive design
 */

/* Cookie Notification Banner */
.cookie-notification {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 3px solid #4a6fdc;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

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

.cookie-notification-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.cookie-icon {
    color: #4a6fdc;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(74, 111, 220, 0.1);
    border-radius: 12px;
}

.cookie-text {
    color: #2d3748;
    line-height: 1.6;
}

.cookie-text h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

.cookie-text p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #4a5568;
}

.cookie-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-link {
    color: #4a6fdc;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-link:hover {
    color: #3c56b9;
    text-decoration: underline;
}

.separator {
    color: #a0aec0;
    font-size: 12px;
}

.cookie-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

/* Button Styles */
.btn-cookie-settings,
.btn-accept-all {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

.btn-cookie-settings {
    background: transparent;
    color: #4a6fdc;
    border: 2px solid #4a6fdc;
}

.btn-cookie-settings:hover {
    background: #4a6fdc;
    color: white;
    transform: translateY(-1px);
}

.btn-accept-all {
    background: linear-gradient(135deg, #4a6fdc 0%, #667eea 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-accept-all:hover {
    background: linear-gradient(135deg, #3c56b9 0%, #5a6fd8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 111, 220, 0.3);
}

/* Cookie Settings Modal */
.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cookie-settings-modal.show {
    opacity: 1;
    visibility: visible;
}

.cookie-settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cookie-settings-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cookie-settings-modal.show .cookie-settings-content {
    transform: scale(1);
}

.cookie-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.cookie-settings-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.cookie-settings-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: #718096;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-settings-close:hover {
    background: rgba(74, 111, 220, 0.1);
    color: #4a6fdc;
}

.cookie-settings-body {
    padding: 32px;
    max-height: 60vh;
    overflow-y: auto;
}

.cookie-intro {
    margin-bottom: 32px;
}

.cookie-intro p {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

/* Cookie Categories */
.cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cookie-category {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    background: #f7fafc;
    transition: all 0.2s ease;
}

.cookie-category:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cookie-category-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.cookie-category-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

.cookie-category-info p {
    margin: 0;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

/* Toggle Switch */
.cookie-toggle {
    flex-shrink: 0;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.3s ease;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-label .toggle-slider {
    background-color: #4a6fdc;
}

input:focus + .toggle-label .toggle-slider {
    box-shadow: 0 0 0 3px rgba(74, 111, 220, 0.2);
}

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

input:disabled + .toggle-label {
    opacity: 0.6;
    cursor: not-allowed;
}

input:disabled + .toggle-label .toggle-slider {
    background-color: #68d391;
}

.cookie-category-details {
    color: #4a5568;
    font-size: 13px;
    line-height: 1.6;
}

.cookie-category-details p {
    margin: 8px 0;
}

.cookie-category-details strong {
    color: #2d3748;
    font-weight: 600;
}

/* Additional Info */
.cookie-additional-info {
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e6fffa 100%);
    border-radius: 12px;
    border-left: 4px solid #4a6fdc;
}

.cookie-additional-info h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
}

.cookie-additional-info p {
    margin: 8px 0;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
}

/* Footer Actions */
.cookie-settings-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px 32px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
}

.btn-reject-all,
.btn-save-preferences,
.btn-accept-all-settings {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.btn-reject-all {
    background: transparent;
    color: #e53e3e;
    border: 2px solid #e53e3e;
}

.btn-reject-all:hover {
    background: #e53e3e;
    color: white;
}

.btn-save-preferences {
    background: transparent;
    color: #4a6fdc;
    border: 2px solid #4a6fdc;
}

.btn-save-preferences:hover {
    background: #4a6fdc;
    color: white;
}

.btn-accept-all-settings {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-accept-all-settings:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* Success Message */
.cookie-consent-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cookie-consent-message.show {
    transform: translateX(0);
}

.cookie-consent-message-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cookie-notification {
        padding: 16px;
    }
    
    .cookie-notification-content {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }
    
    .cookie-icon {
        margin: 0 auto;
    }
    
    .cookie-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-cookie-settings,
    .btn-accept-all {
        width: 100%;
        min-width: unset;
    }
    
    .cookie-settings-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .cookie-settings-header,
    .cookie-settings-body,
    .cookie-settings-footer {
        padding: 20px;
    }
    
    .cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .cookie-settings-footer {
        flex-direction: column;
    }
    
    .btn-reject-all,
    .btn-save-preferences,
    .btn-accept-all-settings {
        width: 100%;
        min-width: unset;
    }
    
    .cookie-consent-message {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .cookie-consent-message.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .cookie-text h3 {
        font-size: 16px;
    }
    
    .cookie-text p {
        font-size: 13px;
    }
    
    .cookie-settings-header h2 {
        font-size: 20px;
    }
    
    .cookie-category-info h3 {
        font-size: 16px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cookie-notification {
        border-top-width: 4px;
        border-top-color: #000;
    }
    
    .cookie-category {
        border-width: 2px;
        border-color: #000;
    }
    
    .toggle-slider {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cookie-notification,
    .cookie-settings-modal,
    .cookie-settings-content,
    .cookie-consent-message,
    .btn-cookie-settings,
    .btn-accept-all,
    .toggle-slider {
        transition: none;
    }
}

/* Print styles */
@media print {
    .cookie-notification,
    .cookie-settings-modal,
    .cookie-consent-message {
        display: none !important;
    }
}

/* Body classes for modal states */
body.cookie-notification-open {
    padding-bottom: 160px;
}

body.cookie-modal-open {
    overflow: hidden;
}

/* Dark mode support (if theme toggle is available) */
@media (prefers-color-scheme: dark) {
    .cookie-notification {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        border-top-color: #667eea;
    }
    
    .cookie-text h3 {
        color: #f7fafc;
    }
    
    .cookie-text p {
        color: #cbd5e0;
    }
    
    .cookie-settings-content {
        background: #2d3748;
        color: #f7fafc;
    }
    
    .cookie-settings-header {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
        border-bottom-color: #4a5568;
    }
    
    .cookie-settings-header h2 {
        color: #f7fafc;
    }
    
    .cookie-category {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .cookie-category-info h3 {
        color: #f7fafc;
    }
    
    .cookie-category-info p,
    .cookie-category-details {
        color: #cbd5e0;
    }
    
    .cookie-additional-info {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .cookie-settings-footer {
        background: #1a202c;
        border-top-color: #4a5568;
    }
}