/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #d9dbd5; /* Fundo neutro externo */
    overflow: hidden;
    position: fixed; /* Prevents bouncing/scrolling on iOS */
    top: 0;
    left: 0;
}

/* Container Principal */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Usa 100% já que o body é fixed */
    width: 100%;
    max-width: 500px; /* Limite para parecer app no desktop */
    margin: 0 auto;
    background-color: #efeae2; /* Fundo do chat estilo WhatsApp */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
}

/* Cabeçalho */
.header {
    background-color: #008069; /* Verde WhatsApp */
    color: white;
    padding: 10px 15px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-icon {
    cursor: pointer;
    opacity: 0.9;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-info {
    display: flex;
    flex-direction: column;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
}

.header p {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 2px;
}

.verified-badge {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Área de Chat */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); /* Padrão sutil do WhatsApp */
    background-size: contain;
}

/* Bolhas de Mensagem */
.message {
    max-width: 85%;
    width: fit-content;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    word-break: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.system-msg {
    align-self: flex-start;
    background-color: #ffffff;
    color: #111b21;
    border-top-left-radius: 0;
}

.system-msg::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 10px solid #ffffff;
    border-left: 10px solid transparent;
}

.user-msg {
    align-self: flex-end;
    background-color: #d9fdd3; /* Verde claro WhatsApp */
    color: #111b21;
    border-top-right-radius: 0;
}

.user-msg::before {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-top: 10px solid #d9fdd3;
    border-right: 10px solid transparent;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    display: block;
}

/* Card de Boas-vindas */
.welcome-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid #eaeaea;
    width: fit-content;
}

.card-image {
    width: 100%;
    height: auto;
    border-radius: 10px 10px 0 0;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 15px;
    text-align: center;
}

.card-content h3 {
    color: #008069;
    font-size: 16px;
    margin-bottom: 8px;
}

.card-content p {
    color: #555;
    font-size: 13px;
    margin-bottom: 15px;
}

.welcome-card .chat-btn {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 5px;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

/* Botões no Chat */
.btn-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.chat-btn {
    background-color: #008069;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: left;
    text-decoration: none;
    font-size: 14.5px;
    width: 100%;
    box-sizing: border-box;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 128, 105, 0.3);
    white-space: normal;
    line-height: 1.3;
}

.chat-btn:hover {
    background-color: #016b58;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 128, 105, 0.4);
}

.chat-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 128, 105, 0.3);
}

.chat-btn.secondary {
    background-color: #ffffff;
    color: #008069;
    border: 1px solid #008069;
    box-shadow: none;
}

.chat-btn.secondary:hover {
    background-color: #f0fdf4;
}

/* Opções de Negociação */
.option-card {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    margin-bottom: 5px;
    border-left: 4px solid #008069;
}

.option-card h4 {
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
}

.option-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.highlight {
    color: #008069;
    font-weight: 700;
    font-size: 16px;
}

/* Rodapé / Input */
.footer {
    padding: 10px 15px;
    background-color: #f0f2f5;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    width: 100%;
}

.footer-content {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #54656f;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}

.attach-btn:hover {
    color: #111b21;
}

.input-wrapper {
    flex: 1;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
}

#userInput {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    color: #333;
    background: transparent;
}

#userInput::placeholder {
    color: #888;
}

#sendBtn {
    background: #008069;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

#sendBtn:hover {
    background: #016b58;
}

#sendBtn svg {
    width: 18px;
    height: 18px;
    margin-left: -2px; /* Ajuste visual do ícone de enviar */
}

/* Responsividade */
@media (max-width: 500px) {
    .app-container {
        width: 100%;
        max-width: none;
        height: 100%;
    }
}

@media (max-width: 480px) {
    body {
        margin: 0;
        padding: 0;
    }

    .app-container {
        max-width: 100%;
        height: 100%;
    }

    .chat-area {
        padding: 8px;
    }

    .footer-content {
        gap: 8px;
    }

    .input-wrapper {
        padding: 10px 12px;
    }
}
