/* ═══════════════════════════════════════════════════════════════
   VERAE AI — Natural Professional Design System v4
   Cream #F5F2ED · Sage Green #2D423F
════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Colors */
  --cream:          #F5F2ED;
  --cream-dark:     #EAE6DF;
  --cream-darker:   #DDD8CF;
  --cream-deepest:  #CEC9BE;
  --sage:           #2D423F;
  --sage-light:     #3d5a56;
  --sage-lighter:   #4e7470;
  --sage-lightest:  #6a9995;
  --sage-muted:     rgba(45,66,63,0.08);
  --sage-muted-md:  rgba(45,66,63,0.15);
  --sage-muted-lg:  rgba(45,66,63,0.24);
  --text-primary:   #1a2a28;
  --text-secondary: #4a5e5b;
  --text-muted:     #7a8e8b;
  --text-faint:     #a8b8b5;
  --white:          #ffffff;
  --red:            #ef4444;
  --red-light:      #fee2e2;

  /* Shadows */
  --shadow-xs:  0 2px 8px  rgba(45,66,63,0.06);
  --shadow-sm:  0 4px 18px rgba(45,66,63,0.09);
  --shadow-md:  0 8px 36px rgba(45,66,63,0.13);
  --shadow-lg:  0 16px 56px rgba(45,66,63,0.18);
  --shadow-xl:  0 24px 72px rgba(45,66,63,0.22);

  /* Radii */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-2xl:  36px;
  --r-pill: 9999px;

  /* Transitions */
  --t-fast:   all 0.18s cubic-bezier(0.4,0,0.2,1);
  --t-base:   all 0.27s cubic-bezier(0.4,0,0.2,1);
  --t-slow:   all 0.42s cubic-bezier(0.4,0,0.2,1);

  /* Typography */
  --font-sans: 'Inter','Segoe UI',system-ui,sans-serif;
  --font-serif:'Lora','Georgia',serif;

  /* Layout */
  --sidebar-w:  310px;
  --topbar-h:   58px;
}

/* ── Reset ── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; scroll-behavior:smooth; }
body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { cursor:pointer; border:none; background:none; font-family:inherit; }
input, textarea { font-family:inherit; }
a { text-decoration:none; color:inherit; }
ul { list-style:none; }
img { max-width:100%; }
::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--sage-muted-md); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:var(--sage-muted-lg); }

/* ── Keyframes ── */
@keyframes fadeIn    { from{opacity:0}               to{opacity:1} }
@keyframes fadeInUp  { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeInDown{ from{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:translateY(0)} }
@keyframes scaleIn   { from{opacity:0;transform:scale(0.88)}      to{opacity:1;transform:scale(1)} }
@keyframes popIn     { from{opacity:0;transform:scale(0.92) translateY(6px)} to{opacity:1;transform:scale(1) translateY(0)} }
@keyframes messageIn { from{opacity:0;transform:translateY(8px)}  to{opacity:1;transform:translateY(0)} }
@keyframes logoFloat { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-7px) scale(1.025)} }
@keyframes logoGlow  { 0%,100%{filter:drop-shadow(0 0 0 transparent)} 50%{filter:drop-shadow(0 6px 22px rgba(45,66,63,0.32))} }
@keyframes typing    { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-5px);opacity:1} }
@keyframes spin      { to{transform:rotate(360deg)} }
@keyframes progressAnim { from{width:0} to{width:100%} }
@keyframes pulse     { 0%,100%{opacity:1} 50%{opacity:0.55} }

/* ════════════════════════════════════════
   LOADING SCREEN
════════════════════════════════════════ */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--cream);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; gap: 0;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
#loading-screen.fade-out { opacity:0; visibility:hidden; pointer-events:none; }

