/* The account page. Tokens come from style.css. */

/* Classes that set display would otherwise override the hidden attribute. */
.account [hidden],
.confirm-dialog [hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.account {
  padding: clamp(40px, 6vw, 72px) 0 80px;
  min-height: 60vh;
}

.account h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin-bottom: 12px;
}

.account .lead {
  margin-bottom: 28px;
}

.account-loading {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--primary-100);
  border-top-color: var(--primary-500);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(20px, 4vw, 28px);
  margin-bottom: 16px;
}

.account-card h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.account-card p:last-child {
  margin-bottom: 0;
}

.account-card-danger {
  border-color: var(--error);
}

.danger-title {
  color: var(--error) !important;
}

.account-card-warning {
  background: var(--accent-butter);
  border-color: transparent;
  box-shadow: none;
}

.account-card-warning p {
  color: var(--neutral-800);
  font-size: 0.98rem;
}

.account-section-title {
  font-size: 1.45rem;
  margin: 40px 0 14px;
}

.account-signed-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 18px;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
}

.account-signed-in p {
  margin: 0;
  overflow-wrap: anywhere;
}

.account-hint {
  color: var(--neutral-500);
  font-size: 0.92rem;
  margin: 14px 0 0;
}

.account-error {
  color: var(--error);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 14px 0 0;
}

.account-note {
  margin-top: 32px;
}

.account-note h2 {
  font-size: 1.2rem;
  font-family: var(--font-ui);
  font-weight: 700;
}

.account-note p {
  color: var(--neutral-600);
  font-size: 0.98rem;
}

.account-callout {
  background: var(--primary-50);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--neutral-700);
  font-size: 0.98rem;
}

.fine-print {
  color: var(--neutral-500);
  font-size: 0.88rem;
  text-align: center;
}

/* ---------- Sign in ---------- */

.signin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.signin-card > * {
  width: 100%;
  max-width: 400px;
}

/* Google's rules for a button of our own: white, a #747775 border, #1F1F1F
   Roboto Medium, and the four-colour G. Size and corners may be ours. */
.btn-google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
  font-family: "Roboto", var(--font-ui);
  font-weight: 500;
}
.btn-google:hover {
  background: #f8f9fa;
}
.btn-google svg {
  width: 20px;
  height: 20px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--neutral-400);
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--neutral-200);
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--neutral-500);
}

.field-input {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: inherit;
  color: var(--neutral-900);
}

.code-input {
  font-size: 1.3rem;
  letter-spacing: 0.3em;
}

.code-blurb {
  margin: 0;
  color: var(--neutral-600);
  font-size: 0.98rem;
}

.code-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.link-button {
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-600);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.link-button:disabled {
  color: var(--neutral-400);
  cursor: default;
}

/* ---------- Buttons ---------- */

.btn-apple {
  background: #000;
  color: #fff;
}
.btn-apple:hover {
  background: #222;
}
.btn-apple svg {
  width: 17px;
  height: 20px;
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-700);
}
.btn-ghost:hover {
  background: var(--neutral-100);
}

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover {
  background: #a3303b;
}
.btn-danger:disabled {
  background: var(--neutral-300);
  cursor: not-allowed;
}

.btn-danger-soft {
  background: #fbe7e9;
  color: var(--error);
}
.btn-danger-soft:hover {
  background: #f6d3d7;
}
.btn-danger-soft:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn:focus-visible,
.back-link:focus-visible,
.confirm-input:focus-visible,
.field-input:focus-visible,
.link-button:focus-visible,
.toggle-row input:focus-visible {
  outline: 3px solid var(--primary-300);
  outline-offset: 2px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0;
  margin-bottom: 8px;
  border: 0;
  background: none;
  color: var(--primary-600);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Plan ---------- */

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-label {
  font-weight: 700;
  color: var(--neutral-900);
}

.plan-badge {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-weight: 700;
  font-size: 0.9rem;
}

.plan-badge.is-premium {
  background: var(--primary-500);
  color: #fff;
}

.plan-detail {
  margin: 14px 0 0;
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.store-links .btn {
  flex: 1 1 220px;
}

.store-inline {
  margin-top: 8px;
  font-size: 0.95rem;
}

.store-inline a {
  display: inline-block;
  padding: 12px 0;
  font-weight: 600;
}

/* ---------- Deletion ---------- */

.account-list {
  padding-left: 22px;
  margin: 0;
}

.account-list li {
  margin-bottom: 6px;
}

.journal-rows {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}

.journal-rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--neutral-200);
}

.journal-name {
  font-weight: 600;
  color: var(--neutral-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.journal-count {
  flex-shrink: 0;
  color: var(--neutral-500);
  font-size: 0.88rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin: 12px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--neutral-200);
  font-weight: 600;
  color: var(--neutral-900);
  cursor: pointer;
}

.toggle-row input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--neutral-300);
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.15s ease;
}

.toggle-row input:checked {
  background: var(--error);
}

.toggle-row input:checked::after {
  transform: translateX(20px);
}

.confirm-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}

.confirm-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--neutral-500);
}

.confirm-input {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: inherit;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--neutral-900);
}

.confirm-form .btn-danger {
  margin-top: 6px;
}

/* ---------- Confirmation dialog ---------- */

.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-floating);
  color: var(--neutral-700);
}

.confirm-dialog::backdrop {
  background: rgba(43, 26, 41, 0.45);
}

.confirm-dialog h2 {
  font-size: 1.4rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
