/* css/offline-sos.css
   Offline SOS — rebuilt from scratch to replace offline-purchase.css.
   New class prefix (sos-*) so nothing here can collide with, or be
   confused for, the old offline-purchase-* rules.
*/

/* ── Page ─────────────────────────────────────────────────────────── */
.sos-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sos-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.sos-topbar__back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.sos-topbar__back svg { width: 16px; height: 16px; }

.sos-topbar h1 {
  font-size: var(--text-md);
  font-weight: var(--font-semi);
  color: var(--text-primary);
}

.sos-content {
  flex: 1;
  padding: var(--space-md) 16px 100px; /* clears the pinned footer */
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── Hero / status ────────────────────────────────────────────────── */
.sos-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.sos-hero__beacon {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xs);
}

.sos-hero__beacon-dot {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  transition: background var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
}
.sos-hero__beacon-dot svg { width: 24px; height: 24px; }

.sos-hero__beacon-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--success);
  opacity: 0;
}

/* Signature moment: a slow radar-style ping, only while Offline SOS is
   actually active — reads as "listening", not decoration. */
.sos-hero[data-state="active"] .sos-hero__beacon-dot {
  background: var(--success-soft);
  color: #4ADE80;
  border-color: rgba(74, 222, 128, 0.3);
}
.sos-hero[data-state="active"] .sos-hero__beacon-ring {
  animation: sos-ping 2.2s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}

@keyframes sos-ping {
  0%   { transform: scale(0.85); opacity: 0.55; }
  70%  { transform: scale(1.9);  opacity: 0; }
  100% { transform: scale(1.9);  opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sos-hero[data-state="active"] .sos-hero__beacon-ring { animation: none; }
}

.sos-hero__title {
  font-size: var(--text-md);
  font-weight: var(--font-semi);
  color: var(--text-primary);
  margin: 0;
}

.sos-hero__subtitle {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 30ch;
}

/* ── Active details ───────────────────────────────────────────────── */
.sos-details {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sos-details__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}
.sos-details__row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.sos-details__label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.sos-details__value {
  font-size: var(--text-xs);
  color: var(--text-primary);
  font-weight: var(--font-semi);
  text-align: right;
}
.sos-details__value--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.sos-details__note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: var(--space-xs) 0 0;
}
.sos-details__note svg {
  width: 14px;
  height: 14px;
  color: #4ADE80;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Setup form ───────────────────────────────────────────────────── */
.sos-setup {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sos-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sos-field__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semi);
  color: var(--text-primary);
}

.sos-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--transition-fast);
}
.sos-input:focus  { border-color: var(--primary, #7c5cfc); }
.sos-input--error { border-color: var(--danger); }

.sos-field__error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin: 0;
}

.sos-requirement {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--text-xs);
  color: #FCD34D;
  background: var(--pending-soft);
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.5;
  margin: 0;
}
.sos-requirement svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── How it works ─────────────────────────────────────────────────── */
.sos-how {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sos-how__title {
  font-size: var(--text-xs);
  font-weight: var(--font-semi);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.sos-how__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sos-how__num {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-semi);
  flex-shrink: 0;
  margin-top: 1px;
}

.sos-how__row p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.sos-how__row strong { color: var(--text-primary); }

/* ── Pinned footer action ─────────────────────────────────────────── */
/* position: sticky (not fixed) deliberately — this page renders inside
   #app-content, and a lingering CSS transform anywhere up that chain
   (page-transition animations do this) silently breaks position:fixed
   children by giving them the wrong containing block. Sticky has no
   such dependency. */
.sos-footer {
  position: sticky;
  bottom: 0;
  padding: var(--space-md) 16px calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--bg-base) 30%);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