.loading-logo-wrap {
  width: 150px; height: 150px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.4rem;
}
.loading-logo-img {
  width: 136px; height: 136px;
  object-fit: contain;
  opacity: 0;
  animation:
    scaleIn   0.9s cubic-bezier(0.34,1.56,0.64,1) 0.3s  forwards,
    logoFloat 4.2s ease-in-out 1.5s infinite,
    logoGlow  4.2s ease-in-out 1.5s infinite;
}
.brand-label {
  font-size: 1.7rem; font-weight: 700;
  color: var(--sage); letter-spacing: -0.035em;
  opacity: 0; animation: fadeInUp 0.55s ease 1.1s forwards;
  margin-top: 0.7rem;
}
.loading-tagline-text {
  font-family: var(--font-serif);
  font-size: 0.86rem; color: var(--text-secondary);
  text-align: center; max-width: 380px;
  padding: 0 2rem; line-height: 1.9;
  opacity: 0; animation: fadeInUp 0.7s ease 1.55s forwards;
  font-style: italic; letter-spacing: 0.01em;
  margin-top: 0.55rem;
}
.loading-progress {
  margin-top: 2.5rem;
  width: 160px; height: 2px;
  background: var(--cream-darker); border-radius: var(--r-pill);
  overflow: hidden;
  opacity: 0; animation: fadeIn 0.4s ease 2s forwards;
}
.loading-progress-bar {
  height: 100%; background: var(--sage);
  border-radius: var(--r-pill);
  animation: progressAnim 2.8s cubic-bezier(0.4,0,0.2,1) 2s forwards;
}

/* ════════════════════════════════════════
   AUTH PANEL
════════════════════════════════════════ */
#auth-panel {
  position: fixed; inset: 0;
  background: var(--cream);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9000;
  opacity: 0; visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  padding: 1.5rem; overflow-y: auto;
}
#auth-panel.visible  { opacity:1; visibility:visible; }
#auth-panel.hidden   { opacity:0; visibility:hidden; pointer-events:none; }

/* Background decoration */
.auth-bg-decoration { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.auth-orb {
  position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: 0.18;
}
.auth-orb-1 {
  width: 300px; height: 300px;
  background: var(--sage-lightest);
  top: -80px; right: -60px;
  animation: pulse 7s ease-in-out infinite;
}
.auth-orb-2 {
  width: 220px; height: 220px;
  background: var(--sage-light);
  bottom: -40px; left: -50px;
  animation: pulse 9s ease-in-out 2s infinite;
}

.auth-logo-mini {
  display: flex; align-items: center; gap: 0.65rem;
  margin-bottom: 1.6rem; position: relative; z-index: 1;
  animation: fadeInUp 0.5s ease forwards;
}
.auth-logo-img {
  width: 46px; height: 46px;
  object-fit: contain; border-radius: var(--r-sm);
}
.auth-logo-text {
  font-size: 1.65rem; font-weight: 700;
  color: var(--sage); letter-spacing: -0.035em;
}
.auth-tagline {
  font-family: var(--font-serif);
  font-size: 0.87rem; color: var(--text-secondary);
  text-align: center; max-width: 370px;
  line-height: 1.9; font-style: italic;
  margin-bottom: 1.75rem; position: relative; z-index: 1;
  opacity: 0; animation: fadeInUp 0.5s ease 0.1s both;
}
.auth-widget {
  position: relative; background: var(--white);
  border-radius: var(--r-2xl); padding: 2.1rem 2.1rem 1.8rem;
  width: 100%; max-width: 390px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--cream-darker);
  opacity: 0; animation: fadeInUp 0.5s ease 0.18s both;
  z-index: 1;
}
.auth-close-btn {
  position: absolute; top: 1rem; right: 1rem;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem;
  transition: var(--t-base);
}
.auth-close-btn:hover { background:var(--sage-muted); color:var(--sage); transform:rotate(90deg); }

/* Tabs */
.auth-tabs {
  display: flex; gap: 3px;
  margin-bottom: 1.55rem;
  background: var(--cream); border-radius: var(--r-pill); padding: 3px;
}
.auth-tab {
  flex: 1; padding: 0.52rem 1rem;
  border-radius: var(--r-pill);
  font-size: 0.84rem; font-weight: 500;
  color: var(--text-muted); transition: var(--t-base);
  text-align: center;
}
.auth-tab.active { background:var(--sage); color:var(--cream); box-shadow:0 2px 8px rgba(45,66,63,0.2); }
.auth-tab:hover:not(.active) { color:var(--sage); background:var(--sage-muted); }

/* Forms */
.auth-form { display:none; flex-direction:column; gap:0.8rem; }
.auth-form.active { display:flex; animation:fadeIn 0.22s ease; }

