/* Shared account UI: header login/account menu, the account form and its modal.
   Used by the studio home and /solaris/ (js/session.js + js/auth.js). */

:root { --panel-hover: color-mix(in srgb, var(--bg-elev) 92%, #ffffff); --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1); }

[hidden] { display: none !important; }

.btn-text {
  padding: 6px 4px;
  font-weight: 600;
  color: var(--t2);
  transition: color var(--dur-2) var(--ease);
}
.btn.btn-text { height: auto; padding: 8px 10px; }
.btn-text:hover { color: var(--t1); }

.nav-account-slot { display: flex; align-items: center; }
.nav-account { position: relative; }
.nav-account-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 13px; color: var(--t1);
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.nav-account-btn:hover { border-color: var(--border-strong); background: var(--panel-hover); }
.nav-account-btn .caret { width: 14px; height: 14px; opacity: 0.6; }
.nav-account-avatar {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--t1); color: var(--bg);
  font-size: 12px; font-weight: 700;
}
.nav-account-avatar.lg { width: 34px; height: 34px; font-size: 15px; }
.nav-account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  width: 260px; padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
}
.nav-account-id { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.nav-account-id-text { display: flex; flex-direction: column; min-width: 0; }
.nav-account-id-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account-id-text .dim { font-size: 12px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account-note { margin: 0 0 12px; font-size: 12px; line-height: 1.4; color: var(--t3); }
.nav-account.mobile { margin-top: 24px; }
.nav-account.mobile .nav-account-id { margin-bottom: 12px; }

/* plan and payments in the account menu (js/session.js) */
.nav-account-billing { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.nav-billing-row { display: flex; flex-direction: column; gap: 4px; }
.nav-billing-row strong { font-size: 13px; }
.nav-billing-row span { font-size: 12px; line-height: 1.4; color: var(--t3); }
.nav-billing-row .btn { align-self: flex-start; margin-top: 4px; }
.nav-billing-row .btn.is-danger { color: #ff8a8a; border-color: color-mix(in srgb, #ff5c5c 45%, transparent); }

.mobile-panel a b { font-weight: inherit; }

/* the form (cloned from #accountFormTemplate by js/auth.js) */
.account-card {
  padding: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  box-shadow: 0 50px 110px -60px rgba(0, 0, 0, 0.85);
}
.account-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.account-card-head h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.account-card .field { margin-bottom: 16px; }
.account-card .field label {
  display: block; margin-bottom: 7px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--t3);
}
.account-card .input-row { position: relative; }
.account-card .field input {
  width: 100%; height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit; font-size: 14px; color: var(--t1);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.account-card .input-row input { padding-right: 40px; }
.account-card .field input:focus {
  outline: none;
  border-color: var(--t1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t1) 14%, transparent);
}
.account-card .toggle-visibility {
  position: absolute; right: 8px; top: 50%;
  display: grid; place-items: center;
  padding: 4px;
  color: var(--t3);
  transform: translateY(-50%);
}
.account-card .toggle-visibility:hover { color: var(--t1); }
.account-card .toggle-visibility .icon { width: 17px; height: 17px; }
.account-card small.hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--t3); }
.forgot-row { margin: -4px 0 18px; text-align: right; }
.forgot-row .btn-text { padding: 0; font-size: 12.5px; }

.field-error { display: none; margin-top: 6px; font-size: 11.5px; color: color-mix(in srgb, #ff5c5c 88%, var(--t1)); }
.field.has-error input { border-color: #ff5c5c; }
.field.has-error .field-error { display: block; }

.terms-row { display: flex; align-items: flex-start; gap: 9px; margin: 6px 0 18px; font-size: 12.5px; line-height: 1.5; color: var(--t3); }
.terms-row input { margin-top: 3px; accent-color: var(--t1); }
.terms-row a { color: var(--t2); border-bottom: 1px solid var(--border-strong); }
.terms-row a:hover { color: var(--t1); }
.terms-row.has-error { color: color-mix(in srgb, #ff5c5c 88%, var(--t1)); }

.form-notice {
  display: none; align-items: flex-start; gap: 10px;
  margin-top: 16px; padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12.5px; line-height: 1.5; color: var(--t2);
}
.form-notice.show { display: flex; animation: notice-in var(--dur-3) var(--ease); }
.form-notice.is-ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.form-notice .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--t2); }
@keyframes notice-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.form-done { text-align: center; padding: 8px 0 4px; }
.form-done > .icon {
  width: 44px; height: 44px; margin: 0 auto 16px; padding: 11px;
  border: 1px solid color-mix(in srgb, var(--ok) 50%, var(--border));
  border-radius: 50%;
  stroke: var(--ok); stroke-width: 2.2;
}
.form-done h4 { margin-bottom: 8px; font-size: 18px; letter-spacing: -0.02em; }
.form-done p { margin-bottom: 20px; font-size: 13.5px; line-height: 1.6; color: var(--t2); }

.auth-switch { margin-top: 18px; text-align: center; font-size: 13px; color: var(--t3); }
.auth-switch button { font-weight: 600; color: var(--t1); }
.auth-switch button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* the same form as a modal (header "Log in", footer links, buying) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(6, 6, 8, 0.7);
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-overlay .account-card {
  width: 100%; max-width: 420px; max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elev);
  animation: modal-in var(--dur-3) var(--ease-spring);
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: none; } }
.modal-close { display: grid; place-items: center; padding: 4px; color: var(--t3); }
.modal-close:hover { color: var(--t1); }

@media (max-width: 720px) { .nav-actions .nav-account-slot { display: none; } }
.nav-account-manage { margin-bottom: 8px; }
.nav-account.mobile .btn + .btn { margin-top: 8px; }
