/* ============================================================ */
/* ===== 1. RESET E DEFINIÇÕES GLOBAIS ===== */
/* ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  line-height: 1.6;
  background-color: #f0f2f5;
}

/* ============================================================ */
/* ===== 2. CABEÇALHO (STICKY E ALINHAMENTO) ===== */
/* ============================================================ */
header {
  background: #007BFF;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
}

.top-bar h1 { font-size: 1.8rem; margin: 0; line-height: 1; }

.logo-link {
  color: white !important;
  text-decoration: none;
  cursor: pointer;
  display: block;
}

.top-bar nav { display: flex; align-items: center; }

.top-bar nav a {
  color: white !important;
  text-decoration: none;
  margin-left: 1.5rem;
  font-weight: bold;
  transition: opacity 0.2s;
}

#nome-usuario-logado { 
    color: #FFD700 !important; 
    font-weight: bold; 
    padding-left: 20px; 
    border-left: 1px solid rgba(255,255,255,0.3); 
    margin-left: 10px;
}

/* ============================================================ */
/* ===== BADGES E NOTIFICAÇÕES ===== */
/* ============================================================ */
.badge-notificacao {
  background-color: #25D366;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
  display: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.badge-sos-alerta {
  background-color: #ff4d4d !important;
  animation: pulsar 2s infinite;
}

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

/* ============================================================ */
/* ===== 3. PÁGINA HOME (LOGIN/CADASTRO) - AJUSTE FINAL ===== */
/* ============================================================ */
.hero-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: flex-end; /* Mantém o formulário na direita */
  padding: 0 5%;
  overflow: hidden;
  /* CORRIGE A FAIXA BRANCA: Define a cor de fundo igual ao azul da imagem */
  background-color: #a5c9e1; 
}

.hero-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #ffffff; /* Fundo branco para mesclar perfeitamente */
  background-image: url('images/banner.jpg');
  
  /* --- O SEGREDO DO ENQUADRAMENTO PERFEITO --- */
  background-size: contain !important; /* Faz a imagem caber inteira sem NENHUM corte */
  background-position: center center !important; /* Centraliza no meio exato da tela */
  background-repeat: no-repeat;
}

/* Escondemos a tag img do HTML pois agora usamos background-image */
.hero-left img {
  display: none;
}

.slogan-box {
  position: absolute;
  top: 40px;
  left: 40px;
  z-index: 50;
}

.slogan-text {
  font-size: 1.6rem;
  color: #007BFF;
  font-weight: bold;
  max-width: 500px;
  background: transparent; 
  padding: 0; 
  box-shadow: none;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8); 
}

.hero-right {
  position: relative;
  z-index: 50;
  width: 420px;
  background: rgba(255, 255, 255, 0.98);
  padding: 2.5rem;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #007BFF #f0f0f0;
}