/* Field with icon */
.auth-field {
  position: relative; display: flex; align-items: center;
}
.auth-field-icon {
  position: absolute; left: 1rem;
  color: var(--text-muted); font-size: 0.82rem;
  pointer-events: none;
}
.auth-input {
  width: 100%; padding: 0.78rem 1rem 0.78rem 2.6rem;
  border: 1.5px solid var(--cream-darker);
  border-radius: var(--r-md);
  font-size: 0.88rem; color: var(--text-primary);
  background: var(--cream); transition: var(--t-base); outline: none;
}
.auth-input:focus {
  border-color: var(--sage); background: var(--white);
  box-shadow: 0 0 0 3px var(--sage-muted);
}
.auth-input::placeholder { color:var(--text-muted); }
.auth-eye-btn {
  position: absolute; right: 0.85rem;
  color: var(--text-muted); font-size: 0.82rem;
  transition: var(--t-fast); padding: 0.2rem;
}
.auth-eye-btn:hover { color:var(--sage); }

/* Buttons */
.btn-sage-pill {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.82rem 2rem; background: var(--sage); color: var(--cream);
  border-radius: var(--r-pill); font-size: 0.88rem; font-weight: 500;
  transition: var(--t-base); width: 100%;
  box-shadow: 0 2px 10px rgba(45,66,63,0.2);
}
.btn-sage-pill:hover  { background:var(--sage-light); transform:translateY(-1px); box-shadow:0 4px 16px rgba(45,66,63,0.28); }
.btn-sage-pill:active { transform:translateY(0); }

.btn-google-pill {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.78rem 2rem; background: var(--white); color: var(--text-primary);
  border: 1.5px solid var(--cream-darker);
  border-radius: var(--r-pill); font-size: 0.86rem; font-weight: 500;
  transition: var(--t-base); width: 100%;
  box-shadow: var(--shadow-xs);
}
.btn-google-pill:hover { border-color:var(--sage-muted-lg); box-shadow:var(--shadow-sm); background:var(--cream); }

/* Divider */
.auth-divider {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--text-muted); font-size: 0.73rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content:''; flex:1; height:1px; background:var(--cream-darker);
}

/* Note */
.auth-note {
  font-size: 0.75rem; color: var(--text-muted);
  text-align: center; line-height: 1.7;
  margin-top: 0.1rem; font-style: italic;
}
.auth-skip-link {
  color: var(--sage); font-weight: 600; font-size: 0.78rem;
  margin-top: 0.3rem; background: none; border: none;
  cursor: pointer; text-decoration: underline;
  text-decoration-color: transparent;
  transition: var(--t-fast); display: inline-block;
}
.auth-skip-link:hover { text-decoration-color:var(--sage); }

/* ════════════════════════════════════════
   MAIN APP
════════════════════════════════════════ */
#app {
  display: none;
  height: 100vh; width: 100vw;
  position: relative; overflow: hidden;
}
#app.visible { display:flex; animation:fadeIn 0.35s ease; }

/* ════════════════════════════════════════
   SIDEBAR OVERLAY
════════════════════════════════════════ */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.18);
  z-index: 400; backdrop-filter: blur(2px);
}
#sidebar-overlay.active { display:block; animation:fadeIn 0.2s ease; }

/* ════════════════════════════════════════
   MAIN SIDEBAR
════════════════════════════════════════ */
#sidebar {
  position: fixed; top: 0; left: 0;
  height: 100vh; width: var(--sidebar-w);
  background: var(--cream);
  border-right: 1px solid var(--cream-darker);
  display: flex; flex-direction: column;
  z-index: 500;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
#sidebar.open { transform:translateX(0); }

/* Sidebar Header */
.sidebar-header {
  display: flex; align-items: center;
  padding: 1.2rem 1.15rem 0.9rem;
  border-bottom: 1px solid var(--cream-darker);
  gap: 0.5rem; flex-shrink: 0;
}
.sidebar-logo { display:flex; align-items:center; gap:0.55rem; }
.sidebar-logo-img { width:30px; height:30px; object-fit:contain; border-radius:var(--r-xs); }
.sidebar-logo-text { font-size:1.1rem; font-weight:700; color:var(--sage); letter-spacing:-0.025em; }
.sidebar-close {
  margin-left: auto;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.85rem; transition: var(--t-base);
}
.sidebar-close:hover { background:var(--sage-muted); color:var(--sage); transform:rotate(90deg); }

