/* SpikeUI account area — reuses the site's CSS custom properties. */

/* The HTML [hidden] attribute is display:none by default, but any author rule
   setting display (e.g. .verify-banner { display:flex }) overrides it, so the
   banner/list would stay visible after JS sets .hidden=true. Force it. */
[hidden] { display: none !important; }

:root {
  --account-bg: #0b0c10;
  --account-card: #15171d;
  --account-border: rgba(255, 255, 255, 0.08);
  --account-muted: #9aa0ad;
}

.account-page {
  background: var(--account-bg);
  color: #e8eaf0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.account-shell {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.account-header {
  text-align: center;
  margin-bottom: 2rem;
}

/* "Back to SpikeUI" link — styled as a visible pill, below the form. */
.account-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent, #ff6b35);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--account-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.account-back:hover {
  border-color: var(--accent, #ff6b35);
  color: #fff;
  background: rgba(255, 107, 53, 0.08);
}
.account-brand {
  font-size: 1.6rem;
  margin: 0;
  color: var(--accent, #ff6b35);
  letter-spacing: 0.5px;
}
.account-tagline {
  color: var(--account-muted);
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
}

.account-view { animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Center the login/register form vertically and horizontally on screen. */
#view-auth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}
.auth-brand { text-align: center; }
#view-auth .auth-card { width: 100%; }

/* Logged-in view: stack the card contents and center the back link at the bottom. */
.account-card { display: flex; flex-direction: column; }
.account-card > .account-back { align-self: center; margin-top: 1.75rem; }

.auth-card,
.account-card {
  background: var(--account-card);
  border: 1px solid var(--account-border);
  border-radius: 12px;
  padding: 1.75rem;
}

.auth-card h2,
.account-card h2 {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
  color: #fff;
}

.auth-form label,
.auth-form label span {
  display: block;
}
.auth-form label {
  margin-bottom: 1rem;
}
.auth-form span {
  font-size: 0.85rem;
  color: var(--account-muted);
  margin-bottom: 0.35rem;
}
.auth-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  background: var(--account-bg);
  border: 1px solid var(--account-border);
  border-radius: 6px;
  color: #e8eaf0;
  font-size: 0.95rem;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent, #ff6b35);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary {
  background: var(--accent, #ff6b35);
  color: #fff;
  border: none;
}
.btn-primary:hover { filter: brightness(1.08); }

/* "or" divider between the password login button and the Google button. */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1rem 0;
  color: var(--account-muted, #8a90a0);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--account-border);
}
.auth-divider::before { margin-right: 0.75rem; }
.auth-divider::after { margin-left: 0.75rem; }

/* Google Identity Services button container: center the GIS-rendered iframe. */
.g_id_signin { display: flex; justify-content: center; }

/* Download-full button uses a blue accent to distinguish it from the buy button. */
#btn-download-full { background: #2563eb; border-color: #2563eb; color: #fff; }
#btn-download-full:hover { filter: brightness(1.08); }

/* Center the three action buttons (buy, reset activations, download).
   fit-content keeps each button at its natural width; margin auto centers it
   without affecting the left-aligned h2/p in the same block. */
#btn-buy, .btn-reset-act, #btn-download-full { display: block; width: fit-content; margin: 0 auto; }

/* Separator + extra spacing between the buy block and the "Your keys" block. */
.account-block:has(.keys-head) { border-top: 1px solid var(--account-border); margin-top: 2.25rem; padding-top: 1.75rem; }

/* Separator + extra spacing above the "Download full version" block. */
#download-full { border-top: 1px solid var(--account-border); margin-top: 2.25rem; padding-top: 1.75rem; }

/* Shopping-cart icon on the buy button (CSS pseudo-element so i18n's
   textContent swap doesn't wipe it). */
#btn-buy { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
#btn-buy { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
#btn-buy::before {
  content: '';
  width: 16px;
  height: 16px;
  flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Terms box under the buy button. */
.buy-terms {
  list-style: none;
  padding: 0.85rem 1rem;
  margin: 1rem 0 0;
  border: 1px solid var(--account-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.buy-terms li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--account-muted);
  margin-bottom: 0.45rem;
}
.buy-terms li:last-child { margin-bottom: 0; }
.buy-terms li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent, #ff6b35);
}

/* Reset-activations button: dark red background, white text for contrast. */
.btn-reset-act { background: #3d2222; border-color: #3d2222; color: #fff; text-decoration: none; }
.btn-reset-act:hover { filter: brightness(1.12); }
.btn-ghost {
  background: transparent;
  color: var(--account-muted);
  border: 1px solid var(--account-border);
}
.btn-ghost:hover { color: #fff; border-color: var(--accent, #ff6b35); }

.auth-hint {
  font-size: 0.8rem;
  color: var(--account-muted);
  margin: -0.5rem 0 1rem;
}
.auth-switch {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--account-muted);
}
.auth-switch a {
  color: var(--accent, #ff6b35);
  text-decoration: none;
}

.auth-error {
  margin-top: 1rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: 6px;
  color: #ff9a9a;
  font-size: 0.85rem;
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--account-border);
}
.account-label {
  display: block;
  font-size: 0.75rem;
  color: var(--account-muted);
  margin-bottom: 0.2rem;
}
.account-email {
  font-size: 1rem;
  color: #fff;
  word-break: break-all;
}

.account-block { margin-top: 1.5rem; }

.keys-warning {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  color: #5f656d;
}

.keys-head { display: flex; align-items: center; gap: 0.5rem; }
.keys-head h2 { margin: 0; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--account-border);
  background: transparent;
  color: var(--account-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.btn-icon:hover { color: #fff; border-color: var(--accent, #ff6b35); }
.btn-icon:disabled { cursor: default; }
.btn-icon.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.verify-banner {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 107, 53, 0.08);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.verify-banner p {
  margin: 0;
  color: #ffd9c0;
  font-size: 0.85rem;
}
.account-muted {
  color: var(--account-muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.keys-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.key-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--account-bg);
  border: 1px solid var(--account-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}
.key-value {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  color: #fff;
  word-break: break-all;
}
.key-status {
  font-size: 0.7rem;
  color: var(--success, #4caf50);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Activation badge per license key (state from Polar). */
.key-act {
  font-size: 0.7rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  color: var(--account-muted);
}
.key-act-activated { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.key-act-free { background: rgba(37, 99, 235, 0.16); color: #6ea8ff; }
.key-act-revoked, .key-act-disabled { background: rgba(255, 80, 80, 0.12); color: #ff9a9a; }

.account-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent, #ff6b35);
  color: #fff;
  padding: 0.9rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  max-width: 90vw;
  text-align: center;
  animation: toast-in 0.18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 0.6rem); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 480px) {
  .account-shell { padding: 1.25rem 1rem 3rem; }
  .account-row { flex-direction: column; align-items: stretch; }
}