/* --- Configurações Gerais e Variáveis de Cor --- */
:root {
    --cor-primaria: #000000;
    --cor-secundaria: #333333; 
    --cor-fundo: #FFFFFF; 
    --cor-fundo-alternativa: #f4f4f4; 
    --cor-texto: #333333;
    --cor-texto-claro: #FFFFFF;
    --sombra-box: 0 4px 10px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* --- ESTRUTURA CORRIGIDA PARA O STICKY FOOTER --- */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.6;
}

.content-wrapper {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
}
/* --- FIM DA ESTRUTURA DO STICKY FOOTER --- */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 60px 0;
}

h1, h2, h3 {
    color: var(--cor-primaria);
    margin-bottom: 20px;
}

/* --- Cabeçalho --- */
.header {
    background-color: var(--cor-fundo);
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--cor-primaria);
    text-decoration: none;
    z-index: 1001;
}

.nav-menu ul {
    list-style: none;
    display: flex;
}

.nav-menu li {
    margin-left: 25px;
}

.nav-menu a {
    text-decoration: none;
    color: var(--cor-secundaria);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--cor-primaria);
}

.menu-toggle {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cor-primaria);
}

/* --- Seção Hero --- */
.hero {
    position: relative;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--cor-texto-claro);
    background: url('Banner.png') no-repeat center center/cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3em;
    color: var(--cor-texto-claro);
    margin-bottom: 10px;
}

/* --- Grid de Imóveis --- */
#imoveis h2 {
    text-align: center;
    margin-bottom: 40px;
}

.imoveis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.imovel-card {
    background-color: var(--cor-fundo);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--sombra-box);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.imovel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.imovel-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    margin-top: 0;
    font-size: 1.2em;
}

.localizacao {
    color: #666;
    margin-bottom: 15px;
}

.caracteristicas {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    color: #555;
    font-size: 0.9em;
}

.preco {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--cor-primaria);
    margin-bottom: 20px;
}

.btn-detalhes {
    display: block;
    background-color: var(--cor-primaria);
    color: var(--cor-texto-claro);
    text-align: center;
    padding: 12px;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.btn-detalhes:hover {
    background-color: var(--cor-secundaria);
}

/* --- Seção de Contato --- */
.section-contato {
    background-color: var(--cor-fundo-alternativa);
    padding: 60px 0;
}

#contato h2, #contato p {
    text-align: center;
}

#form-contato {
    max-width: 600px;
    margin: 30px auto 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

.btn-enviar {
    background-color: var(--cor-primaria);
    color: var(--cor-texto-claro);
    border: none;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-enviar:hover {
    background-color: var(--cor-secundaria);
}

/* --- Rodapé --- */
.footer {
    background-color: var(--cor-secundaria);
    color: var(--cor-texto-claro);
    text-align: center;
    padding: 20px 0;
}

/* --- Estilos do Chat Pop-up --- */
.open-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--cor-primaria);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 1001;
}

.chat-popup {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    max-width: 90%;
    height: 450px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    flex-direction: column;
}

.chat-header {
    background-color: var(--cor-secundaria);
    color: white;
    padding: 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.chat-footer {
    padding: 15px;
    display: flex;
    border-top: 1px solid #e0e0e0;
}

#chat-input, #chat-input-admin {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    margin-right: 10px;
}

#send-chat-btn, #send-chat-btn-admin {
    background-color: var(--cor-primaria);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#send-chat-btn:hover, #send-chat-btn-admin:hover {
    background-color: #444;
}

/* --- Estilos para a página de Gestão de Chats --- */
.lista-chats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.chat-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.chat-item:hover {
    border-color: #ccc;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.chat-item-imagem {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}
.chat-item-info {
    flex-grow: 1;
}
.chat-item-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
}
.chat-item-info p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}
.ultima-msg {
    font-style: italic;
}
.chat-item-data {
    font-size: 0.8em;
    color: #999;
}

/* --- Novos Estilos Subtis para as Mensagens do Chat --- */
.chat-body {
    background-color: #f9f9f9;
}

