/* Cookie Consent Modal - Dark Theme (Yellow/Zinc) */
.cookie-consent-modal {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 450px;
    max-height: calc(100vh - 40px); /* Limita altura para não ultrapassar viewport */
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    border-radius: 12px;
    border: 1px solid #3f3f46;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(251, 191, 36, 0.1);
    z-index: 1001;
    /* Início com opacidade zero e posicionado abaixo */
    opacity: 0;
    transform: translateY(100px);
    /* Transição suave para entrada */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    /* Inicialmente escondido */
    visibility: hidden;
    /* Layout flexbox para header fixo, conteúdo scrollável, footer fixo */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Importante: overflow no modal principal é hidden */
}

/* Quando visible, torna visível com opacidade total e posição normal */
.cookie-consent-modal.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Scrollbar do modal não é mais necessária (scroll está no conteúdo) */

/* Animação de shake independente que não interfere com a transição */
.cookie-consent-modal.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.cookie-consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    /* Início com opacidade zero */
    opacity: 0;
    /* Transição suave para entrada */
    transition: opacity 0.4s ease-out;
    /* Inicialmente escondido */
    visibility: hidden;
}

.cookie-consent-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Overlay bloqueante (impede interação com a página) */
.cookie-consent-overlay.cookie-consent-blocking {
    pointer-events: all;
    cursor: not-allowed;
}

/* Overlay não-bloqueante (permite interação com a página) */
.cookie-consent-overlay.non-blocking {
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

@media (max-width: 480px) {
    .cookie-consent-modal {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
}

/* Header fixo no topo */
.cookie-consent-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #3f3f46;
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0; /* Não encolhe */
}

.cookie-consent-header i {
    color: #fbbf24;
    font-size: 28px;
    margin-right: 12px;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.3));
}

.cookie-consent-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fef3c7;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Conteúdo scrollável no meio */
.cookie-consent-content {
    flex: 1; /* Ocupa espaço disponível */
    overflow-y: auto; /* Scroll apenas no conteúdo */
    padding: 20px 24px;
    min-height: 0; /* Importante para flexbox scroll */
}

/* Estilização da scrollbar do conteúdo */
.cookie-consent-content::-webkit-scrollbar {
    width: 8px;
}

.cookie-consent-content::-webkit-scrollbar-track {
    background: rgba(39, 39, 42, 0.5);
    border-radius: 4px;
}

.cookie-consent-content::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 4px;
}

.cookie-consent-content::-webkit-scrollbar-thumb:hover {
    background: #fcd34d;
}

.cookie-consent-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #fef3c7;
}

.cookie-consent-text a {
    color: #fbbf24;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.cookie-consent-text a:hover {
    color: #fcd34d;
}

/* Info box para mensagens importantes */
.cookie-consent-info-box {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin: 12px 0;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    align-items: flex-start;
}

.cookie-consent-info-box i {
    color: #60a5fa;
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.cookie-consent-info-box p {
    margin: 0;
    font-size: 13px;
    color: #e0e7ff;
    line-height: 1.5;
}

/* Seção de detalhes expansível */
.cookie-consent-details {
    margin: 16px 0;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 12px;
    background: rgba(24, 24, 27, 0.5);
}

.cookie-consent-details-content {
    padding-top: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Estilização da scrollbar para a área de detalhes */
.cookie-consent-details-content::-webkit-scrollbar {
    width: 6px;
}

.cookie-consent-details-content::-webkit-scrollbar-track {
    background: rgba(39, 39, 42, 0.5);
    border-radius: 3px;
}

.cookie-consent-details-content::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 3px;
}

.cookie-consent-details-content::-webkit-scrollbar-thumb:hover {
    background: #fcd34d;
}

.cookie-consent-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #fbbf24;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-consent-details summary:hover {
    background: rgba(251, 191, 36, 0.1);
}

.cookie-consent-details summary::-webkit-details-marker {
    display: none;
}

.cookie-categories-info {
    margin-bottom: 16px;
}

.cookie-category-info {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(39, 39, 42, 0.5);
    border-radius: 6px;
    border-left: 3px solid #fbbf24;
}

