@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

html {
    font-size: 16px;
    background-color: var(--bg-color);
}

:root {
  /* Variáveis do TEMA PRINCIPAL (App/Chat) */
  --primary-color: #0b1a30; 
  --secondary-color: #1e3a5f;
  --accent-color: #005ce6;  
  --bg-color: #ffffff;     
  --sidebar-bg: #f8fafc;
  --panel-bg: #ffffff;
  --border-color: #e2e8f0; 
  --text-main: #0f172a;    
  --text-muted: #64748b;
  --input-bg: #ffffff;
  --hover-bg: #f1f5f9;
  --active-chat-bg: #e2e8f0;
  --gradient-bottom: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 40%);
}

[data-theme="dark"] {
  --primary-color: #0f172a; 
  --secondary-color: #1e293b;
  --accent-color: #3b82f6; 
  --bg-color: #0f172a;     
  --sidebar-bg: #1e293b;
  --panel-bg: #1e293b;
  --border-color: #334155; 
  --text-main: #f8fafc;    
  --text-muted: #94a3b8;
  --input-bg: #334155;
  --hover-bg: #334155;
  --active-chat-bg: #475569;
  --gradient-bottom: linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,1) 40%);
}

*, *::before, *::after { box-sizing: border-box; }

body, input, button, textarea, select {
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

input::-ms-reveal, input::-ms-clear { display: none !important; }

body {
  background-color: var(--bg-color); color: var(--text-main);
  margin: 0; padding: 0; min-height: 100dvh; height: 100dvh; overflow: hidden;
}

/* =========================================================
   TELAS DE AUTENTICAÇÃO E LANDING PAGE VIP
   ========================================================= */
#login-screen {
  position: absolute; top: 0; left: 0;
  width: 100vw; height: 100dvh;
  background: radial-gradient(circle at center, #f0f7ff 0%, #ffffff 80%);
  z-index: 99999; overflow-y: auto; overflow-x: hidden;
  
  --auth-primary: #0b1a30; 
  --auth-accent: #005ce6;
  --auth-text: #1e293b;
  --auth-text-muted: #64748b;
  --auth-border: #e2e8f0;
}

.auth-view { width: 100%; min-height: 100dvh; display: flex; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------
   LANDING PAGE VIP
   --------------------------------- */
.landing-layout { flex-direction: column; padding: 40px 6vw; max-width: 1400px; margin: 0 auto; position: relative;}

.landing-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 60px; z-index: 10;}
.landing-logo { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 800; color: var(--auth-primary); }
.landing-logo img { width: 45px; height: auto; }
.landing-badge { 
  display: flex; align-items: center; gap: 8px; color: var(--auth-accent); 
  background: rgba(0, 92, 230, 0.05); border: 1px solid rgba(0, 92, 230, 0.2); 
  padding: 8px 16px; border-radius: 30px; font-size: 0.85rem; font-weight: 600;
}

.landing-body { display: flex; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; flex: 1; gap: 40px; z-index: 10;}

.landing-content { flex: 1; max-width: 600px; }
.landing-content h1 { font-size: 3.5rem; color: var(--auth-primary); margin: 0 0 20px 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.5px;}
.text-highlight { color: var(--auth-accent); font-weight: 800; }
.landing-subtitle { font-size: 1.25rem; color: var(--auth-text-muted); line-height: 1.6; margin-bottom: 40px; }

.fake-search-box {
  display: flex; align-items: center; background: white;
  border: 1px solid var(--auth-border); border-radius: 16px; padding: 8px 8px 8px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04); cursor: text; transition: 0.3s; margin-bottom: 10px;
}
.fake-search-box:hover { box-shadow: 0 15px 40px rgba(0, 92, 230, 0.1); border-color: rgba(0, 92, 230, 0.3); transform: translateY(-2px);}
.search-icon { color: var(--auth-primary); font-size: 1.2rem; margin-right: 15px; }
.placeholder-text { flex: 1; color: #94a3b8; font-size: 1.05rem; }
.send-icon-wrapper {
  background: rgba(0, 92, 230, 0.08); color: var(--auth-accent); width: 45px; height: 45px; 
  border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.1rem; cursor: pointer; transition: 0.2s;
}
.fake-search-box:hover .send-icon-wrapper { background: var(--auth-accent); color: white; }
.search-hint { display: block; font-size: 0.85rem; color: var(--auth-accent); margin-bottom: 40px; padding-left: 20px; font-weight: 500;}

.landing-actions { display: flex; gap: 15px; margin-bottom: 50px; }
.btn-primary-auth {
  padding: 16px 32px; background-color: var(--auth-accent); color: white;
  border: none; border-radius: 12px; font-weight: 600; font-size: 1.05rem; cursor: pointer; transition: 0.3s;
  box-shadow: 0 10px 25px rgba(0, 92, 230, 0.3); display: flex; align-items: center; gap: 10px;
}
.btn-primary-auth:hover { filter: brightness(1.15); transform: translateY(-3px); box-shadow: 0 15px 30px rgba(0, 92, 230, 0.4); }
.btn-secondary-auth {
  padding: 16px 40px; background-color: transparent; color: var(--auth-primary);
  border: 1.5px solid var(--auth-primary); border-radius: 12px; font-weight: 600; font-size: 1.05rem; cursor: pointer; transition: 0.2s;
}
.btn-secondary-auth:hover { background-color: var(--auth-primary); color: white; }

.landing-footer-info { display: flex; align-items: center; gap: 15px; }
.shield-icon { width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; border-radius: 12px; background: rgba(0, 92, 230, 0.05); color: var(--auth-accent); font-size: 1.3rem; border: 1px solid rgba(0, 92, 230, 0.1); }
.info-text { display: flex; flex-direction: column; }
.info-text strong { font-size: 0.95rem; color: var(--auth-primary); }
.info-text span { font-size: 0.85rem; color: var(--text-muted); }

.landing-image-area { flex: 1; display: flex; justify-content: center; align-items: center; position: relative; height: 600px;}
.floating-ai-image { 
    position: relative; z-index: 5; 
    max-width: 90%; height: auto; 
    max-height: 550px; 
    object-fit: contain; 
    animation: floatImage 6s ease-in-out infinite; 
}

@keyframes floatImage { 0% { transform: translateY(0px); } 50% { transform: translateY(-15px); } 100% { transform: translateY(0px); } }
@keyframes spinClockwise { 100% { transform: rotate(360deg); } }
@keyframes spinCounter { 100% { transform: rotate(-360deg); } }

.orbital-glow {
  position: absolute; width: 450px; height: 450px; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 92, 230, 0.15) 0%, transparent 60%); z-index: 1;
}