/* Section eyebrow label */
.section-eyebrow {
  font-size: 0.61rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Global Insight */
.global-insight {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--cream-darker);
  flex-shrink: 0;
}
.global-insight .section-eyebrow { margin-bottom: 0.65rem; }
.insight-card {
  background: var(--white);
  border-radius: var(--r-md); padding: 0.65rem 0.85rem;
  border: 1px solid var(--cream-darker); margin-bottom: 0.45rem;
}
.insight-card:last-child { margin-bottom: 0; }
.insight-card-label {
  font-size: 0.61rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted);
  margin-bottom: 0.3rem; font-weight: 700;
}
.insight-card-text {
  font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6;
}
.trending-tags { display:flex; flex-wrap:wrap; gap:0.3rem; margin-top:0.35rem; }
.trending-tag {
  padding: 0.2rem 0.55rem;
  background: var(--sage-muted); color: var(--sage);
  border-radius: var(--r-pill); font-size: 0.68rem; font-weight: 500;
  cursor: pointer; transition: var(--t-base);
}
.trending-tag:hover { background:var(--sage); color:var(--cream); }

/* Sidebar Search */
.sidebar-search {
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--cream-darker);
  flex-shrink: 0;
}
.sidebar-search-wrap {
  display: flex; align-items: center; gap: 0.45rem;
  background: var(--white); border: 1.5px solid var(--cream-darker);
  border-radius: var(--r-pill); padding: 0.46rem 0.85rem;
  transition: var(--t-base);
}
.sidebar-search-wrap:focus-within {
  border-color: var(--sage); box-shadow:0 0 0 2px var(--sage-muted);
}
.sidebar-search-icon { color:var(--text-muted); font-size:0.76rem; flex-shrink:0; }
.sidebar-search-input {
  flex: 1; border:none; outline:none;
  background: transparent; font-size: 0.8rem; color: var(--text-primary);
}
.sidebar-search-input::placeholder { color:var(--text-muted); }

/* Chat History */
.chat-history {
  flex: 1; overflow-y: auto;
  padding: 0.7rem 0.9rem; min-height: 0;
}
.chat-history-eyebrow { margin-bottom: 0.45rem; padding: 0 0.15rem; }
.chat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.52rem 0.6rem; border-radius: var(--r-md);
  cursor: pointer; transition: var(--t-fast); gap: 0.35rem;
}
.chat-item:hover { background:var(--white); }
.chat-item.active { background:var(--sage-muted); }
.chat-item-title {
  font-size: 0.8rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.chat-item.active .chat-item-title { color:var(--sage); font-weight:500; }
.chat-item-del {
  opacity: 0; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.62rem;
  transition: var(--t-fast); flex-shrink: 0;
}
.chat-item:hover .chat-item-del { opacity:1; }
.chat-item-del:hover { background:var(--red-light); color:var(--red); }
.empty-history {
  font-size: 0.75rem; color: var(--text-muted);
  font-style: italic; padding: 0.4rem 0.2rem; text-align: center;
}

/* Settings section */
.sidebar-settings {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--cream-darker);
  flex-shrink: 0;
}
.sidebar-settings .section-eyebrow { margin-bottom: 0.55rem; }
.lang-setting-row { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.45rem; }
.lang-setting-icon { color:var(--sage); font-size:0.82rem; opacity:0.75; }
.lang-setting-text { font-size:0.79rem; color:var(--text-secondary); font-weight:500; }
.lang-pills { display:flex; flex-wrap:wrap; gap:0.28rem; }
.lang-pill {
  padding: 0.26rem 0.62rem; border-radius: var(--r-pill);
  font-size: 0.7rem; font-weight: 500;
  color: var(--text-secondary); background: var(--cream-dark);
  border: 1.5px solid transparent; transition: var(--t-base); cursor: pointer;
}
.lang-pill:hover { background:var(--sage-muted); color:var(--sage); }
.lang-pill.active { background:var(--sage); color:var(--cream); border-color:var(--sage); }

