/* Reset Premium e Responsivo */
* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f3f4f6; /* Cinza suave */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    height: 100vh;
    height: 100dvh; /* Altura dinâmica para mobile */
    overflow: hidden;
}

/* Container Principal */
.container {
    width: 100%;
    max-width: 600px; /* Foco na leitura */
    background-color: #ffffff;
    height: 100%;
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header Limpo */
.header {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #111827;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    z-index: 10;
}

.header-title h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.5px; }
.header-status { font-size: 12px; color: #6b7280; font-weight: 400; display: block; margin-top: 2px; }

/* Botões do Header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: #f3f4f6;
    color: #374151;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    transition: background 0.2s;
}
.btn-icon:hover { background: #e5e7eb; }

/* Botão de Limpar (Vermelho Suave) */
.btn-limpar {
    background: #fef2f2;
    color: #ef4444;
}
.btn-limpar:hover { background: #fee2e2; }

.btn-sair {
    color: #ef4444;
    text-decoration: none;
    font-size: 13px;
    margin-left: 10px;
    font-weight: 500;
}

/* Login Minimalista */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f9fafb;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.04);
    text-align: center;
    width: 100%;
    max-width: 340px;
    transition: transform 0.3s ease;
}

.login-input {
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    border: 2px solid #f3f4f6;
    border-radius: 14px;
    font-size: 16px; /* Evita zoom no iPhone */
    background: #f9fafb;
    transition: all 0.2s;
}
.login-input:focus { border-color: #3b82f6; background: white; }

.login-btn {
    background: #111827; /* Preto Premium */
    color: white;
    border: none;
    padding: 16px;
    width: 100%;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: transform 0.1s;
}
.login-btn:active { transform: scale(0.98); }

/* Área de Chat */
.chat-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Balões */
.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 8px; /* Menor espaço entre msgs */
    position: relative;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Minhas Mensagens (Azul Premium) */
.message-bubble.mine {
    align-self: flex-end;
    background: #3b82f6 !important;
    color: white !important;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

/* Mensagens dos Outros */
.message-bubble.others {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #1f2937;
}

.msg-header { font-size: 12px; font-weight: 700; margin-bottom: 2px; display: block; letter-spacing: 0.3px; }

.msg-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 8px;
    display: block;
    cursor: pointer;
}

/* Área de Input */
.input-area {
    background: #ffffff;
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
    z-index: 20;
    /* Ajuste para Safe Area do iPhone */
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.form-envio {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    padding: 6px 8px;
    border-radius: 30px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}
.form-envio:focus-within { border-color: #3b82f6; background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

.input-wrapper { flex: 1; position: relative; }
input[type="text"] {
    width: 100%;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 16px; /* Importante para mobile */
}

.file-upload {
    color: #9ca3af;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.file-upload:hover { color: #3b82f6; }

.btn-enviar {
    background: #3b82f6;
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
.btn-enviar:active { transform: scale(0.92); }