.hero-right::-webkit-scrollbar { width: 6px; }
.hero-right::-webkit-scrollbar-thumb { background-color: #007BFF; border-radius: 10px; }

.hero-right h2 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.hero-right label { font-weight: bold; display: block; margin-top: 15px; font-size: 0.9rem; }

.hero-right input {
  width: 100%; 
  padding: 12px; 
  margin-top: 5px; 
  border: 1px solid #ddd; 
  border-radius: 8px; 
  font-size: 1rem;
}

.hero-right button {
  width: 100%; 
  background: #007BFF; 
  color: white; 
  border: none; 
  padding: 14px; 
  border-radius: 8px; 
  cursor: pointer; 
  font-weight: bold; 
  font-size: 1.1rem; 
  margin-top: 20px;
  transition: 0.3s;
}

.hero-right button:hover { background: #0056b3; transform: translateY(-2px); }

.extra-options { text-align: center; margin-top: 15px; }
.extra-options a { color: #007BFF; text-decoration: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; }

/* ============================================================ */
/* ===== 4. PÁGINA DE INTERESSES ===== */
/* ============================================================ */
.interesses-page {
  background-image: url('images/interesses.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

.overlay-dark { background: rgba(0, 0, 0, 0.75); min-height: 100vh; }

.zoom-container {
  width: 100%; max-width: 1800px; transform: scale(0.9); transform-origin: top center; margin: 0 auto;
}

.grid-interesses {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 15px; margin-bottom: 20px;
}

.card-interesse {
  background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.3); display: flex; flex-direction: column;
}

.card-title {
  color: #007BFF; font-weight: bold; padding: 12px 15px; border-bottom: 1px solid #eee; font-size: 1.1rem; background: #ffffff;
}

.card-body { padding: 10px 15px; }
.card-body label { display: flex; align-items: center; margin-bottom: 8px; font-size: 0.85rem; color: #333; cursor: pointer; }
.card-body input { margin-right: 8px; }

.localizacao-box {
  background: #fff; padding: 20px; border-radius: 8px; margin-top: 20px; color: #333;
}

/* ============================================================ */
/* ===== 5. WIDGET DE CHAT (FEED) ===== */
/* ============================================================ */
#janela-chat {
  display: none;
  position: fixed; bottom: 0; right: 20px; width: 330px; height: 450px;
  background: #f0f2f5; border-radius: 12px 12px 0 0; box-shadow: 0 5px 40px rgba(0,0,0,0.2);
  z-index: 1000; flex-direction: column; overflow: hidden; border: 1px solid #d1d7db;
}

.chat-header-widget {
  background: #007BFF; color: white; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; font-weight: bold;
}
.chat-header-widget button { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

#chat-body {
  flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  background-image: radial-gradient(#ddd 1px, transparent 1px); background-size: 20px 20px; 
}

.widget-msg {
  padding: 8px 12px; border-radius: 15px; max-width: 85%; font-size: 0.9rem; position: relative;
}
.widget-msg-sent { align-self: flex-end; background-color: #007BFF; color: white; }
.widget-msg-received { align-self: flex-start; background-color: white; color: #333; }

.chat-footer-widget {
  background: white; padding: 10px; display: flex; align-items: center; gap: 8px; border-top: 1px solid #ddd;
}
.chat-footer-widget input {
  flex: 1; padding: 10px 15px; border-radius: 20px; border: 1px solid #ddd; outline: none;
}
.chat-footer-widget button {
  background: #007BFF; color: white; border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
}

/* ============================================================ */
/* ===== 6. PÁGINA DE MENSAGENS (FULL PAGE) ===== */
/* ============================================================ */
.msg-page-background {
  background-color: #f0f2f5; height: calc(100vh - 60px); display: flex; justify-content: center; padding: 20px;
}

.msg-container {
  display: flex; width: 100%; max-width: 1200px; gap: 20px; height: 100%;
}

.msg-sidebar {
  width: 320px; background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; overflow: hidden;
}

.contact-item {
  display: flex; align-items: center; padding: 15px; border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.contact-item.active { background-color: #e6f2ff; border-left: 4px solid #007BFF; }

.avatar-circle {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: #007BFF;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
}

.contact-item.unread .avatar-circle {
  background-color: #25D366 !important;
  box-shadow: 0 0 8px rgba(37, 211, 102, 0.4);
}

.msg-chat-area {
  flex: 1; background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; overflow: hidden;
}

.chat-area-header {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.chat-messages-scroll {
  flex: 1; padding: 20px; overflow-y: auto; background-image: radial-gradient(#e4e6eb 1px, transparent 1px); background-size: 20px 20px; display: flex; flex-direction: column; gap: 15px;
}

.chat-input-area {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 0.95rem;
    background-color: #f9f9f9;
    transition: border 0.3s;
}

.chat-input-area input:focus {
    border-color: #007BFF;
    background-color: #fff;
}

.btn-send {
    background-color: #007BFF;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.2s, background 0.3s;
    flex-shrink: 0;
}

.btn-send:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.bubble { max-width: 70%; padding: 10px 15px; font-size: 0.95rem; }
.bubble-received { align-self: flex-start; background-color: #f0f2f5; border-radius: 18px 18px 18px 4px; }
.bubble-sent { align-self: flex-end; background-color: #007BFF; color: white; border-radius: 18px 18px 4px 18px; }

/* ============================================================ */
/* ===== 7. PÁGINA DE PERFIL ===== */
/* ============================================================ */
.profile-page-background {
  background-color: #f0f2f5; min-height: calc(100vh - 70px); display: flex; justify-content: center; padding: 40px 20px;
}

.profile-container {
  width: 100%; max-width: 800px; background: white; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); overflow: hidden; display: flex; flex-direction: column;
}

.profile-header-section {
  background: linear-gradient(135deg, #007BFF 0%, #0056b3 100%); padding: 40px 20px; display: flex; flex-direction: column; align-items: center; color: white;
}

.profile-avatar-large {
  width: 100px; height: 100px; background-color: white; color: #007BFF; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; margin-bottom: 15px; border: 4px solid rgba(255,255,255,0.3);
}

.profile-body { padding: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; }

/* ============================================================ */
/* ===== 8. BOTÕES DE FILTRO E SOS (FEED) ===== */
/* ============================================================ */

/* Estilo padrão (Inativo) */
#btn-sos {
    color: #ff4d4d !important; 
    font-weight: bold;
    border: 1px solid #ff4d4d;
    background-color: transparent;
    transition: 0.3s;
}

/* Estilo Selecionado (Ao clicar) */
/* Usamos o ID junto com a classe para garantir que o branco vença o vermelho */
#btn-sos.ativo-sos {
    background-color: #ff4d4d !important; 
    color: white !important; /* Agora a letra branca tem prioridade total */
}

/* Destaque Dourado para Publicidade */
#btn-promo.ativo {
    background-color: #FFD700 !important; 
    color: #333 !important;
    border-color: #DAA520 !important;
}

/* Animação pulsante para cards de SOS no feed */
@keyframes alerta-sos {
  0% { box-shadow: 0 0 5px #ff4d4d; }
  50% { box-shadow: 0 0 20px #ff4d4d; border-color: #ff0000; }
  100% { box-shadow: 0 0 5px #ff4d4d; }
}

.card-sos-urgente {
  animation: alerta-sos 1.5s infinite;
  border: 2px solid #ff4d4d !important;
}

/* ============================================================ */
/* ===== 9. RESPONSIVIDADE (MOBILE & PWA) ===== */
/* ============================================================ */
@media (max-width: 768px) {
    /* --- Ajuste da Barra Superior --- */
    .top-bar { 
        flex-direction: column; 
        padding: 10px;
        gap: 10px; 
        text-align: center;
    }
    
    .top-bar h1 { 
        font-size: 1.8rem; 
        margin: 0; 
    }
    
    .top-bar nav { 
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .top-bar nav a { 
        margin: 0 5px; 
        font-size: 0.85rem; 
        padding: 5px 8px;
    }

    /* --- Ajuste da Home (Login) --- */
    .hero-container { 
        justify-content: center; 
        padding: 20px; 
        height: auto; 
        min-height: calc(100vh - 70px); 
    }
    
    .hero-right { 
        width: 100%; 
        max-height: none; 
    }

    /* --- MÁGICA RESPONSIVA: IMAGEM MOBILE NA DIV HERO --- */
    .hero-left {
        background-image: url('images/banner-mobile.jpg?v=2') !important;
        background-position: center center !important;
        background-attachment: scroll !important;
    }
    
    /* Esconde o slogan gigante na tela de login no celular para dar espaço ao formulário */
    .slogan-box, .slogan-text {
        display: none !important;
    }

    /* --- Ajustes Gerais --- */
    .form-grid { grid-template-columns: 1fr; }
    .msg-sidebar { display: none; } 
    
    /* Reduz títulos gigantes se houver */
    body > h1, body > h2, .main-content h1 {
         font-size: 2.5rem; 
         padding: 0 15px; 
         word-wrap: break-word; 
    }
}

/* ============================================================ */
/* ===== 10. AJUSTES FINOS PARA IPHONE (NOTCH E ÁREA SEGURA) ===== */
/* ============================================================ */
header {
    /* Impede que o topo do site fique escondido atrás do relógio/sinal do iPhone */
    padding-top: env(safe-area-inset-top);
}

body {
    /* Impede que o final da tela seja cortado pela barra de navegação gestual do iPhone */
    padding-bottom: env(safe-area-inset-bottom);
}