/* ---- RESET E CONFIGURAÇÕES GLOBAIS ---- */
:root {
    --accent-color: #4a90e2;
    --secondary-color: #f39c12;
    --danger-color: #e74c3c;
    --dark-grey: #919191;
    --medium-grey: #555;
    --light-grey: #f4f4f4;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --card-border-radius: 8px;
    --testimonial-img-size: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #e9eef2;
    color: var(--dark-grey);
    line-height: 1.6;
}

/* ---- LAYOUT PRINCIPAL ---- */
.generator-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

#sidebar {
    width: 380px;
    background-color: var(--white);
    padding: 25px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
    box-shadow: var(--shadow);
}

#preview-panel {
    flex: 1;
    padding: 30px;
    background-color: #e9eef2;
    overflow-y: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

#catalog-preview {
    width: 100%;
    transition: background 0.4s ease, color 0.4s ease, max-width 0.5s ease;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.width-normal { max-width: 800px; border-radius: 8px; }
.width-large { max-width: 1200px; border-radius: 8px; }
.width-full { max-width: 100%; border-radius: 0; }

/* ---- SIDEBAR E FORMULÁRIO ---- */
.form-section {
    margin-bottom: 25px;
}

.form-section h3 {
    font-size: 1.1em;
    color: var(--medium-grey);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Poppins', sans-serif;
}

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    color: var(--white);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--accent-color);
}

.generate-button { background-color: #28a745; }
.secondary-button { background-color: #6c757d; font-size: 0.9em; padding: 10px; }
.danger-button { background-color: var(--danger-color); }
.update-button { background-color: var(--secondary-color); }

.action-buttons-container {
    display: flex;
    gap: 10px;
}

.cancel-button {
    background-color: #6c757d;
}

.hidden {
    display: none;
}

/* ---- ESTILOS PARA VISUALIZAÇÃO DE TEXTO DA CATEGORIA ---- */
.category-content-view {
    padding: 8px;
}

.separator-title-view {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--heading-color);
}

.separator-desc-view {
    font-size: 1em;
    margin: 0;
    color: var(--text-color);
    white-space: pre-wrap;
    opacity: 0.9;
}

/* Ícone de Lápis (Editar Categoria) */
.action-btn.edit-separator-btn {
    color: #f39c12; /* Laranja/Amarelo (var(--secondary-color)) */
}
.action-btn.edit-separator-btn:hover {
    background-color: #f39c12;
    color: white;
}

/* Ícone de Lixeira (Remover Categoria) */
/* A lixeira da categoria usará a mesma classe que a do produto, mas
   podemos criar uma regra específica se quisermos uma cor diferente. */
.action-btn.remove-separator-btn {
    color: #e74c3c; /* Vermelho (var(--danger-color)) */
}
.action-btn.remove-separator-btn:hover {
    background-color: #e74c3c;
    color: white;
}

.form-feedback {
    font-size: 0.85em;
    padding: 8px;
    border-radius: 4px;
    background-color: #e9f5ff;
    color: #005a9e;
    margin-bottom: 10px;
}

.width-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
    margin-bottom: 15px;
}

.width-btn {
    padding: 8px;
    font-size: 0.85em;
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ccc;
}

.width-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.slider-container,
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

/* ---- PREVIEW DO CATÁLOGO: ESTRUTURA GERAL ---- */
.catalog-main-content {
    padding: 0 40px;
}

#preview-headline,
.products-section h2,
#testimonials-section h2,
#map-section h2 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 30px;
    color: var(--heading-color);
}

#preview-headline {
    font-size: 2.5em;
}

.catalog-header {
    width: 100%;
    min-height: 200px; /* Valor padrão, será sobrescrito pelo JS */
    background-color: #eee;
    background-size: cover;
    background-position: center;
}

.profile-image-container {
    position: relative;
    text-align: center;
}

#preview-profile-image {
    width: 120px; /* Valor padrão, será sobrescrito pelo JS */
    height: 120px; /* Valor padrão, será sobrescrito pelo JS */
    margin-top: -60px; /* Valor padrão, será sobrescrito pelo JS */
    object-fit: cover;
    border: 5px solid var(--bg-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
    background-color: #fff;
    border-color: var(--bg-color);
}