.orbital-ring {
  position: absolute; top: 50%; left: 50%; border-radius: 50%;
  border: 1px solid rgba(0, 92, 230, 0.2); z-index: 2;
}
.ring-1 { width: 550px; height: 550px; margin-top: -275px; margin-left: -275px; animation: spinClockwise 35s linear infinite; }
.ring-2 { width: 450px; height: 450px; margin-top: -225px; margin-left: -225px; animation: spinCounter 25s linear infinite; border-style: dashed; }
.ring-3 { width: 350px; height: 350px; margin-top: -175px; margin-left: -175px; animation: spinClockwise 20s linear infinite; }

.orbital-ring::before, .orbital-ring::after { content: ''; position: absolute; border-radius: 50%; background: var(--auth-accent); box-shadow: 0 0 10px var(--auth-accent); }
.ring-1::before { width: 12px; height: 12px; top: 15%; left: 10%; }
.ring-1::after { width: 8px; height: 8px; bottom: 20%; right: 15%; }
.ring-2::before { width: 10px; height: 10px; top: 50%; left: -5px; }
.ring-3::after { width: 14px; height: 14px; top: -7px; left: 50%; }

/* ---------------------------------
   TELA DE LOGIN E CADASTRO
   --------------------------------- */
.center-auth { flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  background-color: #ffffff; width: 100%; max-width: 450px;
  padding: 45px; border-radius: 24px; box-shadow: 0 20px 50px rgba(0, 20, 60, 0.08); 
  border: 1px solid rgba(0, 0, 0, 0.03); text-align: center; position: relative; z-index: 10;
}
.auth-header { margin-bottom: 30px; }
.login-logo.justify-center { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.4rem; font-weight: 800; color: var(--auth-primary); margin-bottom: 10px; }
.login-logo img { width: 40px; height: auto; }
.auth-header h2 { color: var(--auth-text); font-size: 1.6rem; margin: 5px 0 0 0; font-weight: 700; }