/* Sidebar profile strip */
.sidebar-profile {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.82rem 1.1rem; border-top: 1px solid var(--cream-darker);
  cursor: pointer; transition: var(--t-base); flex-shrink: 0;
  text-align: left; width: 100%;
}
.sidebar-profile:hover { background:var(--sage-muted); }
.profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sage); display: flex; align-items: center; justify-content: center;
  color: var(--cream); font-size: 0.88rem; font-weight: 700;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--cream-darker);
}
.profile-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.profile-info { flex:1; overflow:hidden; }
.profile-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-email {
  font-size: 0.69rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-chevron { color:var(--text-muted); font-size:0.72rem; flex-shrink:0; }

/* ════════════════════════════════════════
   ACCOUNT SIDEBAR
════════════════════════════════════════ */
#profile-sidebar {
  position: fixed; top: 0; left: 0;
  height: 100vh; width: var(--sidebar-w);
  background: var(--white); z-index: 600;
  display: flex; flex-direction: column;
  transform: translateX(-110%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-lg);
  border-right: 1px solid var(--cream-darker);
}
#profile-sidebar.open { transform:translateX(0); }

.profile-sidebar-header {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 1.05rem 1.15rem;
  border-bottom: 1px solid var(--cream-darker); flex-shrink: 0;
}
.profile-sidebar-back {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem; transition: var(--t-base);
}
.profile-sidebar-back:hover { background:var(--cream); color:var(--sage); }
.profile-sidebar-title { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); }

.profile-sidebar-body { flex:1; overflow-y:auto; padding-bottom:1.5rem; }

/* Avatar hero section */
.profile-avatar-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.85rem 1.5rem 1.3rem;
  background: linear-gradient(160deg, var(--cream) 0%, var(--white) 100%);
  border-bottom: 1px solid var(--cream-darker); gap: 0.55rem;
}
.profile-big-avatar {
  position: relative;
  width: 82px; height: 82px; border-radius: 50%;
  background: var(--sage);
  display: flex; align-items: center; justify-content: center;
  color: var(--cream); font-size: 1.95rem; font-weight: 700;
  overflow: visible;
  border: 3px solid var(--cream-dark);
  box-shadow: var(--shadow-sm);
}
.profile-big-avatar > span {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 50%;
}
.profile-big-avatar > img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.profile-photo-change-btn {
  position: absolute; bottom: -2px; right: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--sage); color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(45,66,63,0.3);
  transition: var(--t-base); z-index: 1;
}
.profile-photo-change-btn:hover { background:var(--sage-light); transform:scale(1.12); }
.profile-big-name {
  font-size: 1.18rem; font-weight: 700;
  color: var(--text-primary); text-align: center;
}
.profile-big-email {
  font-size: 0.79rem; color: var(--text-muted);
  text-align: center; margin-top: -0.2rem;
}
.profile-badge {
  display: flex; align-items: center; gap: 0.35rem;
  background: var(--sage-muted); color: var(--sage);
  padding: 0.27rem 0.8rem; border-radius: var(--r-pill);
  font-size: 0.71rem; font-weight: 500;
}

/* Account sections */
.account-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--cream-darker);
}
.account-section-header {
  display: flex; align-items: center; gap: 0.55rem;
  margin-bottom: 0.8rem;
}
.account-section-icon { color:var(--sage); font-size:0.82rem; opacity:0.8; }
.account-section-title {
  font-size: 0.71rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted);
}

/* Lang pills in account */
.lang-pills-account { display:flex; flex-wrap:wrap; gap:0.3rem; }

/* About Verae text */
.about-verae-text {
  font-size: 0.82rem; color: var(--text-secondary); line-height: 1.82;
}
.about-verae-text p { margin-bottom: 0.7rem; }
.about-verae-text p:last-child { margin-bottom: 0; }
.about-verae-text strong { color:var(--sage); font-weight:600; }
.about-verae-text em { font-style:italic; color:var(--text-muted); }

