/* =========================================================
   ScoreB - account menu (logged-in header icon + side bar)
   =========================================================
   Used by account-menu.js. Only the logged-in state is styled
   here; the logged-out "Login" button is untouched.
   ========================================================= */

/* ---------- Header: icon only, top right (where the Login button was) ---------- */
.acct-trigger {
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #0EA5E9;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.1s ease;
}
.acct-trigger:hover { background: rgba(14, 165, 233, 0.14); }
.acct-trigger:active { transform: scale(0.94); }
.acct-trigger:focus-visible { outline: 2px solid #0EA5E9; outline-offset: 2px; }

@media (max-width: 640px) {
  .acct-trigger { margin-right: -6px; }
}

/* ---------- Scroll lock while the menu / a dialog is open ---------- */
html.acct-lock, html.acct-lock body { overflow: hidden !important; }

/* ---------- Overlay + drawer ---------- */
.acct-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.acct-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2001;
  width: min(320px, 86vw);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated, #161b24);
  color: var(--text, #eef1f6);
  border-left: 1px solid var(--border, #2a3140);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s linear 0.28s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.acct-root.drawer-open .acct-overlay {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s;
}
.acct-root.drawer-open .acct-drawer {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s;
}

/* Top: avatar icon + username (+ close) */
.acct-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 16px 16px;
  border-bottom: 1px solid var(--border, #2a3140);
}
.acct-avatar { font-size: 40px; color: #0EA5E9; flex-shrink: 0; line-height: 1; }
.acct-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #eef1f6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-email {
  font-size: 12px;
  color: var(--text-dim, #9aa4b2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-email:empty { display: none; }

.acct-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text-dim, #9aa4b2);
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
}
.acct-close:hover { background: rgba(255, 255, 255, 0.07); color: var(--text, #eef1f6); }

/* Middle: settings */
.acct-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 12px;
}
.acct-section-title {
  margin: 0 0 8px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim, #9aa4b2);
}
.acct-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.acct-item {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: var(--text, #eef1f6);
  font-size: 15px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
.acct-item:hover, .acct-item:active { background: rgba(255, 255, 255, 0.06); }
.acct-item:focus-visible, .acct-logout:focus-visible, .acct-close:focus-visible,
.acct-cta:focus-visible { outline: 2px solid #0EA5E9; outline-offset: 2px; }

.acct-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.14);
  color: #0EA5E9;
  font-size: 16px;
}
.acct-item-label { flex: 1; min-width: 0; font-weight: 500; }
.acct-chev { font-size: 12px; color: var(--text-dim, #9aa4b2); }

.acct-item-danger { color: #ff6b6b; }
.acct-item-danger .acct-item-icon { background: rgba(255, 77, 79, 0.14); color: #ff6b6b; }
.acct-item-danger:hover, .acct-item-danger:active { background: rgba(255, 77, 79, 0.08); }

/* Bottom: logout, pinned */
.acct-foot {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, #2a3140);
}
.acct-logout {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: 1px solid var(--border, #2a3140);
  border-radius: 12px;
  color: var(--text, #eef1f6);
  font-size: 15px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.acct-logout:hover, .acct-logout:active { background: rgba(255, 255, 255, 0.06); border-color: var(--text-dim, #9aa4b2); }

/* ---------- Dialogs (logout confirm, delete account, notifications) ---------- */
.acct-modal-wrap {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.acct-modal-wrap[hidden] { display: none; }

.acct-modal {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin: 0;
  padding: 24px 20px 20px;
  background: var(--bg-elevated, #161b24);
  color: var(--text, #eef1f6);
  border: 1px solid var(--border, #2a3140);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.acct-modal-wrap:not([hidden]) { animation: acctFade 0.18s ease-out; }
.acct-modal-wrap:not([hidden]) .acct-modal { animation: acctPop 0.2s ease-out; }
@keyframes acctFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes acctPop { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.acct-modal h2 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.acct-modal p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--text-dim, #9aa4b2); }

.acct-modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.14);
  color: #0EA5E9;
  font-size: 22px;
}
.acct-modal-icon--danger { background: rgba(255, 77, 79, 0.14); color: #ff6b6b; }

.acct-modal-actions { display: flex; gap: 10px; }
.acct-cta {
  flex: 1;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease, background 0.15s ease;
}
.acct-cta:disabled { opacity: 0.55; cursor: not-allowed; }
.acct-cta--ghost { background: transparent; border-color: var(--border, #2a3140); color: var(--text, #eef1f6); }
.acct-cta--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.acct-cta--primary { background: #0EA5E9; color: #04121c; }
.acct-cta--primary:hover:not(:disabled) { filter: brightness(1.08); }
.acct-cta--danger { background: #e5484d; color: #fff; }
.acct-cta--danger:hover:not(:disabled) { filter: brightness(1.1); }

/* Delete: password field + messages */
.acct-field { text-align: left; margin: 0 0 14px; }
.acct-field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text, #eef1f6); }
.acct-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--bg, #0e1117);
  color: var(--text, #eef1f6);
  border: 1px solid var(--border, #2a3140);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS from zooming in on focus */
}
.acct-field input:focus { outline: none; border-color: #0EA5E9; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2); }
.acct-modal p.acct-note { margin: 0 0 14px; font-size: 13px; }
.acct-modal p.acct-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 77, 79, 0.12);
  color: #ff8a8c;
  font-size: 13px;
  text-align: left;
}
.acct-error[hidden], .acct-note[hidden], .acct-field[hidden] { display: none; }

/* Notifications dialog */
.acct-modal--list { text-align: left; }
.acct-modal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.acct-modal-top h2 { margin: 0; }
.acct-modal--list .acct-modal-sub { margin-bottom: 8px; }
.acct-switches { display: flex; flex-direction: column; margin-bottom: 6px; }
.acct-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border, #2a3140);
  cursor: pointer;
}
.acct-switch-row:last-child { border-bottom: 0; }
.acct-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-switch-text strong { font-size: 15px; font-weight: 600; color: var(--text, #eef1f6); }
.acct-switch-text small { font-size: 12px; line-height: 1.4; color: var(--text-dim, #9aa4b2); }

.acct-switch { position: relative; flex-shrink: 0; width: 48px; height: 28px; }
.acct-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.acct-slider { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 28px; background: #3a4356; transition: background 0.2s ease; }
.acct-slider::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.acct-switch input:checked + .acct-slider { background: #0EA5E9; }
.acct-switch input:checked + .acct-slider::before { transform: translateX(20px); }
.acct-switch input:focus-visible + .acct-slider { outline: 2px solid #0EA5E9; outline-offset: 2px; }
.acct-switch input:disabled { cursor: progress; }
.acct-switch input:disabled + .acct-slider { opacity: 0.55; }

.acct-modal p.acct-status { min-height: 18px; margin: 0 0 14px; font-size: 12px; text-align: left; }

/* Toast */
.acct-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 2200;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  transform: translateX(-50%);
  background: #0EA5E9;
  color: #04121c;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.acct-toast[hidden] { display: none; }

/* ---------- Phones: dialogs become bottom sheets ---------- */
@media (max-width: 480px) {
  .acct-modal-wrap { align-items: flex-end; padding: 0; }
  .acct-modal {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .acct-drawer, .acct-overlay, .acct-modal-wrap, .acct-modal, .acct-slider, .acct-slider::before { transition: none !important; animation: none !important; }
}
