/* ============================================== */
/* --- ARQUIVO STYLE.CSS - VERSÃO FINAL E CORRIGIDA --- */
/* ============================================== */

/* --- GLOBAIS E VARIÁVEIS DE COR --- */
:root {
    --cor-primaria: #5e35b1; /* Roxo moderno */
    --cor-secundaria: #ffab40; /* Laranja/Âmbar para destaque */
    --cor-fundo: #f4f5f7;
    --cor-texto: #212529;
    --cor-texto-claro: #6c757d;
    --cor-branco: #ffffff;
    --sombra-card: 0 4px 15px rgba(0,0,0,0.08);
    --fonte-principal: 'Nunito Sans', sans-serif;
}

body {
    font-family: var(--fonte-principal);
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.7; 
    margin: 0;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

h1, h2, h3, h4 {
    color: #1c1e21;
    font-family: var(--fonte-principal); 
}

h1, .hero-section h1 { font-size: 2.8rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 2rem; font-weight: 800; }
h3 { font-size: 1.5rem; font-weight: 700; }
h4, .anuncio-card-titulo { font-size: 1.2rem; font-weight: 700; }

a {
    color: var(--cor-primaria);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--cor-secundaria);
    text-decoration: underline;
}

hr {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 30px 0;
}

/* --- CABEÇALHO --- */
.site-header {
    background-color: var(--cor-branco);
    padding: 15px 0;
    margin-bottom: 30px;
    box-shadow: var(--sombra-card);
}
.header-container { /* Adicionado para o Flexbox do cabeçalho */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 0 20px;
}
.logo-container { text-align: left; }
.site-header img { max-height: 45px; width: auto; }
.anunciar-btn-container { text-align: right; }
.btn-anunciar {
    background-color: var(--cor-secundaria);
    color: #fff !important;
    font-weight: bold;
    width: auto;
    padding: 10px 20px;
    font-size: 1rem;
}
.btn-anunciar:hover {
    background-color: #ffc107;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* --- SEÇÃO HERO E BUSCA --- */
.hero-section {
    background: linear-gradient(135deg, var(--cor-primaria) 0%, #7e57c2 100%);
    color: var(--cor-branco);
    padding: 50px 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 30px;
}
.hero-section p { font-size: 1.2em; opacity: 0.9; }
.search-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; background: rgba(255,255,255,0.1); padding: 20px; border-radius: 8px; }
.search-form input { flex: 1 1 300px; border: 1px solid transparent; }
.search-form button { flex: 1 1 150px; background-color: var(--cor-secundaria); font-weight: bold; }
.search-form button:hover { background-color: #ffc107; }

/* --- BOTÕES E FORMULÁRIOS GERAIS --- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], textarea, select {
    width: 100%; padding: 12px; margin: 8px 0; display: inline-block; border: 1px solid #ccc;
    border-radius: 8px; box-sizing: border-box; font-size: 1rem; font-family: var(--fonte-principal);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 2px rgba(94, 53, 177, 0.2);
    outline: none;
}
button, .button {
    background-color: var(--cor-primaria); color: white; padding: 14px 20px; margin: 8px 0;
    border: none; border-radius: 8px; cursor: pointer; width: 100%; font-size: 1.1rem;
    text-decoration: none; display: inline-block; text-align: center; font-family: var(--fonte-principal);
    font-weight: 700; transition: background-color 0.2s, transform 0.1s;
}
button:hover, .button:hover { background-color: #4527a0; transform: translateY(-1px); }
.button-link { padding: 8px 15px; margin-left: 10px; border-radius: 8px; background-color: #f0f2f5; color: var(--cor-texto); font-weight: 500; }
.login-prompt, .user-welcome {
    background-color: var(--cor-branco); padding: 25px; border-radius: 8px;
    text-align: center; margin-bottom: 30px; display: flex;
    justify-content: space-between; align-items: center; flex-wrap: wrap;
}

/* --- FILTROS RÁPIDOS (CIDADES E CATEGORIAS) --- */
.filtros-container { background: var(--cor-branco); padding: 10px 20px 15px 20px; border-radius: 8px; margin-bottom: 30px; box-shadow: var(--sombra-card); }
.filtros-container h3 { margin-top: 10px; }
.cidades-lista, .categorias-lista {
    display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 10px 0;
    -webkit-overflow-scrolling: touch; -ms-overflow-style: none; scrollbar-width: none;
}
.cidades-lista::-webkit-scrollbar, .categorias-lista::-webkit-scrollbar { display: none; }
.cidades-lista a, .categorias-lista a {
    flex-shrink: 0; display: inline-block; padding: 8px 18px; margin-right: 10px;
    background-color: #e9ebee; border-radius: 20px; font-size: 0.9rem;
    color: #333; font-weight: 500; transition: background-color 0.2s, color 0.2s; white-space: nowrap;
}
.cidades-lista a:hover, .categorias-lista a:hover { background-color: var(--cor-primaria); color: var(--cor-branco); text-decoration: none; }

/* --- LAYOUT DE ANÚNCIOS (GRADE DE CARDS) --- */
.anuncios-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}
.anuncio-card {
    background: var(--cor-branco); border-radius: 12px; box-shadow: var(--sombra-card);
    overflow: hidden; display: flex; flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; color: var(--cor-texto);
}
.anuncio-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.12); }
.anuncio-card-imagem { width: 100%; height: 200px; object-fit: cover; }
.anuncio-card-corpo { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.anuncio-card-categoria { font-size: 0.8rem; font-weight: 700; color: var(--cor-primaria); text-transform: uppercase; margin-bottom: 5px; }
.anuncio-card-preco { font-size: 1.4rem; font-weight: 800; color: #27ae60; margin: 10px 0; }
.anuncio-card-local { font-size: 0.9rem; color: var(--cor-texto-claro); border-top: 1px solid #f0f0f0; padding-top: 10px; margin-top: auto; }

/* --- GALERIA DE ANÚNCIO (ver_anuncio.php) --- */
.anuncio-galeria-container {
    position: relative; width: 100%; max-width: 450px; margin: 20px auto;
    border-radius: 12px; overflow: hidden; box-shadow: var(--sombra-card);
    aspect-ratio: 4 / 3; background-color: #f0f2f0;
}
.anuncio-galeria-slide { display: flex; height: 100%; transition: transform 0.4s ease-in-out; }
.anuncio-galeria-slide img { width: 100%; height: 100%; flex-shrink: 0; object-fit: cover; }
.galeria-btn {
    position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.4);
    color: white; border: none; cursor: pointer; padding: 10px; font-size: 18px; z-index: 10;
    border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center;
    justify-content: center; opacity: 0; transition: opacity 0.3s;
}
.anuncio-galeria-container:hover .galeria-btn { opacity: 1; }
.galeria-btn.prev { left: 15px; }
.galeria-btn.next { right: 15px; }

/* --- PRÉ-VISUALIZAÇÃO DE UPLOAD (novo_anuncio.php) --- */
.preview-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; padding: 10px; border: 1px dashed #ccc; border-radius: 8px; min-height: 90px; }
.preview-image-wrapper { position: relative; width: 80px; height: 80px; }
.preview-image { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.remove-image-btn {
    position: absolute; top: -5px; right: -5px; width: 22px; height: 22px; background-color: rgba(0, 0, 0, 0.7);
    color: white; border: 2px solid white; border-radius: 50%; cursor: pointer; display: flex;
    align-items: center; justify-content: center; font-weight: bold; font-size: 12px; line-height: 1;
    transition: background-color 0.2s;
}
.remove-image-btn:hover { background-color: #f44336; }
#image-counter { margin-top: 10px; font-weight: bold; color: var(--cor-texto-claro); }
.progress-wrapper { width: 100%; background-color: #f3f3f3; border: 1px solid #ccc; border-radius: 8px; padding: 4px; margin-top: 15px; display: none; }
.progress-bar { width: 0%; height: 20px; background-color: var(--cor-primaria); border-radius: 4px; text-align: center; color: white; line-height: 20px; font-weight: bold; transition: width 0.4s ease; }
.progress-text { display: block; text-align: center; font-weight: bold; color: var(--cor-texto); margin-top: 5px; }

/* --- PAGINAÇÃO --- */
.paginacao { list-style: none; padding: 0; margin: 40px 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; }
.paginacao li a, .paginacao li span { display: block; padding: 10px 15px; border: 1px solid #ddd; background-color: var(--cor-branco); color: var(--cor-primaria); border-radius: 8px; text-decoration: none; transition: background-color 0.2s, color 0.2s; }
.paginacao li a:hover { background-color: #f0f0f0; text-decoration: none; }
.paginacao li.pagina-atual span { background-color: var(--cor-primaria); color: var(--cor-branco); border-color: var(--cor-primaria); cursor: default; }
.paginacao li.disabled span { background-color: #e9ecef; color: #6c757d; border-color: #dee2e6; cursor: not-allowed; }

/* --- OUTROS ESTILOS --- */
.actions-container { display: flex; flex-wrap: wrap; gap: 10px; }
.actions-container .button { flex-grow: 1; }
.meus-anuncios-lista .meu-anuncio-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #eee; }
.meu-anuncio-item span { flex-grow: 1; }
.anuncio-acoes a { margin-left: 10px; padding: 5px 10px; border-radius: 4px; color: white; font-size: 0.9em; }
.btn-editar { background-color: #2196F3; }
.btn-excluir { background-color: #f44336; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { border: 1px solid #ddd; padding: 8px; text-align: left; }
.admin-table th { background-color: #f2f2f2; }
.chat-box { border: 1px solid #ccc; padding: 10px; height: 400px; overflow-y: scroll; margin-bottom: 10px; background: #f9f9f9; }
.minha-mensagem { text-align: right; margin: 5px; padding: 8px 12px; background-color: #dcf8c6; border-radius: 10px; max-width: 70%; margin-left: auto; word-wrap: break-word;}
.outra-mensagem { text-align: left; margin: 5px; padding: 8px 12px; background-color: #fff; border: 1px solid #eee; border-radius: 10px; max-width: 70%; margin-right: auto; word-wrap: break-word;}
.chat-form { display: flex; }
.chat-form input { flex-grow: 1; margin-right: 10px; }
.anuncio-compartilhado { border-top: 1px dashed #ccc; margin-top: 8px; padding-top: 8px; font-size: 0.9em; }
.share-container { margin-top: 20px; padding-top: 20px; border-top: 1px solid #e0e0e0; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border-radius: 8px; color: white !important; font-weight: bold; text-decoration: none; transition: opacity 0.2s, background-color 0.2s; cursor: pointer; border: none; font-size: 1rem; }
.share-btn:hover { opacity: 0.85; text-decoration: none; color: white !important; }
.share-btn.facebook { background-color: #1877F2; }
.share-btn.whatsapp { background-color: #25D366; }
.share-btn.linkedin { background-color: #0A66C2; }
.share-btn.instagram { background-color: #E4405F; }
.share-btn.telegram { background-color: #0088cc; }
.share-btn.copiar { background-color: #6c757d; }
.ver-mais-container { text-align: center; padding: 20px 0; }
#ver-mais-btn { width: auto; padding: 12px 30px; font-weight: bold; background-color: var(--cor-secundaria); cursor: pointer; }
#ver-mais-btn:disabled { background-color: #ccc; cursor: not-allowed; }
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--cor-primaria); border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; display: none; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.aviso-sem-anuncios { background-color: #fff3cd; border: 1px solid #ffeeba; color: #856404; padding: 20px; margin-bottom: 30px; border-radius: 8px; text-align: center; }
.aviso-sem-anuncios .button { width: auto; display: inline-block; margin-top: 10px; }
/* ================================================= */
/* --- EXEMPLO DE MEDIA QUERY PARA TEMA MOBILE --- */
/* Estas regras SÓ SÃO APLICADAS em telas com largura máxima de 768px (tablets e celulares) */
/* ================================================= */

@media (max-width: 768px) {

    /* Muda a grade de anúncios para uma lista vertical */
    .anuncios-lista {
        display: flex;
        flex-direction: column; /* Coloca os itens um embaixo do outro */
        gap: 15px;
    }

    /* Transforma o card em um item de lista com imagem ao lado */
    .anuncio-card {
        flex-direction: row; /* Coloca a imagem ao lado do corpo do card */
        gap: 15px;
    }

    /* Ajusta o tamanho da imagem na lista mobile */
    .anuncio-card-imagem {
        width: 100px;
        height: 100px;
        flex-shrink: 0; /* Impede a imagem de encolher */
    }

    /* Diminui os títulos principais no celular */
    h1, .hero-section h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }

    /* Esconde a seção de filtros rápidos no celular para economizar espaço */
    .filtros-container {
        display: none;
    }
}