* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(160deg, #0d3b5e 0%, #1a5276 30%, #2e86ab 70%, #48b1bf 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%; max-width: 520px; height: 720px;
    background: #fff; border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    display: flex; flex-direction: column; overflow: hidden;
    animation: slideUp 0.4s ease;
}

.chat-header {
    background: linear-gradient(135deg, #0d3b5e 0%, #1a5276 50%, #2e86ab 100%);
    color: white; padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.chat-header-icon {
    width: 42px; height: 42px; background: rgba(255,255,255,0.15);
    border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 1.4rem;
}
.chat-header h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
.header-status { font-size: 0.75rem; opacity: 0.8; font-weight: 400; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.status-dot { width: 7px; height: 7px; background: #2ecc71; border-radius: 50%; display: inline-block; }

.btn-new-chat {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
    color: white; padding: 8px 14px; border-radius: 10px; cursor: pointer;
    font-size: 0.8rem; font-family: inherit; font-weight: 500; transition: all 0.2s;
}
.btn-new-chat:hover { background: rgba(255,255,255,0.25); }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px; background: #f0f4f8; }
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #c0c8d1; border-radius: 3px; }

.message { margin-bottom: 16px; display: flex; flex-direction: column; animation: fadeIn 0.3s ease; }
.message.user { align-items: flex-end; }
.message.bot { align-items: flex-start; }
.message-content { max-width: 82%; padding: 12px 16px; border-radius: 18px; font-size: 0.93rem; line-height: 1.5; }
.message.user .message-content { background: linear-gradient(135deg, #1a5276, #2471a3); color: white; border-bottom-right-radius: 6px; }
.message.bot .message-content { background: white; color: #2c3e50; border-bottom-left-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }

.options-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.option-button {
    background: #eaf4fb; border: 1.5px solid #2e86ab; color: #1a5276;
    padding: 9px 16px; border-radius: 20px; cursor: pointer;
    font-size: 0.88rem; font-weight: 500; font-family: inherit; transition: all 0.2s ease;
}
.option-button:hover { background: #2e86ab; color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(46,134,171,0.3); }

.deeplink-button {
    display: inline-block; background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white; padding: 12px 24px; border-radius: 25px; text-decoration: none;
    font-weight: 600; font-size: 0.93rem; margin-top: 10px; transition: all 0.2s ease;
}
.deeplink-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(39,174,96,0.4); }
.deeplink-button.hora-proxima { background: linear-gradient(135deg, #2980b9 0%, #3498db 100%); }
.deeplink-button.hora-proxima:hover { box-shadow: 0 6px 20px rgba(41,128,185,0.4); }

.chat-input-container { padding: 16px 20px; background: white; border-top: 1px solid #e8ecf1; display: flex; gap: 10px; }
.chat-input {
    flex: 1; padding: 12px 18px; border: 2px solid #e0e6ed; border-radius: 25px;
    font-size: 0.95rem; font-family: inherit; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s; background: #f8fafc;
}
.chat-input:focus { border-color: #2e86ab; box-shadow: 0 0 0 3px rgba(46,134,171,0.1); background: #fff; }

.send-button {
    width: 48px; height: 48px; background: linear-gradient(135deg, #1a5276 0%, #2e86ab 100%);
    color: white; border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease; flex-shrink: 0;
}
.send-button:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(26,82,118,0.4); }
.send-button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.typing-indicator { display: flex; gap: 5px; padding: 15px; }
.typing-indicator span { width: 9px; height: 9px; background: #2e86ab; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

.chat-link { color: #2e86ab; text-decoration: underline; display: inline-block; word-break: keep-all; }
.chat-link:hover { color: #1a5276; }

.error-message { background: #fef2f2; color: #dc2626; padding: 10px; border-radius: 8px; margin: 10px 0; font-size: 0.85rem; }

@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }

/* Login */
.login-container {
    width: 100%; max-width: 400px;
    background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    padding: 48px 40px; text-align: center; animation: fadeIn 0.5s ease;
}
.login-container.hidden { display: none; }
.login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-title { font-size: 1.4rem; font-weight: 700; color: #1a5276; margin-bottom: 4px; }
.login-subtitle { font-size: 0.85rem; color: #7f8c8d; margin-bottom: 32px; }
.login-button {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, #1a5276 0%, #2e86ab 100%);
    color: white; border: none; border-radius: 14px;
    font-size: 1rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s ease;
}
.login-button:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(26,82,118,0.4); }
.login-error { color: #e74c3c; font-size: 0.85rem; margin-top: 12px; min-height: 20px; }

/* Header actions */
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn-logout {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8); padding: 8px 12px; border-radius: 10px;
    cursor: pointer; font-size: 0.75rem; font-family: inherit; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(231,76,60,0.3); border-color: rgba(231,76,60,0.5); color: white; }