/* Fact card */
.fact-card {
  background: var(--cream); border-radius: var(--r-md);
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--cream-darker); position: relative;
}
.fact-text {
  font-size: 0.81rem; color: var(--text-secondary);
  line-height: 1.7; font-style: italic; padding-right: 1.8rem;
}
.fact-refresh-btn {
  position: absolute; top: 0.6rem; right: 0.65rem;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.75rem; transition: var(--t-base);
}
.fact-refresh-btn:hover { background:var(--sage-muted); color:var(--sage); }
.fact-refresh-btn.spinning i { animation:spin 0.6s linear; }

/* Stats grid */
.stats-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0.5rem; }
.stat-card {
  background: var(--cream); border-radius: var(--r-md);
  padding: 0.7rem 0.5rem; text-align: center;
  border: 1px solid var(--cream-darker);
  transition: var(--t-base);
}
.stat-card:hover { border-color:var(--sage-muted-md); }
.stat-number {
  display: block; font-size: 1.35rem; font-weight: 700;
  color: var(--sage); line-height: 1; margin-bottom: 0.22rem;
}
.stat-label { font-size: 0.62rem; color: var(--text-muted); font-weight: 500; }

/* Profile actions */
.profile-actions { padding: 1rem 1.25rem 0.5rem; }
.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.78rem 1.5rem; border-radius: var(--r-pill);
  border: 1.5px solid var(--red); color: var(--red);
  font-size: 0.86rem; font-weight: 500;
  transition: var(--t-base); width: 100%;
}
.btn-logout:hover { background:var(--red-light); }
.btn-logout i { font-size:0.82rem; }

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; padding: 0 1rem;
  z-index: 200;
  background: var(--cream);
  border-bottom: 1px solid var(--cream-darker);
}
.topbar-left { display:flex; align-items:center; gap:0.42rem; flex-shrink:0; }
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:0.35rem; flex-shrink:0; }

.hamburger-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  transition: var(--t-base); flex-shrink: 0;
}
.hamburger-btn span {
  display: block; width: 18px; height: 1.8px;
  background: var(--sage); border-radius: 2px; transition: var(--t-base);
}
.hamburger-btn:hover { background:var(--sage-muted); }

.btn-new-chat-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sage); color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(45,66,63,0.24);
  transition: var(--t-base); flex-shrink: 0;
}
.btn-new-chat-circle:hover {
  background: var(--sage-light);
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 4px 14px rgba(45,66,63,0.32);
}

.btn-topbar-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.82rem;
  border: 1.5px solid var(--cream-darker); background: var(--white);
  transition: var(--t-base);
}
.btn-topbar-icon:hover { border-color:var(--red); color:var(--red); background:var(--red-light); }

/* Brand center */
.topbar-brand {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.4rem;
  pointer-events: none; user-select: none;
}
.topbar-logo-img { width:26px; height:26px; object-fit:contain; border-radius:var(--r-xs); }
.topbar-brand-text {
  font-size: 1.05rem; font-weight: 700;
  color: var(--sage); letter-spacing: -0.025em;
}

/* ════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
#main-content {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; padding-top: var(--topbar-h); overflow: hidden;
}
#chat-area {
  flex: 1; overflow-y: auto;
  padding: 2rem 1.5rem 1rem;
  display: flex; flex-direction: column;
  scroll-behavior: smooth;
}

/* ════════════════════════════════════════
   WELCOME VIEW
════════════════════════════════════════ */
#welcome-view {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 1rem;
  padding: 2rem 1.5rem;
  animation: fadeIn 0.4s ease;
}
.welcome-logo-img {
  width: 72px; height: 72px; object-fit: contain;
  border-radius: var(--r-md); margin-bottom: 0.1rem;
  opacity: 0; animation: scaleIn 0.7s cubic-bezier(0.34,1.56,0.64,1) 0.1s forwards;
}
.welcome-greeting {
  font-family: var(--font-serif);
  font-size: 2rem; color: var(--sage);
  font-weight: 600; letter-spacing: -0.025em; line-height: 1.2;
  opacity: 0; animation: fadeInUp 0.5s ease 0.2s forwards;
}
.welcome-subtitle {
  font-size: 0.95rem; color: var(--text-muted); font-style: italic;
  opacity: 0; animation: fadeInUp 0.5s ease 0.32s forwards;
}
.quick-suggestions {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  justify-content: center; max-width: 540px;
  opacity: 0; animation: fadeInUp 0.5s ease 0.44s forwards;
}
.suggestion-pill {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.6rem 1.3rem;
  border: 1.5px solid var(--sage); color: var(--sage);
  border-radius: var(--r-pill); font-size: 0.84rem; font-weight: 500;
  transition: var(--t-base); cursor: pointer; background: var(--white);
}
.suggestion-pill i { font-size: 0.78rem; opacity: 0.8; }
.suggestion-pill:hover {
  background: var(--sage); color: var(--cream);
  box-shadow: 0 4px 14px rgba(45,66,63,0.2);
  transform: translateY(-2px);
}
.suggestion-pill:hover i { opacity:1; }