.chat-msg-wrapper {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.msg-remetente {
    font-size: 0.75em;
    color: #888;
    margin-bottom: 4px;
    padding: 0 12px;
}

.msg-texto {
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 0.95em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-msg-wrapper {
    align-self: flex-start;
}
.chat-msg-wrapper .msg-texto {
    background-color: #e5e5ea;
    color: #000;
    border-bottom-left-radius: 4px;
}
.chat-msg-wrapper .msg-remetente {
    align-self: flex-start;
}

.chat-msg-wrapper.msg-propria {
    align-self: flex-end;
}
.chat-msg-wrapper.msg-propria .msg-texto {
    background-color: var(--cor-primaria);
    color: var(--cor-texto-claro);
    border-bottom-right-radius: 4px;
}
.chat-msg-wrapper.msg-propria .msg-remetente {
    align-self: flex-end;
}

#chat-container-admin .chat-body {
    height: 60vh;
}

.chat-msg-sistema {
    text-align: center;
    font-size: 0.9em;
    color: #888;
    width: 100%;
    margin: auto;
}
/* --- ESTILOS PARA A NOVA SEÇÃO DE CONTATO --- */
.contato-wrapper {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 40px;
}

.contato-item {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    width: 300px;
    box-shadow: var(--sombra-box);
    border: 1px solid #eee;
}

.contato-icon {
    font-size: 2.5em;
    color: var(--cor-primaria);
    margin-bottom: 15px;
}

.contato-item h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.contato-item p {
    color: #555;
    font-size: 1em;
}

/* --- ESTILOS PARA CENTRALIZAR PÁGINAS DE LOGIN E REGISTO --- */
.auth-page-wrapper {
    display: flex;
    flex-grow: 1;
    align-items: center;
    justify-content: center;
}

.auth-page-wrapper .container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    max-width: 500px;
    width: 100%;
}
/* --- ESTILOS PARA A NOVA NOTIFICAÇÃO (TOAST) --- */
.chat-notification {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translate(-50%, -20px);
    background-color: var(--cor-secundaria);
    color: var(--cor-texto-claro);
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 2000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 0.95em;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.chat-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}
/* --- ESTILOS PARA BOTÕES DE AÇÃO EM TABELAS --- */
.acoes-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-acao {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--cor-texto-claro);
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.btn-acao:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.btn-editar {
    background-color: #007bff;
}

.btn-apagar {
    background-color: #dc3545;
}
.btn-ferramenta {
    display: inline-block;
    padding: 8px 15px;
    background-color: #6c757d;
    color: var(--cor-texto-claro);
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-left: 20px;
    vertical-align: middle;
}

.btn-ferramenta:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-ferramenta i {
    margin-right: 6px;
}

/* --- MEDIA QUERIES PARA RESPONSIVIDADE --- */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--cor-fundo);
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        flex-direction: column;
        text-align: center;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu ul {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu li {
        margin: 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-menu a {
        display: block;
        padding: 15px 0;
        width: 100%;
    }

    .menu-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 2.5em;
    }

    .section {
        padding: 40px 0;
    }

    .detalhes-imovel {
        flex-direction: column;
    }

    .acoes-cell {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2em;
    }
    .hero p {
        font-size: 1em;
    }

    h1 { font-size: 1.8em; }
    h2 { font-size: 1.5em; }

    .imoveis-grid {
        grid-template-columns: 1fr;
    }

    .caracteristicas {
        font-size: 0.8em;
        flex-wrap: wrap;
        gap: 10px;
    }

    .contato-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .contato-item {
        width: 100%;
        max-width: 320px;
    }

    .chat-popup {
        width: 95%;
        right: 2.5%;
        bottom: 80px;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr { border: 1px solid #ccc; margin-bottom: 10px; }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: left;
    }

    td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    td:nth-of-type(1):before { content: "Imagem"; }
    td:nth-of-type(2):before { content: "Título"; }
    td:nth-of-type(3):before { content: "Preço"; }
    td:nth-of-type(4):before { content: "Ações"; }
}
.btn-apagar-chat {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 16px;
    line-height: 25px;
    cursor: pointer;
    text-align: center;
    margin-left: 10px;
    padding: 0;
}
.btn-apagar-chat:hover {
    background-color: #c82333;
}
.btn-ver {
    background-color: #28a745; /* Cor verde para a ação de visualizar */
}