.input-wrapper { position: relative; margin-bottom: 16px; width: 100%; }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--auth-text-muted); font-size: 1rem;}
.input-wrapper input {
  width: 100%; padding: 16px 45px 16px 45px; border: 1.5px solid var(--auth-border);
  border-radius: 12px; font-size: 0.95rem; background-color: #fafafa;
  color: var(--auth-text); font-weight: 500; outline: none; transition: 0.3s;
}
.input-wrapper input:focus { border-color: var(--auth-accent); background-color: #ffffff; box-shadow: 0 0 0 4px rgba(0,92,230,0.1); }
.btn-toggle-senha { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--auth-text-muted); cursor: pointer; font-size: 1.1rem; }

.btn-entrar {
  width: 100%; padding: 16px; background-color: var(--auth-accent); color: white;
  border: none; border-radius: 12px; font-weight: 600; font-size: 1.05rem; cursor: pointer; transition: 0.3s; margin-top: 10px;
  box-shadow: 0 8px 20px rgba(0, 92, 230, 0.25);
}
.btn-entrar:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 12px 25px rgba(0, 92, 230, 0.35); }
.error-msg { color: #ef4444; font-size: 0.85rem; margin-top: 15px; display: none; background: #fef2f2; padding: 10px; border-radius: 8px; border: 1px solid #fecaca; }

.toggle-link { margin-top: 25px; font-size: 0.95rem; color: var(--auth-text-muted); }
.toggle-link a { color: var(--auth-accent); text-decoration: none; font-weight: 700; }

.btn-voltar-inicio {
  margin-top: 25px; padding: 12px 20px; background: white; color: var(--auth-text-muted);
  border: 1.5px solid var(--auth-border); border-radius: 20px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-voltar-inicio:hover { border-color: var(--auth-primary); color: var(--auth-primary); }
.terms-text { font-size: 0.75rem; color: var(--auth-text-muted); margin-bottom: 20px; line-height: 1.5; }

/* =========================================================
   RESTO DO ESTILO DO CHAT
   ========================================================= */
#app-container { position: absolute; top: 0; left: 0; display: none; width: 100vw; height: 100dvh; background: var(--bg-color); flex-direction: row; z-index: 5; overflow: hidden; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; background: rgba(0,0,0,0.5); z-index: 90; opacity: 0; transition: opacity 0.3s; }
.sidebar-clean { width: 320px; background: var(--sidebar-bg); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; transition: transform 0.3s ease, width 0.3s ease; z-index: 100; flex-shrink: 0; }
.sidebar-clean.collapsed { width: 0; transform: translateX(-320px); }
.sidebar-top { padding: 20px 15px 10px 15px; }

/* Botão Claro "Nova Conversa" do Menu Mobile */
.btn-novo-chat-clean { display: none; width: 100%; background: var(--panel-bg); border: 1px solid var(--border-color); padding: 12px 15px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; color: var(--text-main); justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; }
.btn-novo-chat-clean:hover { background: var(--hover-bg); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 15px 20px 15px; }
.history-category-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin: 20px 0 10px 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.history-disclaimer { font-size: 0.7rem; color: #9ca3af; text-align: center; margin-top: 25px; padding: 10px; border-top: 1px solid var(--border-color); }
.chat-item { position: relative; padding: 10px 35px 10px 12px; border-radius: 8px; margin-bottom: 4px; cursor: pointer; color: var(--text-main); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: 0.2s; }
.chat-item:hover { background-color: var(--hover-bg); }
.chat-item.active { background-color: var(--active-chat-bg); font-weight: 600; }
.chat-item span { overflow: hidden; text-overflow: ellipsis; }
.btn-deletar-chat-lista { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: none; font-size: 0.85rem; padding: 4px; border-radius: 4px; transition: 0.2s; }
.chat-item:hover .btn-deletar-chat-lista { display: block; }
.btn-deletar-chat-lista:hover { color: #ef4444; background-color: rgba(239, 68, 68, 0.1); }
.sidebar-footer { padding: 15px; border-top: 1px solid var(--border-color); position: relative; }
.user-profile-btn { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px; border-radius: 8px; transition: 0.2s; }
.user-profile-btn:hover { background: var(--hover-bg); }
.user-avatar { width: 32px; height: 32px; background: var(--primary-color); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 0.8rem; }
.user-name-text { flex: 1; font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-popup-menu { position: absolute; bottom: 70px; left: 15px; width: calc(100% - 30px); background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); padding: 8px; display: none; z-index: 200; }
.profile-popup-menu.show { display: block; animation: popUp 0.2s ease; }
@keyframes popUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.profile-popup-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-main); text-decoration: none; font-size: 0.9rem; font-weight: 500; border-radius: 6px; transition: 0.2s; }
.profile-popup-menu a:hover { background: var(--hover-bg); }
.menu-divider { height: 1px; background: var(--border-color); margin: 5px 0; }
.main-chat-area { flex: 1; display: flex; flex-direction: column; position: relative; width: 100%; background-color: var(--bg-color); height: 100dvh; overflow: hidden; }
.header-clean { padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 65px; border-bottom: 1px solid var(--border-color); background: var(--bg-color); flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 15px; }
.btn-toggle-sidebar { background: transparent; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; padding: 5px; }
.brand-clean { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--primary-color); }
.brand-clean img { width: 25px; }

/* =========================================================
   BOTÕES DO HEADER (NOVA CONVERSA)
   ========================================================= */
.header-actions { display: flex; align-items: center; gap: 12px; }

/* Botão Nova Conversa - Visual Limpo, com Animação de Flutuar */
.btn-nova-conversa-header { 
  display: flex; align-items: center; gap: 8px; 
  background: var(--panel-bg); border: 1px solid var(--border-color); 
  color: var(--text-main); 
  padding: 7px 18px; border-radius: 20px; font-size: 0.9rem; font-weight: 600; 
  cursor: pointer; transition: 0.3s; 
}
.btn-nova-conversa-header:hover { 
  background: var(--hover-bg); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
}

/* ========================================================= */

.disclaimer-banner { position: static; margin: 15px auto 20px auto; width: 100%; max-width: 800px; padding: 12px 20px; background: transparent; border: none; font-size: 0.75rem; color: var(--text-muted); text-align: center; line-height: 1.5; }
#area-chat { flex: 1; overflow-y: auto; padding: 30px 20px 160px 20px; display: flex; flex-direction: column; align-items: center; width: 100%; }
#welcome-screen { text-align: center; margin-top: 10vh; max-width: 500px; width: 100%; }
.welcome-logo-clean { width: 60px; height: 60px; margin: 0 auto 20px auto; border-radius: 50%; box-shadow: 0 4px 15px rgba(0,0,0,0.05); padding: 5px; background: white; }
.welcome-logo-clean img { width: 100%; height: 100%; object-fit: contain; }
#welcome-greeting { font-size: 1.6rem; color: var(--text-main); margin-bottom: 10px; font-weight: 700;}
.welcome-subtitle { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; }
.mensagem { width: 100%; max-width: 800px; margin-bottom: 25px; line-height: 1.6; font-size: 0.95rem; display: flex; flex-direction: column; }
.mensagem.user { align-items: flex-end; }
.mensagem.user .msg-content { background-color: var(--secondary-color); color: white; padding: 12px 20px; border-radius: 20px; border-bottom-right-radius: 4px; max-width: 85%; }
.mensagem.user p { margin: 0; }
.mensagem.ai { align-items: flex-start; }
.mensagem.ai .msg-content { background-color: transparent; color: var(--text-main); padding: 0; width: 100%; }
.mensagem img { max-width: 300px; border-radius: 8px; margin-bottom: 10px; }
.ai-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; width: 100%; }
.ai-action-btn { background: transparent; border: 1px solid var(--border-color); border-radius: 50%; width: 35px; height: 35px; display: flex; justify-content: center; align-items: center; color: var(--text-muted); cursor: pointer; transition: 0.2s; }
.ai-action-btn:hover { background: var(--hover-bg); color: var(--text-main); }
.msg-content h1, .msg-content h2, .msg-content h3 { color: var(--text-main); margin-top: 10px; margin-bottom: 10px; font-weight: 700; }
.msg-content p { margin-top: 0; margin-bottom: 15px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { padding-left: 20px; margin-bottom: 15px; margin-top: 0;}
.msg-content strong { font-weight: 700; }
.msg-content table { border-collapse: collapse; width: 100%; margin-bottom: 15px; font-size: 0.9rem;}
.msg-content th, .msg-content td { border: 1px solid var(--border-color); padding: 8px 12px; text-align: left; }
.msg-content th { background-color: var(--sidebar-bg); font-weight: bold; }
.referencias-container { margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 20px; width: 100%;}
.ref-header { font-size: 1.1rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 10px; margin-bottom: 20px;}
.ref-card { background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: flex-start; gap: 15px;}
.ref-card-content { flex: 1; }
.ref-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 15px; }
.ref-text p { margin: 0; }
.ref-badge { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-color); display: flex; justify-content: center; align-items: center; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; flex-shrink: 0;}
.ref-pills-container { display: flex; gap: 10px; flex-wrap: wrap; }
.ref-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; color: var(--text-main); font-weight: 600; background: var(--bg-color);}
.ref-pill button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 0.8rem; transition: 0.2s;}
.ref-pill button:hover { color: var(--text-main); }
.link-pill { text-decoration: none !important; color: var(--text-main) !important; cursor: pointer; transition: 0.2s;}
.link-pill i { color: var(--text-muted); }
.link-pill:hover { background-color: var(--hover-bg); }
#indicador-digitando { display: none; font-style: italic; color: var(--text-muted); font-size: 0.9rem; width: 100%; max-width: 800px; margin: 0 auto 10px auto; text-align: left; padding-left: 5px;}
.input-zone-outer { position: absolute; bottom: 0; left: 0; width: 100%; background: var(--gradient-bottom); display: flex; flex-direction: column; align-items: center; padding: 20px 20px 25px 20px; flex-shrink: 0; z-index: 10; }
.floating-pills { display: flex; gap: 10px; margin-bottom: 10px; }
.pill-badge { background: var(--panel-bg); border: 1px solid var(--border-color); padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }

.input-box-clean { 
  width: 100%; max-width: 800px; background: var(--input-bg); border: 1px solid var(--border-color); 
  border-radius: 24px; display: flex; align-items: flex-end; padding: 6px 6px 6px 12px; 
  box-shadow: 0 5px 20px rgba(0,0,0,0.05); transition: all 0.3s; gap: 5px; 
}
.input-box-clean:focus-within { border-color: var(--accent-color); }
.input-box-clean.disabled { background-color: var(--hover-bg); border-color: var(--border-color); }
.input-box-clean.disabled textarea { pointer-events: none; opacity: 0.7; }
.input-box-clean.disabled .btn-attach, .input-box-clean.disabled #btnEnviar { opacity: 0.5; pointer-events: none; }
.btn-attach { background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: flex; justify-content: center; align-items: center; transition: 0.2s; flex-shrink: 0; margin-bottom: 2px; }
.btn-attach:hover:not(:disabled) { background: var(--hover-bg); color: var(--text-main); }
#inputMensagem { 
  flex: 1; border: none; background: transparent; outline: none; padding: 10px 5px; 
  font-size: 0.95rem; color: var(--text-main); font-family: inherit; 
  resize: none; max-height: 150px; overflow-y: auto; line-height: 1.4; box-sizing: border-box; display: block;
}
#inputMensagem:disabled { color: var(--text-muted); }
#btnEnviar { background: var(--accent-color); color: white; border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 1.1rem; transition: 0.2s; flex-shrink: 0; margin-bottom: 2px; }
#btnEnviar:hover:not(:disabled) { transform: scale(1.05); filter: brightness(1.1); }
#btnEnviar:disabled { background: var(--text-muted); }
.footer-text-clean { font-size: 0.7rem; color: var(--text-muted); margin-top: 10px; }
#anexo-preview { position: absolute; bottom: 85px; background: var(--panel-bg); padding: 10px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 10px;}
#anexo-preview img { max-width: 80px; max-height: 80px; border-radius: 6px; }
.btn-remover-img { position: absolute; top: -5px; right: -5px; background: #ef4444; color: white; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; }

/* =========================================================
   MODAIS E RESPONSIVIDADE (ATUALIZADO PARA ALEIXOMED)
   ========================================================= */
.aleixo-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; background: rgba(0, 0, 0, 0.4); z-index: 9999; backdrop-filter: blur(3px); }
.aleixo-modal-box { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 30px; width: 90%; max-width: 420px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); z-index: 10000; text-align: center; animation: modalPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.aleixo-modal-box h3 { margin: 0 0 25px 0; font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.aleixo-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.aleixo-modal-footer button { padding: 12px 20px; border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: 0.2s; }
.btn-modal-cancel { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color) !important; }
.btn-modal-cancel:hover { background: var(--hover-bg); color: var(--text-main); }
.btn-modal-save { background: var(--accent-color); color: white; }
.btn-modal-save:hover { filter: brightness(1.1); }

