/* accounts.css — auth pages, header account control, sidebar (Moní)
   Uses the site's existing theme variables so it matches light/dark automatically. */

/* ── Header account control ── */
.acct-wrap { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 10px;
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px;
  color: var(--text-primary); cursor: pointer; font: 500 14px/1 inherit;
  transition: background .2s var(--ease-out), border-color .2s;
  min-width: 0; max-width: 40vw;
}
.acct-btn:hover { background: var(--bg-tertiary); border-color: var(--gold); }
/* The display name/email-local-part had no bound and could overflow the header on a narrow phone,
   pushing the burger menu off-screen. Truncate it, and drop it entirely on small screens (avatar only). */
.acct-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .acct-label { display: none; } }
.acct-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px; object-fit: cover;
  background: var(--gold); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; text-transform: uppercase;
}
.acct-login-btn {
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--gold);
  background: var(--gold); color: var(--gold-ink); font: 600 14px/1 inherit; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: filter .2s; white-space: nowrap;
}
.acct-login-btn:hover { filter: brightness(1.07); }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: all .18s var(--ease-out); z-index: 200;
}
.acct-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.acct-menu .acct-head { padding: 10px 12px; border-bottom: 1px solid var(--border-color); margin-bottom: 4px; }
.acct-menu .acct-name { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.acct-menu .acct-email { color: var(--text-secondary); font-size: 12px; margin-top: 2px; word-break: break-all; }
.acct-menu a, .acct-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  background: none; border: 0; border-radius: 8px; color: var(--text-primary);
  font: 500 14px/1 inherit; cursor: pointer; text-decoration: none; text-align: left;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--bg-secondary); }
.acct-menu .danger { color: var(--danger); }

/* ── Auth page (login / register) ── */
.auth-page { min-height: calc(100vh - var(--header-height)); display: grid; place-items: center; padding: 32px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg-primary);
  border: 1px solid var(--border-color); border-radius: 18px; padding: 32px 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,.08); animation: authIn .5s var(--ease-spring);
}
@keyframes authIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-logo { display: block; height: 38px; margin: 0 auto 18px; }
.auth-title { text-align: center; font: 600 22px/1.2 'Roboto Serif', serif; color: var(--text-primary); margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 22px; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.auth-input {
  width: 100%; height: 46px; padding: 0 14px; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: 11px; color: var(--text-primary);
  font-size: 15px; transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus { outline: 0; border-color: var(--input-border-focus); box-shadow: 0 0 0 3px var(--gold-soft); }
.auth-submit {
  width: 100%; height: 48px; margin-top: 6px; border: 0; border-radius: 11px;
  background: var(--gold); color: var(--gold-ink); font: 600 15px/1 inherit; cursor: pointer;
  transition: filter .2s, transform .1s;
}
.auth-submit:hover { filter: brightness(1.07); }
.auth-submit:active { transform: scale(.99); }
.auth-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 16px; text-align: center;
}
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-color); }
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 48px;
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 11px;
  color: var(--text-primary); font: 600 15px/1 inherit; cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s;
}
.auth-google:hover { background: var(--bg-tertiary); border-color: var(--gold); }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-foot a { color: var(--gold); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ── Sidebar (chat history) ── */
.sb-toggle { position: fixed; left: 14px; top: calc(var(--header-height) + 12px); z-index: 120;
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-primary);
  cursor: pointer; transition: background .2s, opacity .2s, transform .2s; }
.sb-toggle:hover { background: var(--bg-tertiary); border-color: var(--gold); }
body.sb-open .sb-toggle { opacity: 0; pointer-events: none; transform: translateX(-8px); }
/* Overlay backdrop shown at ALL breakpoints when the sidebar is open: gives a reliable
   click-outside-to-close target on desktop too (previously only mobile had it, so the desktop
   sidebar could feel "stuck"). The sidebar floats over the content — the content never shifts,
   which avoids the fixed chat-footer / scroll-button misalignment the old desktop push caused. */
.sb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.32); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; z-index: 2500; }
body.sb-open .sb-overlay { opacity: 1; visibility: visible; }
/* Above the fixed chat-footer (z 1000) and header (z 2000) so the drawer sits over them, but below
   modals (z 3000). Previously z 140 let the input bar and header punch through the open sidebar. */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 2510;
  background: var(--bg-secondary); border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; transform: translateX(-100%);
  transition: transform .3s var(--ease-out); padding: 14px 12px; }