/* Estilos específicos por categoria */
.cookie-category-info.cookie-category-essential {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.cookie-category-info.cookie-category-analytics {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.cookie-category-info.cookie-category-marketing {
    border-left-color: #f97316;
    background: rgba(249, 115, 22, 0.05);
}

.cookie-category-info h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #fef3c7;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

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

/* Badges para indicar status */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-essential {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-analytics {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-marketing {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.cookie-tools-list {
    margin-top: 16px;
}

.cookie-tool-item {
    padding: 12px 0;
    border-bottom: 1px solid #27272a;
}

.cookie-tool-item:last-child {
    border-bottom: none;
}

.cookie-tool-item h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #fef3c7;
}

.cookie-tool-item p {
    margin: 4px 0;
    font-size: 13px;
    color: #d4d4d8;
    line-height: 1.5;
}

.cookie-tool-item a {
    color: #fbbf24;
    text-decoration: underline;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-tool-item a:hover {
    color: #fcd34d;
}

/* Painel de preferências */
.cookie-consent-preferences {
    margin: 16px 0;
    padding: 16px;
    background: rgba(24, 24, 27, 0.5);
    border: 1px solid #3f3f46;
    border-radius: 8px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    opacity: 1;
}

.cookie-consent-preferences.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: none;
}

/* Lista de categorias dentro do painel de preferências */
.cookie-categories-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Estilização da scrollbar para a lista de categorias */
.cookie-categories-list::-webkit-scrollbar {
    width: 6px;
}

.cookie-categories-list::-webkit-scrollbar-track {
    background: rgba(39, 39, 42, 0.5);
    border-radius: 3px;
}

.cookie-categories-list::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 3px;
}

.cookie-categories-list::-webkit-scrollbar-thumb:hover {
    background: #fcd34d;
}

.cookie-consent-preferences h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #fef3c7;
}

.cookie-category {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #27272a;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: background-color 0.2s ease;
}

.cookie-category:hover {
    background: #3f3f46;
}

.cookie-category input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: #fbbf24;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cookie-category input[type="checkbox"]:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.cookie-category input[type="checkbox"]:checked {
    animation: checkboxPulse 0.3s ease;
}

@keyframes checkboxPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.cookie-category input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-category label {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cookie-category label i {
    color: #fbbf24;
    font-size: 16px;
    margin-top: 2px;
}

.cookie-category label span {
    flex: 1;
}

.cookie-category label span strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fef3c7;
    margin-bottom: 2px;
}

.cookie-category label span small {
    display: block;
    font-size: 12px;
    color: #a1a1aa;
    line-height: 1.4;
}

/* Estilo especial para categoria essencial */
.cookie-category-essential {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.cookie-category-essential:hover {
    background: rgba(251, 191, 36, 0.15);
}

.cookie-category-essential label i {
    color: #fbbf24;
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

.cookie-consent-actions-secondary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #3f3f46;
}

/* Footer fixo no fundo com botões de ação */
.cookie-consent-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px 24px;
    border-top: 1px solid #3f3f46;
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0; /* Não encolhe */
}

.cookie-consent-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border: none;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

/* Estado de loading para botões */
.cookie-consent-btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.cookie-consent-btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.cookie-consent-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.cookie-consent-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cookie-consent-btn:hover::before {
    width: 300px;
    height: 300px;
}

.cookie-consent-btn-accept {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #18181b;
    flex: 1;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.cookie-consent-btn-accept:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
    box-shadow: 0 6px 16px rgba(251, 191, 36, 0.5);
    transform: translateY(-2px);
}

.cookie-consent-btn-accept:active {
    transform: translateY(0);
}

.cookie-consent-btn-reject {
    background-color: #3f3f46;
    color: #fef3c7;
    border: 1px solid #52525b;
    flex: 1;
}

.cookie-consent-btn-reject:hover {
    background-color: #52525b;
    border-color: #71717a;
}

.cookie-consent-btn-manage {
    background-color: #374151;
    color: #fef3c7;
    border: 1px solid #4b5563;
    flex: 1;
}

.cookie-consent-btn-manage:hover {
    background-color: #4b5563;
    border-color: #6b7280;
}

.cookie-consent-btn-save {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cookie-consent-btn-save:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.cookie-consent-btn-save:active {
    transform: translateY(0);
}

.cookie-consent-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
    transform: translateY(-1px) !important;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px) translateY(0);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px) translateY(0);
    }
}

/* Animação de entrada suave */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Melhorias de responsividade */
@media (max-width: 480px) {
    .cookie-consent-modal {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        padding: 20px;
    }
    
    .cookie-consent-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .cookie-consent-btn {
        width: 100%;
        min-width: auto;
    }
    
    .cookie-category {
        flex-direction: column;
        gap: 8px;
    }
    
    .cookie-category label {
        align-items: flex-start;
    }
    
    .cookie-consent-details {
        margin: 12px 0;
    }
    
    .cookie-consent-preferences {
        margin: 12px 0;
        padding: 12px;
    }
}

/* Animações suaves para expansão/colapso */
.cookie-consent-details[open] {
    animation: expandDetails 0.3s ease-out;
}

@keyframes expandDetails {
    from {
        opacity: 0.8;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estado de carregamento/processamento */
.cookie-consent-btn.processing {
    pointer-events: none;
    opacity: 0.7;
}

.cookie-consent-btn.processing::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