/* Ajustes dos inputs DENTRO dos modais para respeitar o Dark Mode */
.aleixo-modal-box .input-wrapper input {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
}
.aleixo-modal-box .input-wrapper input:focus {
    border-color: var(--accent-color);
    background-color: var(--bg-color);
}
.aleixo-modal-box .input-wrapper input:disabled {
    background-color: var(--hover-bg);
    opacity: 0.7;
    cursor: not-allowed;
}
.aleixo-modal-box .input-icon {
    color: var(--text-muted);
}
.aleixo-modal-box .btn-toggle-senha {
    color: var(--text-muted);
}

.modal-logout-box { max-width: 500px; text-align: left; }
.logout-header-title { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; font-weight: 800; color: #ef4444; margin-bottom: 8px; }
.logout-subtitle { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 25px; }
.logout-options-container { display: flex; flex-direction: column; gap: 15px; }
.logout-option-card { display: flex; align-items: center; gap: 15px; padding: 18px; border: 2px solid var(--border-color); border-radius: 14px; cursor: pointer; transition: 0.2s; background: var(--panel-bg); }
.logout-option-card:hover { border-color: var(--accent-color); background: var(--hover-bg); }
.logout-icon { width: 45px; height: 45px; border-radius: 50%; background: var(--hover-bg); display: flex; justify-content: center; align-items: center; font-size: 1.2rem; color: var(--text-main); flex-shrink: 0; }
.logout-option-card:hover .logout-icon { background: rgba(0, 92, 230, 0.1); color: var(--accent-color); }
.logout-text { display: flex; flex-direction: column; gap: 4px; }
.logout-text strong { font-size: 1.05rem; color: var(--text-main); }
.logout-text span { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
@keyframes modalPop { from { opacity: 0; transform: translate(-50%, calc(-50% + 20px)) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* AJUSTES MOBILE PARA A LANDING PAGE E TABLET BUG FIX */
@media (max-width: 992px) {
  .landing-layout { padding: 30px 20px; }
  .landing-header { margin-bottom: 30px; flex-direction: column; gap: 15px; }
  
  .landing-body { flex-direction: column-reverse; text-align: center; gap: 20px; }
  
  .landing-image-area { height: 350px; min-height: 350px; padding: 20px 0; display: flex; justify-content: center; }
  .floating-ai-image { max-height: 100%; max-width: 90%; object-fit: contain; }
  
  .ring-1 { width: 350px; height: 350px; margin-top: -175px; margin-left: -175px; }
  .ring-2 { width: 280px; height: 280px; margin-top: -140px; margin-left: -140px; }
  .ring-3 { width: 200px; height: 200px; margin-top: -100px; margin-left: -100px; }
  
  .landing-content h1 { font-size: 2.5rem; }
  .landing-subtitle { font-size: 1.05rem; margin-bottom: 25px; }
  
  .landing-actions { flex-direction: column; width: 100%; }
  .btn-primary-auth, .btn-secondary-auth { width: 100%; justify-content: center; }
  
  .fake-search-box { text-align: left; }
  .landing-footer-info { justify-content: center; flex-direction: column; text-align: center; margin-top: 10px; margin-bottom: 30px;}
  
  .auth-card { padding: 35px 20px; border-radius: 16px; margin-bottom: 20px;}
  
  .header-clean { padding-top: calc(env(safe-area-inset-top) + 5px); height: calc(70px + env(safe-area-inset-top)); }
  .input-zone-outer { padding-bottom: calc(env(safe-area-inset-bottom) + 15px); }
  #area-chat { padding-bottom: 180px; }
  .sidebar-clean { position: fixed; left: 0; top: 0; height: 100dvh; width: 85vw; max-width: 320px; transform: translateX(-100%); z-index: 1001; border-right: none; box-shadow: 5px 0 15px rgba(0,0,0,0.1); }
  .sidebar-clean.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; opacity: 1; }
  
  .btn-novo-chat-clean { display: flex; }
  .btn-deletar-chat-lista { display: block; opacity: 0.6; }
  
  .header-actions { display: none !important; }
  
  .floating-pills { display: none; } 
  #welcome-screen { padding: 0 10px; }
  .mensagem { max-width: 95%; }
}

/* =========================================================
   TRANSIÇÕES E TELA DE CARREGAMENTO (TÉCNICA GHOST TEXT)
   ========================================================= */
body {
    opacity: 0;
    animation: fadeInPage 0.4s ease forwards;
}
@keyframes fadeInPage { to { opacity: 1; } }

body.fade-out {
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

#global-loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background: var(--bg-color); z-index: 9999999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-content {
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: center; 
    gap: 25px;
}

.loader-logo {
    width: 100px;
    height: auto;
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.loader-text-container {
    position: relative;
    display: flex;
    align-items: center;
}

.loader-text-ghost {
    font-size: 4rem;
    font-weight: 800;
    margin: 0;
    visibility: hidden; 
    white-space: nowrap;
    padding-right: 4px; 
}

.loader-text {
    position: absolute;
    top: 0; left: 0;
    font-size: 4rem;
    font-weight: 800; 
    color: var(--primary-color);
    margin: 0; 
    white-space: nowrap;
    overflow: hidden;
    border-right: 4px solid var(--accent-color); 
    width: 0; 
    
    animation: 
        typing 1.5s steps(11, end) 0.5s forwards,
        blink-caret 0.5s step-end 4 forwards;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; } 
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-color); }
}

@media (max-width: 768px) {
    .loader-content { flex-direction: column; gap: 15px; }
    .loader-logo { width: 85px; }
    .loader-text-ghost, .loader-text { font-size: 2.8rem; }
}

/* =========================================================
   PROTEÇÃO CONTRA DEFORMAÇÃO DO ZOOM
   ========================================================= */
.lightbox-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
}