/* ════════════════════════════════════════
   MESSAGES
════════════════════════════════════════ */
#messages-view {
  display: none; flex-direction: column; gap: 1.3rem;
  max-width: 740px; width: 100%; margin: 0 auto;
  padding: 0.2rem 0 0.5rem;
}
#messages-view.active { display:flex; }

.message { display:flex; gap:0.7rem; animation:messageIn 0.26s ease forwards; }
.message.user { flex-direction:row-reverse; }
.message-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0.77rem; font-weight: 700; overflow: hidden;
}
.message.ai   .message-avatar { background:var(--sage);         color:var(--cream); }
.message.user .message-avatar { background:var(--cream-darker); color:var(--sage); }
.message.ai   .message-avatar img,
.message.user .message-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

.message-bubble {
  max-width: 74%; padding: 0.85rem 1.1rem;
  border-radius: var(--r-lg); font-size: 0.9rem; line-height: 1.74;
}
.message.ai   .message-bubble {
  background: var(--white); color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--cream-darker);
}
.message.user .message-bubble {
  background: var(--sage); color: var(--cream);
  border-bottom-right-radius: 4px;
}
.message-bubble h1,.message-bubble h2,.message-bubble h3 {
  color: var(--sage); margin: 0.6rem 0 0.3rem; line-height: 1.3;
}
.message-bubble h1 { font-size:1.05rem; }
.message-bubble h2 { font-size:0.96rem; }
.message-bubble h3 { font-size:0.9rem; }
.message-bubble p { margin-bottom: 0.38rem; }
.message-bubble p:last-child { margin-bottom:0; }
.message-bubble ul,.message-bubble ol { padding-left:1.3rem; margin:0.3rem 0; }
.message-bubble li { margin-bottom:0.15rem; }
.message-bubble strong { font-weight:600; }
.message-bubble em { font-style:italic; }
.message-bubble pre {
  background: var(--cream); padding: 0.7rem 0.85rem;
  border-radius: var(--r-xs); font-size: 0.78rem;
  overflow-x: auto; margin: 0.6rem 0;
  border: 1px solid var(--cream-darker);
}
.message-bubble code {
  background: var(--cream); padding: 0.12rem 0.33rem;
  border-radius: 4px; font-size: 0.82em;
}
.message.user .message-bubble code { background:rgba(255,255,255,0.18); }
.message-bubble blockquote {
  border-left: 3px solid var(--sage-muted-lg); padding-left: 0.75rem;
  margin: 0.35rem 0; color: var(--text-secondary); font-style: italic;
}

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 5px; align-items: center;
  padding: 0.85rem 1.1rem; background: var(--white);
  border-radius: var(--r-lg); border-bottom-left-radius: 4px;
  border: 1px solid var(--cream-darker);
  width: fit-content; box-shadow: var(--shadow-xs);
}
.typing-dot {
  width: 6px; height: 6px;
  background: var(--sage-lighter); border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ════════════════════════════════════════
   ATTACH PREVIEW
════════════════════════════════════════ */
.attach-preview-bar {
  display: flex; gap: 0.45rem;
  padding: 0.55rem 1.5rem 0;
  overflow-x: auto; flex-shrink: 0; align-items: center;
}
.attach-thumb {
  position: relative; width: 54px; height: 54px;
  border-radius: var(--r-sm); overflow: visible;
  flex-shrink: 0; border: 1.5px solid var(--cream-darker); background: var(--white);
}
.attach-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: calc(var(--r-sm) - 2px);
}
.attach-thumb-file {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  width: auto; min-width: 70px; height: 54px; padding: 0 0.5rem;
}
.attach-file-icon { font-size: 1.15rem; }
.attach-file-name {
  font-size: 0.6rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 66px;
}
.attach-thumb-remove {
  position: absolute; top: -7px; right: -7px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--sage); color: var(--cream);
  font-size: 0.62rem; display: flex; align-items: center; justify-content: center;
  z-index: 1; transition: var(--t-fast);
}
.attach-thumb-remove:hover { background:var(--red); }

