/**
 * Cookie Consent Styles
 * Sistema de gestão de cookies - Estilos responsivos
 * Compatible with Bootstrap 4 & 5
 */

/* ============================================================================
   BANNER DE COOKIES
   ============================================================================ */

.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

.cookie-consent-banner.cookie-consent-bottom {
    bottom: 0;
}

.cookie-consent-banner.cookie-consent-top {
    top: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cookie-consent-banner.cookie-consent-center {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Tema Dark */
.cookie-consent-banner.cookie-consent-dark {
    background: #2d3748;
    color: #e2e8f0;
}

/* Container */
.cookie-consent-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-consent-content {
    flex: 1;
}

.cookie-consent-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1a202c;
}

.cookie-consent-dark .cookie-consent-title {
    color: #f7fafc;
}

.cookie-consent-description {
    font-size: 0.95rem;
    margin: 0;
    color: #4a5568;
    line-height: 1.5;
}

.cookie-consent-dark .cookie-consent-description {
    color: #cbd5e0;
}

.cookie-consent-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botões */
.cookie-consent-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-consent-btn-accept {
    background: #007bff;
    color: #fff;
}

.cookie-consent-btn-accept:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.cookie-consent-btn-settings {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.cookie-consent-btn-settings:hover {
    background: #e9ecef;
}

.cookie-consent-dark .cookie-consent-btn-settings {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #2d3748;
}

.cookie-consent-dark .cookie-consent-btn-settings:hover {
    background: #5a6678;
}

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

.cookie-consent-btn-secondary:hover {
    background: #5a6268;
}

/* ============================================================================
   MODAL DE PREFERÊNCIAS
   ============================================================================ */

.cookie-preferences-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.cookie-preferences-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cookie-preferences-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out;
}

/* Header */
.cookie-preferences-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-preferences-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a202c;
}

.cookie-preferences-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #718096;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.cookie-preferences-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* Body */
.cookie-preferences-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Categorias */
.cookie-category {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

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

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

.cookie-category-info h5 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.cookie-category-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.6;
}

/* Toggle Switch */
.cookie-category-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

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

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

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

.cookie-category-switch input:checked + .cookie-category-slider {
    background-color: #48bb78;
}

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

.cookie-category-switch input:disabled + .cookie-category-slider {
    background-color: #48bb78;
    opacity: 0.6;
    cursor: not-allowed;
}

.cookie-category-switch input:disabled + .cookie-category-slider:before {
    cursor: not-allowed;
}

/* Footer */
.cookie-preferences-footer {
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================================================
   ANIMAÇÕES
   ============================================================================ */

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

/* ============================================================================
   RESPONSIVO
   ============================================================================ */

@media (max-width: 768px) {
    .cookie-consent-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .cookie-consent-buttons {
        justify-content: stretch;
    }
    
    .cookie-consent-btn {
        flex: 1;
        text-align: center;
    }
    
    .cookie-consent-title {
        font-size: 1.1rem;
    }
    
    .cookie-consent-description {
        font-size: 0.9rem;
    }
    
    .cookie-preferences-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .cookie-preferences-header,
    .cookie-preferences-body,
    .cookie-preferences-footer {
        padding: 16px;
    }
    
    .cookie-preferences-footer {
        flex-direction: column;
    }
    
    .cookie-preferences-footer .cookie-consent-btn {
        width: 100%;
    }
    
    .cookie-category-header {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .cookie-consent-banner.cookie-consent-center {
        width: 95%;
        max-width: none;
    }
    
    .cookie-consent-container {
        padding: 15px;
    }
    
    .cookie-consent-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* ============================================================================
   COMPATIBILIDADE COM BOOTSTRAP
   ============================================================================ */

/* Garante que não há conflitos com classes Bootstrap */
.cookie-consent-banner *,
.cookie-preferences-modal * {
    box-sizing: border-box;
}

/* Ajustes para Bootstrap 4/5 */
.cookie-consent-btn:focus,
.cookie-preferences-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ============================================================================
   ACESSIBILIDADE
   ============================================================================ */

/* Focus visível para navegação por teclado */
.cookie-consent-btn:focus-visible,
.cookie-preferences-close:focus-visible,
.cookie-category-switch:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Alto contraste para leitores de ecrã */
@media (prefers-contrast: high) {
    .cookie-consent-banner {
        border: 2px solid #000;
    }
    
    .cookie-consent-btn {
        border: 2px solid currentColor;
    }
}

/* Modo de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    .cookie-consent-banner,
    .cookie-preferences-modal,
    .cookie-preferences-content {
        animation: none;
    }
    
    .cookie-consent-btn,
    .cookie-category-slider,
    .cookie-category-slider:before {
        transition: none;
    }
}

/* ============================================================================
   PRINT
   ============================================================================ */

@media print {
    .cookie-consent-banner,
    .cookie-preferences-modal {
        display: none !important;
    }
}