/* =========================================================
   BARRAS DE ROLAGEM (SCROLLBARS) ADAPTÁVEIS
   ========================================================= */
::-webkit-scrollbar {
    width: 8px; /* Largura da barra vertical */
    height: 8px; /* Altura da barra horizontal (se houver) */
}

::-webkit-scrollbar-track {
    background: var(--bg-color); /* O fundo da barra muda com o tema */
}

::-webkit-scrollbar-thumb {
    background: var(--border-color); /* A cor do "pegador" muda com o tema */
    border-radius: 10px; /* Deixa redondinho e moderno */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted); /* Fica mais escuro/claro ao passar o mouse */
}

/* =========================================================
   SISTEMA DE MARCAÇÃO DE TEXTO (HIGHLIGHTER)
   ========================================================= */
#highlight-toolbar {
    position: fixed;
    z-index: 100000;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%) translateY(10px) scale(0.95);
    pointer-events: none;
}
#highlight-toolbar.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}
.hl-color-btn {
    width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: 0.2s; padding: 0;
}
.hl-color-btn:hover { transform: scale(1.15); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.hl-color-yellow { background: #fef08a; border-color: #eab308; }
.hl-color-green { background: #bbf7d0; border-color: #22c55e; }
.hl-color-blue { background: #bfdbfe; border-color: #3b82f6; }
.hl-color-pink { background: #fbcfe8; border-color: #ec4899; }

.hl-action-btn {
    background: transparent; color: var(--text-main); border: none; font-size: 1.1rem; cursor: pointer; padding: 6px; border-radius: 8px; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.hl-action-btn:hover { background: var(--hover-bg); }
.hl-divider { width: 1px; height: 24px; background: var(--border-color); }

mark.aleixo-highlight {
    border-radius: 4px; padding: 2px 4px; cursor: pointer; transition: filter 0.2s, box-shadow 0.2s; 
    color: #0f172a !important; /* Mantém o texto escuro sobre o marcador para leitura legível sempre */
    font-weight: 500;
}
mark.aleixo-highlight:hover { filter: brightness(0.92); box-shadow: 0 0 5px rgba(0,0,0,0.1); }

[data-theme="dark"] #highlight-toolbar {
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}