/**
 * Estilos do Comparador de Preços - v2
 * Otimizado para formato 1:1 (1080x1080px feed)
 * Design melhorado e restrição de permissões
 */

/* Namespace principal com alta especificidade */
.comparador-precos-wrapper {
    all: initial; /* Reseta tudo para o padrão do navegador dentro do wrapper */
    display: block;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    background-color: #0f172a; /* Slate 900 */
    color: #f8fafc;
    padding: 2rem;
    border-radius: 1.5rem;
    margin: 2rem 0;
}

.comparador-precos-wrapper * {
    box-sizing: border-box;
    font-family: inherit;
}

/* Forçar fundo escuro no container do Elementor */
.comparador-precos-wrapper #inputForm,
.comparador-precos-wrapper #previewSection {
    background-color: #1e293b !important; /* Slate 800 */
    border: 1px solid #334155 !important; /* Slate 700 */
    border-radius: 1.5rem !important;
    padding: 2rem !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Títulos */
.comparador-precos-wrapper h1, 
.comparador-precos-wrapper .font-bebas {
    font-family: 'Bebas Neue', sans-serif !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.comparador-precos-wrapper h2 {
    color: #ffffff !important;
    font-weight: 700 !important;
    margin-bottom: 1rem !important;
}

/* Inputs - Corrigindo o problema da imagem enviada */
.comparador-precos-wrapper input[type="text"],
.comparador-precos-wrapper input[type="number"] {
    background-color: #334155 !important; /* Slate 700 */
    border: 1px solid #475569 !important; /* Slate 600 */
    color: #ffffff !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem 1rem !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
    outline: none !important;
    box-shadow: none !important;
}

.comparador-precos-wrapper input::placeholder {
    color: #94a3b8 !important; /* Slate 400 */
}

.comparador-precos-wrapper label {
    display: block !important;
    color: #cbd5e1 !important; /* Slate 300 */
    font-size: 0.875rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 600 !important;
}

/* Drop Zone de Imagem */
.comparador-precos-wrapper #imageDropZone {
    border: 2px dashed #475569 !important;
    background-color: rgba(30, 41, 59, 0.5) !important;
    border-radius: 0.75rem !important;
    padding: 2rem !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.comparador-precos-wrapper #imageDropZone:hover {
    border-color: #6366f1 !important;
    background-color: rgba(51, 65, 85, 0.5) !important;
}

/* Botões */
.comparador-precos-wrapper #generateBtn {
    background: linear-gradient(to right, #4f46e5, #9333ea) !important;
    color: white !important;
    font-weight: 700 !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
    border: none !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: transform 0.2s !important;
    margin-top: 1rem !important;
}

.comparador-precos-wrapper #generateBtn:hover:not(:disabled) {
    transform: scale(1.02) !important;
}

.comparador-precos-wrapper #generateBtn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Cards de Preço no Formulário */
.comparador-precos-wrapper .price-card-ml {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%) !important;
    border: 1px solid rgba(234, 179, 8, 0.3) !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
}

.comparador-precos-wrapper .price-card-shopee {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(249, 115, 22, 0.05) 100%) !important;
    border: 1px solid rgba(249, 115, 22, 0.3) !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
}

/* Canvas e Preview - Otimizado para 1080x1350px (vertical/feed) */
.comparador-precos-wrapper .canvas-container {
    width: 1080px !important;
    height: 1350px !important;
    position: relative !important;
    overflow: hidden !important;
    background-color: #020617 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    transform: none !important;
}

/* Garante que elementos absolutos dentro do canvas não sejam afetados pelo tema */
.comparador-precos-wrapper .canvas-container * {
    position: absolute;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: none;
}

/* Classes específicas para o Canvas injetadas via JS */
.comparador-precos-wrapper .canvas-bg { inset: 0 !important; z-index: 0; }
.comparador-precos-wrapper .canvas-header { top: 2rem !important; left: 0; right: 0; text-align: center; z-index: 10; }
.comparador-precos-wrapper .canvas-product-img { top: 14rem !important; left: 50%; transform: translateX(-50%); z-index: 20; }
.comparador-precos-wrapper .canvas-product-name { top: 36rem !important; left: 0; right: 0; text-align: center; padding: 0 2rem; z-index: 30; }
.comparador-precos-wrapper .canvas-price-cards { top: 43rem !important; left: 0; right: 0; display: flex !important; justify-content: center; gap: 1.5rem; padding: 0 2rem; z-index: 40; flex-wrap: wrap; }
.comparador-precos-wrapper .canvas-savings { top: 65rem !important; left: 0; right: 0; text-align: center; z-index: 50; }
.comparador-precos-wrapper .canvas-cta { bottom: 3rem !important; left: 0; right: 0; text-align: center; z-index: 60; }
.comparador-precos-wrapper .canvas-watermark { bottom: 1rem !important; right: 1.5rem !important; font-size: 0.875rem; color: #475569; z-index: 70; }

/* Reset de estilos de texto dentro do canvas */
.comparador-precos-wrapper .canvas-container h1,
.comparador-precos-wrapper .canvas-container h2,
.comparador-precos-wrapper .canvas-container p,
.comparador-precos-wrapper .canvas-container span {
    position: relative; /* Volta para relativo dentro dos blocos posicionados */
    display: block;
}

/* Histórico */
.comparador-precos-wrapper #historySection {
    margin-top: 3rem !important;
    border-top: 1px solid #334155 !important;
    padding-top: 2rem !important;
}

.comparador-precos-wrapper .history-card {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 1rem !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    display: flex !important;
    gap: 1rem !important;
    transition: all 0.3s !important;
}

.comparador-precos-wrapper .history-card:hover {
    border-color: #6366f1 !important;
    transform: translateY(-2px) !important;
}

/* Galeria Pública */
.comparador-precos-wrapper #gallerySection {
    margin-top: 3rem !important;
    border-top: 1px solid #334155 !important;
    padding-top: 2rem !important;
}

.comparador-precos-wrapper #publicGalleryList {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    gap: 1.5rem !important;
}

.comparador-precos-wrapper .gallery-item {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 1rem !important;
    overflow: hidden !important;
    transition: all 0.3s !important;
    cursor: pointer !important;
}

.comparador-precos-wrapper .gallery-item:hover {
    border-color: #6366f1 !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.1) !important;
}

/* Utilitários forçados */
.comparador-precos-wrapper .hidden { display: none !important; }
.comparador-precos-wrapper .flex { display: flex !important; }
.comparador-precos-wrapper .grid { display: grid !important; }
.comparador-precos-wrapper .text-white { color: white !important; }
.comparador-precos-wrapper .font-bold { font-weight: 700 !important; }

/* Gradientes do Canvas (Injetados via JS mas precisam de classes aqui) */
.ml-gradient { background: linear-gradient(135deg, #FFE600 0%, #FFF159 100%) !important; }
.shopee-gradient { background: linear-gradient(135deg, #EE4D2D 0%, #FF6633 100%) !important; }

/* Animações */
@keyframes comparador-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.winner-badge { animation: comparador-pulse 2s infinite !important; }

.spark {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #FFD700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* Preview do Canvas com escala */
.comparador-precos-wrapper #canvasWrapper {
    transform: scale(0.4) !important;
    transform-origin: top left !important;
    width: 432px !important;
    height: 432px !important;
}

/* Responsivo */
@media (max-width: 768px) {
    .comparador-precos-wrapper #canvasWrapper {
        transform: scale(0.3) !important;
        width: 324px !important;
        height: 324px !important;
    }

    .comparador-precos-wrapper #publicGalleryList {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
}