#preview-profile-image.circular {
    border-radius: 50%;
}

.header-text-content {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
}

.header-text-content p {
    font-size: 1.1em;
    max-width: 600px;
    margin: 0 auto;
}

/* ---- PREVIEW DO CATÁLOGO: PRODUTOS ---- */
.product-card,
.testimonial-card {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid rgba(0,0,0,0.05);
}

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.action-btn.edit-btn { color: var(--accent-color); }
.action-btn.edit-btn:hover { background-color: var(--accent-color); color: white; }
.action-btn.remove-btn { color: var(--danger-color); }
.action-btn.remove-btn:hover { background-color: var(--danger-color); color: white; }

.product-card {
    border-radius: var(--card-border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    cursor: grab;
}

.product-card:active {
    cursor: grabbing;
}

.sortable-ghost { opacity: 0.4; background: #c8ebfb; }
.sortable-drag { opacity: 1 !important; }

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 20px;
    flex-grow: 1;
}

.product-info h3 {
    font-size: 1.2em;
    margin-bottom: 5px;
    color: var(--card-text);
}

.product-info p {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: var(--card-text);
}

.product-price {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--accent-color);
}

.product-actions {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-whatsapp-btn {
    background: none;
    border: none;
    color: #25D366;
    font-size: 1.8em;
    cursor: pointer;
    transition: transform 0.3s;
    padding: 5px;
}

/* O wrapper agora usa Flexbox para empilhar e centralizar seus filhos */
#product-list-wrapper {
    display: flex;
    flex-direction: column; /* Empilha os itens verticalmente */
    align-items: center;    /* Centraliza os itens horizontalmente */
    gap: 30px;              /* Mantém o espaçamento */
    width: 100%;            /* Garante que o wrapper ocupe toda a largura disponível */
}

/* A lista de produtos é quem se torna o Grid */
#preview-product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    width: 100%; /* A lista também deve ocupar toda a largura para o grid funcionar */
}

.product-card-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;

    /* Aumentamos a largura para ele ter uma aparência melhor quando estiver sozinho */
    width: 100%;
    max-width: 400px; /* Opcional: define uma largura máxima para não ficar gigante em telas largas */
    
    border: 2px dashed #b0c4de;
    border-radius: var(--card-border-radius);
    min-height: 300px;
    
    color: #849ec1;
    font-weight: 500;
    cursor: pointer;
    
    transition: all 0.3s ease;
    /* grid-column foi removido pois não é mais um item direto do grid de produtos */
}

.product-card-placeholder:hover {
    background-color: #f0f8ff;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.product-card-placeholder i {
    font-size: 48px;
}
/* ---- ESTILO DA MENSAGEM FINAL ---- */
#final-message-section {
    padding: 40px;
    text-align: center;
    transition: all 0.5s;
    opacity: 1;
    max-height: 1000px;
    overflow: hidden;
}

#final-message-section.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 40px;
    margin: 0;
}

#final-message-section h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--heading-color);
}

#final-message-section p {
    font-size: 1.1em;
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-color);
    white-space: pre-wrap; /* Mantém quebras de linha do textarea */
}

/* ---- LAYOUTS DE PRODUTOS ---- */
#preview-product-list.layout-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

#preview-product-list.layout-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.layout-list .product-card {
    flex-direction: row;
    align-items: center;
}

.layout-list .product-card img {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

#preview-product-list.layout-inline {
    display: flex;
    flex-wrap: wrap; 
    gap: 20px;
    justify-content: center;
}

.layout-inline .product-card {
    flex-basis: calc(20% - 20px);
    flex-grow: 1;
    min-width: 250px;
}

/* ---- PREVIEW DO CATÁLOGO: SEÇÕES ADICIONAIS ---- */
#testimonials-section {
    padding: 40px;
    transition: all 0.5s;
    opacity: 1;
    max-height: 1000vh;
    overflow: hidden;
}

#testimonials-section.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 40px;
    margin: 0;
}

#preview-testimonial-list {
    display: grid;
    gap: 25px;
    grid-template-columns: 1fr;
}

