/* Nebula — login / accounts page. Reuses the tokens from main.css. */

.auth-wrap { max-width: 420px; margin: 0 auto; padding: 48px 20px 72px; }

.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head__mark { font-size: 2.6rem; }
.auth-head h1 { font-size: 1.7rem; margin: 10px 0 4px; font-weight: 900; letter-spacing: -0.01em; }
.auth-head__sub { color: var(--muted); margin: 0; font-size: 0.95rem; }

.auth-card {
  background: rgba(24, 29, 49, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card--list { gap: 10px; }

.auth-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.4rem; margin: 0 auto;
  background: linear-gradient(135deg, rgba(139, 92, 255, 0.35), rgba(0, 229, 201, 0.22)), var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.auth-avatar--sm { width: 44px; height: 44px; font-size: 1.4rem; margin: 0; }

.auth-name { font-weight: 800; font-size: 1.1rem; margin: 0; text-align: center; }
.auth-name--sm { font-size: 0.98rem; text-align: left; }
.auth-mail { color: var(--muted); font-size: 0.85rem; margin: 0; text-align: center; }
.auth-name--sm + .auth-mail,
.acct-row__info .auth-mail { text-align: left; }

.avatar-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.avatar-opt {
  width: 38px; height: 38px; border-radius: 10px; font-size: 1.15rem; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.avatar-opt:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.1); }
.avatar-opt.is-on {
  border-color: var(--accent); background: rgba(139, 92, 255, 0.22);
  box-shadow: 0 0 0 2px var(--ring);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field__input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field__input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }

.auth-btn { width: 100%; text-align: center; }
.auth-link {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 0.8rem;
  cursor: pointer; text-align: center; padding: 4px;
}
.auth-link:hover { color: var(--text); text-decoration: underline; }

.auth-error { color: #ff7a90; font-size: 0.85rem; margin: 0; text-align: center; }
.auth-fine { color: var(--muted); opacity: 0.8; font-size: 0.72rem; margin: 2px 0 0; text-align: center; }

.auth-row { display: flex; align-items: center; gap: 12px; }
.auth-row__info { min-width: 0; }

.acct-row {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.06);
}
.acct-row__pick {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  background: none; border: none; cursor: pointer; text-align: left; color: inherit; font: inherit; padding: 2px;
}
.acct-row__info { min-width: 0; display: flex; flex-direction: column; }
.acct-row__info .auth-name--sm,
.acct-row__info .auth-mail {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.acct-row__del {
  background: none; border: none; color: var(--muted); font-size: 0.9rem;
  cursor: pointer; padding: 6px 9px; border-radius: 8px;
}
.acct-row__del:hover { color: #ff5cb8; background: rgba(255, 255, 255, 0.06); }

/* Header account badge (index.html) */
.account-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 0.9rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text); white-space: nowrap; cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.account-badge:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.account-badge__avatar { font-size: 1.05rem; }
.account-badge__name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------------
   Account dropdown (slide-down) menu
--------------------------------------------------------------------------- */
.acctmenu { position: relative; display: inline-flex; }
.acctmenu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 240px; overflow: hidden;
  background: rgba(20, 25, 43, 0.97); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px;
  box-shadow: var(--shadow);
  transform-origin: top right;
  animation: acct-slide 0.16s ease;
}
@keyframes acct-slide {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.acctmenu__head {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.acctmenu__head .auth-avatar--sm { width: 40px; height: 40px; font-size: 1.25rem; }
.acctmenu__info { min-width: 0; }
.acctmenu__name { font-weight: 700; font-size: 0.9rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctmenu__mail { color: var(--muted); font-size: 0.78rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctmenu__note { padding: 14px; color: var(--muted); font-size: 0.85rem; }
.acctmenu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; background: none; border: none; cursor: pointer;
  color: var(--text); font: inherit; font-size: 0.88rem; text-align: left;
  transition: background 0.12s;
}
.acctmenu__item:hover { background: rgba(255, 255, 255, 0.06); }
.acctmenu__item--danger { color: #ff7a90; }
.acctmenu__icon { width: 1.3em; text-align: center; }
.acctmenu__sep { height: 1px; background: rgba(255, 255, 255, 0.07); }

/* ---------------------------------------------------------------------------
   Modal (themes / settings)
--------------------------------------------------------------------------- */
.hp-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.hp-modal__backdrop { position: absolute; inset: 0; background: rgba(5, 7, 14, 0.66); backdrop-filter: blur(3px); animation: acct-slide 0.15s ease; }
.hp-modal__card {
  position: relative; width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto;
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow);
  padding: 22px; animation: acct-slide 0.18s ease;
}
.hp-modal__title { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.hp-modal__sub { margin: 0 0 18px; color: var(--muted); font-size: 0.88rem; }
.hp-modal__close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text); cursor: pointer; font-size: 1rem; font-family: inherit;
}
.hp-modal__close:hover { background: rgba(255, 255, 255, 0.12); }

/* Light / dark mode segmented switcher (themes modal) */
.mode-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 4px; margin: 0 0 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
}
.mode-opt {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 6px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 9px;
  color: var(--muted); font: inherit; font-size: 0.82rem; font-weight: 600;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.mode-opt__icon { font-size: 1.1rem; line-height: 1; }
.mode-opt:hover { color: var(--text); }
.mode-opt.is-on {
  color: #fff;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.9), rgba(var(--accent-2-rgb), 0.55));
  border-color: rgba(var(--accent-rgb), 0.5);
}

/* Theme swatches */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  color: var(--text); font: inherit; font-size: 0.9rem; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.theme-opt:hover { background: rgba(255, 255, 255, 0.08); }
.theme-opt.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.theme-opt__swatch { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; }
.theme-opt__check { margin-left: auto; color: var(--accent-2); font-weight: 800; }

/* Settings rows */
.set-section { margin-bottom: 18px; }
.set-section:last-child { margin-bottom: 0; }
.set-section__title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 4px; font-weight: 700; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.set-row:last-child { border-bottom: none; }
.set-row__label { font-size: 0.9rem; font-weight: 600; }
.set-row__desc { color: var(--muted); font-size: 0.76rem; margin: 2px 0 0; }
.set-btn {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
}
.set-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.set-btn:disabled { opacity: 0.6; cursor: default; }
.set-btn--danger { color: #ff7a90; border-color: rgba(255, 122, 144, 0.4); }

/* Toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background 0.15s; cursor: pointer; }
.switch__track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::before { transform: translateX(18px); }

/* ---------------------------------------------------------------------------
   Reduce-motion preference (Settings → Reduce motion)
--------------------------------------------------------------------------- */
html[data-reduce-motion="true"] .bg__orb,
html[data-reduce-motion="true"] .bg__stars,
html[data-reduce-motion="true"] .bg__beam,
html[data-reduce-motion="true"] .floater,
html[data-reduce-motion="true"] .grad { animation: none !important; }

/* ---------------------------------------------------------------------------
   Light mode overrides for accounts UI (cards, menu, modal, switches). The
   dark originals lean on white-alpha fills/borders that vanish on a light
   canvas, so re-tint them with dark-alpha.
--------------------------------------------------------------------------- */
html[data-mode="light"] .auth-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(20, 24, 50, 0.1);
}
html[data-mode="light"] .auth-avatar,
html[data-mode="light"] .avatar-opt { border-color: rgba(20, 24, 50, 0.12); }
html[data-mode="light"] .avatar-opt { background: rgba(20, 24, 50, 0.04); }
html[data-mode="light"] .avatar-opt:hover { background: rgba(20, 24, 50, 0.08); }
html[data-mode="light"] .field__input { border-color: rgba(20, 24, 50, 0.14); }
html[data-mode="light"] .acct-row { border-color: rgba(20, 24, 50, 0.1); }

html[data-mode="light"] .account-badge {
  background: rgba(20, 24, 50, 0.05); border-color: rgba(20, 24, 50, 0.12);
}
html[data-mode="light"] .account-badge:hover { background: rgba(20, 24, 50, 0.1); }

html[data-mode="light"] .acctmenu__panel {
  background: rgba(255, 255, 255, 0.97); border-color: rgba(20, 24, 50, 0.12);
}
html[data-mode="light"] .acctmenu__head { border-bottom-color: rgba(20, 24, 50, 0.08); }
html[data-mode="light"] .acctmenu__item:hover { background: rgba(20, 24, 50, 0.06); }
html[data-mode="light"] .acctmenu__sep { background: rgba(20, 24, 50, 0.08); }

html[data-mode="light"] .hp-modal__backdrop { background: rgba(20, 24, 50, 0.35); }
html[data-mode="light"] .hp-modal__card { border-color: rgba(20, 24, 50, 0.1); }
html[data-mode="light"] .hp-modal__close,
html[data-mode="light"] .set-btn,
html[data-mode="light"] .mode-switch,
html[data-mode="light"] .theme-opt {
  background: rgba(20, 24, 50, 0.05); border-color: rgba(20, 24, 50, 0.12);
}
html[data-mode="light"] .theme-opt:hover,
html[data-mode="light"] .set-btn:hover:not(:disabled),
html[data-mode="light"] .hp-modal__close:hover { background: rgba(20, 24, 50, 0.1); }
html[data-mode="light"] .set-row { border-bottom-color: rgba(20, 24, 50, 0.08); }
html[data-mode="light"] .switch__track { background: rgba(20, 24, 50, 0.18); }

/* ---------------------------------------------------------------------------
   Mobile tuning for the accounts UI (dropdown, modals, forms)
--------------------------------------------------------------------------- */
@media (max-width: 480px) {
  /* 16px controls stop iOS Safari from zooming in when a field is focused. */
  .field__input { font-size: 16px; }
  /* Never let the dropdown spill off a narrow screen. */
  .acctmenu__panel { width: min(264px, calc(100vw - 20px)); }
  .hp-modal { padding: 12px; }
  .hp-modal__card { padding: 18px; max-height: 90vh; }
  .auth-wrap { padding: 32px 16px 56px; }
  .auth-card { padding: 18px; }
}