/* ════════════════════════════════════════
   ATTACH MENU
════════════════════════════════════════ */
.attach-menu {
  position: fixed; background: var(--white);
  border: 1px solid var(--cream-darker);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.45rem; z-index: 9000;
  min-width: 190px; display: none; flex-direction: column; gap: 2px;
}
.attach-menu.open { display:flex; animation:popIn 0.16s ease forwards; }
.attach-option {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.85rem; border-radius: var(--r-md);
  transition: var(--t-fast); text-align: left; width: 100%;
}
.attach-option:hover { background:var(--cream); }
.attach-icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--sage-muted); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--sage); font-size: 0.88rem;
}
.attach-option-info { display:flex; flex-direction:column; gap:1px; }
.attach-label { font-size: 0.83rem; color: var(--text-secondary); font-weight: 500; }
.attach-sublabel { font-size: 0.68rem; color: var(--text-muted); }

/* ════════════════════════════════════════
   INPUT BAR
════════════════════════════════════════ */
#input-bar {
  padding: 0.7rem 1.5rem 1rem;
  background: var(--cream);
  border-top: 1px solid var(--cream-darker); flex-shrink: 0;
}
.input-wrapper { max-width: 740px; margin: 0 auto; }
.input-box {
  display: flex; align-items: flex-end; gap: 0.45rem;
  background: var(--white);
  border: 1.5px solid var(--cream-darker);
  border-radius: var(--r-2xl);
  padding: 0.58rem 0.65rem 0.58rem 0.85rem;
  box-shadow: var(--shadow-sm); transition: var(--t-base);
}
.input-box:focus-within {
  border-color: var(--sage);
  box-shadow: 0 0 0 2.5px var(--sage-muted), var(--shadow-sm);
}
.attach-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--sage); font-size: 0.9rem;
  transition: var(--t-base); flex-shrink: 0; opacity: 0.65;
}
.attach-btn:hover { opacity:1; background:var(--sage-muted); }
#message-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 0.9rem; color: var(--text-primary);
  resize: none; min-height: 22px; max-height: 158px;
  line-height: 1.56; padding: 0.1rem 0;
}
#message-input::placeholder { color:var(--text-muted); }
#send-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sage); color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; flex-shrink: 0;
  transition: var(--t-base);
  box-shadow: 0 2px 8px rgba(45,66,63,0.24);
}
#send-btn:hover { background:var(--sage-light); transform:scale(1.07); box-shadow:0 4px 14px rgba(45,66,63,0.32); }
#send-btn:disabled { opacity:0.42; cursor:not-allowed; transform:none; box-shadow:none; }
.input-hint {
  text-align: center; font-size: 0.67rem;
  color: var(--text-muted); margin-top: 0.48rem; font-style: italic;
}

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--sage); color: var(--cream);
  padding: 0.62rem 1.4rem; border-radius: var(--r-pill);
  font-size: 0.82rem; box-shadow: var(--shadow-md);
  opacity: 0; transition: all 0.27s ease;
  z-index: 9999; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 640px) {
  :root { --sidebar-w: 285px; }
  #chat-area { padding: 1.2rem 1rem 0.7rem; }
  #input-bar { padding: 0.55rem 0.85rem 0.85rem; }
  .welcome-greeting { font-size: 1.55rem; }
  .message-bubble { max-width: 88%; font-size: 0.875rem; }
  .topbar-brand-text { display:none; }
  .suggestion-pill span { display:none; }
  .suggestion-pill { padding:0.6rem 0.9rem; }
  .suggestion-pill i { font-size:0.96rem; opacity:1; }
}
@media (max-width: 380px) {
  .auth-widget { padding: 1.7rem 1.2rem; border-radius: var(--r-xl); }
  .welcome-greeting { font-size: 1.3rem; }
}