.testimonial-card {
    padding: 25px;
    border-radius: var(--card-border-radius);
    display: flex;
    align-items: center;
    gap: 20px;
}

.testimonial-card img {
    width: var(--testimonial-img-size);
    height: var(--testimonial-img-size);
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.testimonial-content h3 {
    font-size: 1.1em;
    margin-bottom: 5px;
    font-weight: 600;
}

.testimonial-content p {
    font-style: italic;
    opacity: 0.9;
}

.testimonial-content * { color: var(--card-text); }


#map-section {
    padding: 40px;
    transition: all 0.5s;
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

#map-section.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 40px;
}

#map-container {
    width: 100%;
    height: 350px;
}

#map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* ---- PREVIEW DO CATÁLOGO: RODAPÉ ---- */
.catalog-cta-footer {
    text-align: center;
    padding: 40px 0;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background-color: #25D366;
  color: white;
  text-decoration: none;
  border-radius: 50px;
  border: none;
  outline: 2px solid #1DA851;
  outline-offset: 4px; /* Espaço entre o botão e a borda */
  font-size: 1em;
  font-weight: 600;
}

.cta-button:hover {
  background-color: #1DA851;
  color: #fff;
}

#main-footer {
    padding: 20px;
    text-align: center;
    font-size: 0.9em;
}

