/* ========================================
   CHAT DE RESERVA — estilos do pop-up (módulo js/chat-reserva.js)

   Antes ficavam dentro do style.css. Foram movidos para cá, sem mudar
   nada, para o chat poder ser copiado para outro site junto com o JS.
   Usa as variáveis --primary, --accent e --text da página; se ela não as
   definir, valem os verdes do Mirador (valores padrão em cada var()).
   ========================================= */
/* ========================================
   POP-UP DE RESERVA
   ========================================= */

/* Overlay escuro de fundo */
.popup-overlay {
    display: none; /* Oculto por padrão */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

/* Quando o pop-up está ativo */
.popup-overlay.active {
    display: flex;
}

/* Container do conteúdo do pop-up */
.popup-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* Botão fechar (X) */
.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* Popup no formato de chat (sobrescreve .popup-content) */
.popup-content.chat-popup {
    display: flex;
    flex-direction: column;
    max-width: 400px;
    width: 90%;
    height: 600px;
    max-height: 85vh;
    padding: 0;
    overflow: hidden; /* o scroll fica só nas mensagens, não no popup inteiro */
}

/* Cabeçalho do chat */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary, #003f2c);
    color: #fff;
    padding: 16px 50px 16px 20px; /* espaço à direita pro botão fechar */
    flex-shrink: 0;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary, #003f2c);
    flex-shrink: 0;
}

.chat-header strong {
    display: block;
    font-size: 0.95rem;
}

.chat-status {
    font-size: 0.72rem;
    opacity: 0.85;
}

/* Área de mensagens (rolagem só aqui) */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f2f2f2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Balão de mensagem */
.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    white-space: pre-line;
}

.msg-bot {
    align-self: flex-start;
    background: #fff;
    color: var(--text, #484848);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.msg-user {
    align-self: flex-end;
    background: var(--accent, #4caf50);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Indicador de "digitando..." */
.msg-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.msg-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #bbb;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Bloco interativo (botões de opção ou campo de texto) - agora fica
   DENTRO do fluxo de mensagens, logo após a pergunta do bot, em vez
   de ficar numa barra fixa embaixo do popup */
.chat-interactive {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 90%;
}

/* Botão de opção (ex: escolher o chalé, escolher hóspedes) */
.chat-option-btn {
    background: #fff;
    border: 2px solid var(--primary, #003f2c);
    color: var(--primary, #003f2c);
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

.chat-option-btn:hover {
    background: var(--primary, #003f2c);
    color: #fff;
}

/* Campo de texto (datas) dentro do chat */
.chat-text-input {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: inherit;
    font-size: 16px; /* precisa ser 16px+ senão o iOS Safari dá zoom sozinho ao focar */
    box-sizing: border-box;
    background: #fff;
}

/* Wrapper do campo de data (check-in/check-out) */
.chat-date-field {
    display: flex;
    flex: 1;
    min-width: 140px;
}

/* Input nativo type="date" - usa o seletor de calendário
   do próprio navegador/celular (ícone já vem incluso) */
.chat-date-input {
    width: 100%;
}

/* Botão de enviar resposta de texto */
.chat-send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--accent, #4caf50);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   ANIMAÇÕES DO POP-UP
   ========================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVIDADE MOBILE - POP-UP
   ========================================= */
@media (max-width: 768px) {
    .popup-content {
        max-width: 95%;
        margin: 20px;
    }

    .popup-content.chat-popup {
        height: 80vh;
    }
}


/* ========================================
   NOVO NA V2: campo de WhatsApp com bandeira (intl-tel-input) e aviso de erro
   ========================================= */
.chat-phone-field {
    display: flex;
    flex: 1;
    min-width: 200px;
}

.chat-phone-field .iti {
    width: 100%;
    box-sizing: border-box;
}

.chat-phone-field .iti input.chat-text-input {
    width: 100%;
    min-width: 0;
}

/* a lista de países abre fora do chat (dropdownContainer: body) e precisa ficar acima do pop-up (z-index 9999) */
.iti--container {
    z-index: 10001 !important;
}

/* aviso de telefone inválido (balão do bot, em tom de alerta) */
.msg-aviso {
    border-left: 3px solid #e74c3c;
}
