/**
 * PECR-Compliant Cookie Consent Styles
 * Professional UK GDPR/PECR compliant cookie banner and preferences
 */

/* Banner Styles */
.pecr-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    z-index: 99999;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.3);
    border-top: 2px solid #6B46C1;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.pecr-banner-visible {
    transform: translateY(0);
}

.pecr-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

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

.pecr-banner-text h3 {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #10B981;
}

.pecr-banner-text p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    color: #e5e7eb;
}

.pecr-legal-notice {
    opacity: 0.8;
    font-size: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
    margin-top: 12px;
}

.pecr-banner-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Button Styles */
.pecr-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    white-space: nowrap;
    pointer-events: auto;
    position: relative;
    z-index: 10000;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.pecr-btn-primary {
    background: #10B981;
    color: white;
}

.pecr-btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pecr-btn-secondary {
    background: #6B46C1;
    color: white;
}

.pecr-btn-secondary:hover {
    background: #553C9A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
}

.pecr-btn-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

/* Modal Styles */
.pecr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pecr-modal-visible {
    opacity: 1;
    visibility: visible;
}

.pecr-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.pecr-modal-content {
    position: relative;
    background: white;
    max-width: 700px;
    width: 90vw;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pecr-modal-header {
    padding: 24px 24px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.pecr-modal-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.pecr-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pecr-close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.pecr-modal-body {
    padding: 0 24px;
    overflow-y: auto;
    flex: 1;
}

.pecr-compliance-notice {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.pecr-compliance-notice p {
    margin: 0;
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Category Styles */
.pecr-category {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.pecr-category-header {
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.pecr-toggle-container {
    flex-shrink: 0;
    margin-top: 2px;
}

.pecr-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

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

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

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

.pecr-toggle input:checked + .pecr-toggle-slider {
    background-color: #10B981;
}

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

.pecr-toggle input:disabled + .pecr-toggle-slider {
    background-color: #10B981;
    opacity: 0.6;
    cursor: not-allowed;
}

.pecr-category-info {
    flex: 1;
}

.pecr-category-info h4 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
}

.pecr-category-info p {
    margin: 0 0 12px 0;
    color: #6b7280;
    line-height: 1.5;
}

.pecr-legal-basis {
    font-size: 0.875rem;
    color: #7c3aed;
    font-weight: 500;
}

.pecr-cookie-details {
    margin-top: 12px;
}

.pecr-cookie-details summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    padding: 4px 0;
}

.pecr-cookie-details summary:hover {
    color: #374151;
}

.pecr-cookie-details ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style: none;
}

.pecr-cookie-details li {
    margin: 4px 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.pecr-cookie-details code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
}

/* Modal Footer */
.pecr-modal-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f9fafb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pecr-banner-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .pecr-banner-actions {
        justify-content: center;
        width: 100%;
    }
    
    .pecr-btn {
        flex: 1;
        min-width: 0;
    }
    
    .pecr-modal-content {
        width: 95vw;
        margin: 2.5vh auto;
        max-height: 95vh;
    }
    
    .pecr-category-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .pecr-toggle-container {
        align-self: flex-start;
    }
    
    .pecr-modal-footer {
        flex-direction: column;
    }
    
    .pecr-modal-footer .pecr-btn {
        width: 100%;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .pecr-banner {
        border-top-width: 3px;
    }
    
    .pecr-btn {
        border: 2px solid transparent;
    }
    
    .pecr-btn-primary {
        border-color: #10B981;
    }
    
    .pecr-btn-secondary {
        border-color: #6B46C1;
    }
    
    .pecr-btn-outline {
        border-color: currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .pecr-banner,
    .pecr-modal,
    .pecr-btn,
    .pecr-toggle-slider,
    .pecr-toggle-slider:before {
        transition: none;
    }
}

/* Dark Mode Compatibility */
@media (prefers-color-scheme: dark) {
    .pecr-modal-content {
        background: #1f2937;
        color: white;
    }
    
    .pecr-modal-header {
        border-bottom-color: #374151;
    }
    
    .pecr-modal-header h2 {
        color: white;
    }
    
    .pecr-close-btn {
        color: #9ca3af;
    }
    
    .pecr-close-btn:hover {
        background: #374151;
        color: white;
    }
    
    .pecr-category {
        border-color: #374151;
        background: #111827;
    }
    
    .pecr-category-info h4 {
        color: white;
    }
    
    .pecr-category-info p {
        color: #d1d5db;
    }
    
    .pecr-modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
    
    .pecr-cookie-details code {
        background: #374151;
        color: #e5e7eb;
    }
}

/* Focus Styles for Accessibility */
.pecr-btn:focus,
.pecr-toggle input:focus + .pecr-toggle-slider,
.pecr-close-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.pecr-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.pecr-btn.loading:after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}