/* ---- TEMAS DE CORES ---- */
.theme-light  { --bg-color: #ffffff; --text-color: #555; --heading-color: #000; --accent-color: #4a90e2; --card-bg: #fdfdfd; --card-text: #555; --section-bg: #f9f9f9; --footer-bg: #f1f1f1; --footer-text: #888; }
.theme-dark   { --bg-color: #1a1a1a; --text-color: #ccc; --heading-color: #fff; --accent-color: #58a6ff; --card-bg: #2c2c2c; --card-text: #bbb; --section-bg: #222; --footer-bg: #111; --footer-text: #777; }
.theme-sky    { --bg-color: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); --text-color: #1f3b61; --heading-color: #fff; --accent-color: #66a6ff; --card-bg: rgba(255,255,255,0.85); --card-text: #333; --section-bg: rgba(255,255,255,0.5); --footer-bg: rgba(102,166,255,0.3); --footer-text: #fff; }
.theme-sunset { --bg-color: linear-gradient(135deg, #ffc3a0 0%, #ffafbd 100%); --text-color: #5c3b2b; --heading-color: #fff; --accent-color: #d95868; --card-bg: rgba(255,255,255,0.85); --card-text: #333; --section-bg: rgba(255,255,255,0.5); --footer-bg: rgba(255,175,189,0.3); --footer-text: #fff; }
.theme-forest { --bg-color: #3d5543; --text-color: #e0e0e0; --heading-color: #fff; --accent-color: #a5d6a7; --card-bg: #4a6851; --card-text: #d0d0d0; --section-bg: #334739; --footer-bg: #2b3a2f; --footer-text: #aaa; }
.theme-ocean  { --bg-color: #102a43; --text-color: #d1e2f3; --heading-color: #fff; --accent-color: #63a4ff; --card-bg: #1f4266; --card-text: #b0c4de; --section-bg: #0f243a; --footer-bg: #0a1d2e; --footer-text: #9cb3c9; }
.theme-luxury { --bg-color: #121212; --text-color: #e0e0e0; --heading-color: #ffd700; --accent-color: #ffd700; --card-bg: #1f1f1f; --card-text: #c0c0c0; --section-bg: #1a1a1a; --footer-bg: #000; --footer-text: #b3a171; }
.theme-rose   { --bg-color: #fce4ec; --text-color: #6a4f4b; --heading-color: #c2185b; --accent-color: #c2185b; --card-bg: #fff; --card-text: #5d4037; --section-bg: #f8dae4; --footer-bg: #f6cedc; --footer-text: #8c4b4d; }
.theme-mint   { --bg-color: #e0f2f1; --text-color: #004d40; --heading-color: #00796b; --accent-color: #00796b; --card-bg: #fff; --card-text: #004d40; --section-bg: #d0e9e8; --footer-bg: #c8e6e4; --footer-text: #004d40; }
.theme-mono   { --bg-color: #e0e0e0; --text-color: #424242; --heading-color: #000; --accent-color: #212121; --card-bg: #f5f5f5; --card-text: #616161; --section-bg: #d6d6d6; --footer-bg: #cccccc; --footer-text: #424242; }

#catalog-preview {
    background: var(--bg-color);
}

/* ---- RESPONSIVIDADE ---- */
@media (max-width: 992px) {
    .generator-container {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    #sidebar {
        width: 100%;
    }

    #preview-panel {
        padding: 20px 10px;
    }
}

/* ---- LAYOUTS DE PRODUTOS (ATUALIZADO) ---- */
#preview-product-list.layout-cards {
    display: grid;
    gap: 30px;
    /* Por padrão (mobile), 1 coluna */
    grid-template-columns: 1fr;
}

/* Quando o catálogo está em modo normal ou largo, 3 colunas */
#catalog-preview.width-normal #preview-product-list.layout-cards,
#catalog-preview.width-large #preview-product-list.layout-cards {
    /* Usando media query para garantir que só se aplique em telas maiores */
    @media (min-width: 768px) {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Quando o catálogo está em modo tela cheia, 5 colunas */
#catalog-preview.width-full #preview-product-list.layout-cards {
     /* Usando media query para garantir que só se aplique em telas maiores */
    @media (min-width: 1200px) {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ---- NOVOS ESTILOS: SEPARADOR DE CATEGORIA ---- */
.add-separator-container {
    grid-column: 1 / -1; /* Ocupa todas as colunas do grid */
    text-align: center;
    padding: 10px 0;
    margin: 15px 0;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
}

.add-separator-btn {
    background: #e0eaf1;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.add-separator-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.category-separator {
    grid-column: 1 / -1; /* Ocupa todas as colunas do grid */
    background: rgba(128, 128, 128, 0.05);
    padding: 25px;
    margin: 20px 0;
    border-radius: var(--card-border-radius);
    border-left: 5px solid var(--secondary-color);
    position: relative;
}

.category-separator input,
.category-separator textarea {
    background: transparent;
    border: none;
    border-bottom: 2px solid #ddd;
    border-radius: 0;
    padding-left: 0;
    margin-bottom: 10px;
}
.category-separator input:focus,
.category-separator textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.category-separator input {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--heading-color);
}

.category-separator textarea {
    font-size: 1em;
    color: var(--text-color);
    resize: vertical;
    min-height: 40px;
}

/* Botão de remover no separador (usando classes de botões de ação já existentes) */
.category-separator .card-actions {
    top: 15px;
}

/* ======================================================= */
/*  COLE ESTE BLOCO NO SEU ARQUIVO style.css               */
/* ======================================================= */

/* ---- ESTILO DA MENSAGEM FINAL ---- */
#final-message-section {
    padding: 40px;
    text-align: center;
    transition: all 0.5s;
    opacity: 1;
    max-height: 1000px;
    overflow: hidden;
}

#final-message-section.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 40px;
    margin: 0;
}

#final-message-section h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--heading-color);
}

#final-message-section p {
    font-size: 1.1em;
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-color);
    white-space: pre-wrap; /* Mantém quebras de linha do textarea */
}

/* ---- ESTILO DOS ÍCONES DE REDES SOCIAIS ---- */
#social-links-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

#social-links-container a {
    color: var(--text-color); /* Usa a cor de texto do tema */
    font-size: 1.8em;         /* Tamanho dos ícones */
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
}

#social-links-container a:hover {
    opacity: 1;
    transform: scale(1.15); /* Efeito de 'pop' no hover */
}

.publish-button {
    background-color: #6a1b9a; /* Um roxo para diferenciar */
    margin-bottom: 10px;
}
.publish-button:hover {
    background-color: #4a148c;
}
.publication-section small {
    display: block;
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 0.8em;
    color: #777;
}

.section-title-wrapper {
    text-align: center; /* Centraliza o texto (o h2) dentro dele */
    width: 100%;        /* Garante que a seção ocupe toda a largura disponível */
    margin-bottom: 30px; /* Cria um bom espaçamento antes da lista de produtos */
}