body.sb-open .sidebar { transform: none; box-shadow: 4px 0 28px rgba(0,0,0,.14); }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.sb-head-title { font: 600 16px/1 'Roboto Serif', serif; color: var(--text-primary); }
.sb-collapse { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none;
  border-radius: 8px; color: var(--text-secondary); cursor: pointer; }
.sb-collapse:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sb-new { display: flex; align-items: center; gap: 8px; width: 100%; height: 42px; padding: 0 14px; margin-bottom: 10px;
  border: 1px solid var(--border-color); border-radius: 11px; background: var(--bg-primary); color: var(--text-primary);
  font: 600 14px/1 inherit; cursor: pointer; transition: .2s; }
.sb-new:hover { border-color: var(--gold); background: var(--bg-tertiary); }
.sb-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.sb-empty { color: var(--text-secondary); font-size: 13px; text-align: center; padding: 30px 12px; line-height: 1.5; }
.sb-item { display: flex; align-items: center; gap: 6px; padding: 9px 8px 9px 10px; border-radius: 9px; cursor: pointer; transition: background .15s; }
.sb-item:hover { background: var(--bg-tertiary); }
.sb-item.active { background: var(--gold-soft); }
.sb-pin-dot { color: var(--gold); display: flex; flex: 0 0 auto; }
.sb-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; color: var(--text-primary); }
.sb-actions { display: flex; gap: 1px; opacity: 0; transition: opacity .15s; flex: 0 0 auto; }
.sb-item:hover .sb-actions { opacity: 1; }
.sb-act { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: var(--text-secondary); cursor: pointer; }
.sb-act:hover { background: var(--bg-primary); color: var(--text-primary); }
.sb-act.danger:hover { color: var(--danger); }
.sb-rename { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--gold); border-radius: 7px; background: var(--input-bg); color: var(--text-primary); font-size: 14px; }
@media (max-width: 899px) { .sidebar { width: 84vw; max-width: 320px; } }

/* ── Profile ── */
.prof-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.prof-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--gold);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 26px; text-transform: uppercase; flex: 0 0 64px; }
.prof-avatar img { width: 100%; height: 100%; object-fit: cover; }
.prof-avatar-btn { padding: 9px 14px; border: 1px solid var(--border-color); border-radius: 10px;
  background: var(--bg-secondary); color: var(--text-primary); font-size: 14px; cursor: pointer; transition: .2s; }
.prof-avatar-btn:hover { border-color: var(--gold); background: var(--bg-tertiary); }

/* ── Streaming cursor ── */
.stream-cursor { display: inline-block; width: 7px; height: 1.05em; vertical-align: text-bottom;
  margin-left: 2px; background: var(--gold); border-radius: 2px; animation: streamBlink 1s steps(2) infinite; }
@keyframes streamBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ── Attach (paperclip) button ── */
.attach-btn { display: grid; place-items: center; width: 38px; height: 38px; border: none;
  border-radius: 10px; background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: .18s; flex: 0 0 auto; }
.attach-btn:hover { color: var(--gold); background: var(--bg-tertiary); }
.attach-btn svg { display: block; }

/* ── Attached-file chip ── */
.attach-chip { display: flex; align-items: center; gap: 10px; max-width: 100%;
  margin: 0 4px 8px; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 12px;
  background: var(--bg-secondary); font-size: 13px; color: var(--text-primary); animation: chipIn .18s ease; }
@keyframes chipIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.attach-chip .attach-ic { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 8px; background: var(--gold); color: #fff; }
.attach-chip .attach-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.attach-chip .attach-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chip .attach-sub { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.attach-chip .attach-x { margin-left: auto; flex: 0 0 auto; width: 24px; height: 24px; border: none;
  border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 18px;
  line-height: 1; cursor: pointer; transition: .18s; }
.attach-chip .attach-x:hover { color: #e5484d; background: var(--bg-tertiary); }
.attach-chip .attach-spin { margin-left: auto; flex: 0 0 auto; width: 16px; height: 16px;
  border: 2px solid var(--border-color); border-top-color: var(--gold); border-radius: 50%;
  animation: chipSpin .7s linear infinite; }
@keyframes chipSpin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.moni-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  max-width: 92%; padding: 12px 18px; border: 1px solid var(--border-color); border-radius: 12px;
  background: var(--bg-secondary); color: var(--text-primary); font-size: 14px; line-height: 1.4;
  box-shadow: 0 8px 28px rgba(0,0,0,.28); opacity: 0; pointer-events: none; z-index: 9999;
  transition: opacity .25s, transform .25s; }
.moni-toast.show { opacity: 1; transform: translate(-50%, 0); }
