/*
 * TBSJ Satoshi Converter — Stylesheet
 * Precision instrument aesthetic: clean, light, typographically exact.
 * Sometype Mono for all numbers. DM Sans for labels.
 * Theme-inheriting by default — no forced dark context.
 */

/* ── Custom properties ─────────────────────────────────────── */
.tbsj-sat-wrap {
  --sat-orange:       #F7931A;
  --sat-orange-dim:   rgba(247, 147, 26, 0.10);
  --sat-orange-glow:  rgba(247, 147, 26, 0.20);
  --sat-green:        #16a34a;
  --sat-red:          #dc2626;
  --sat-border:       rgba(0, 0, 0, 0.09);
  --sat-border-focus: rgba(247, 147, 26, 0.55);
  --sat-bg-row:       transparent;
  --sat-bg-row-hover: rgba(247, 147, 26, 0.04);
  --sat-bg-sats:      rgba(247, 147, 26, 0.06);
  --sat-radius:       8px;
  --sat-mono:         'Sometype Mono', 'Courier New', monospace;
  --sat-sans:         'DM Sans', system-ui, sans-serif;
}

/* ── Wrapper ───────────────────────────────────────────────── */
.tbsj-sat-wrap {
  max-width: 540px;
  font-family: var(--sat-sans);
  font-size: 14px;
}

/* ── Config error ──────────────────────────────────────────── */
.tbsj-sat-cfg-error {
  color: var(--sat-red);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: var(--sat-radius);
}
.tbsj-sat-cfg-error a { color: inherit; font-weight: 700; }

/* ── Live price ticker ─────────────────────────────────────── */
.tbsj-sat-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 14px;
  flex-wrap: wrap;
}

.tbsj-sat-ticker-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.35;
  font-weight: 600;
}

.tbsj-sat-ticker-price {
  font-family: var(--sat-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sat-orange);
  letter-spacing: -0.01em;
  transition: color 0.2s;
}

/* Pulse on price update */
.tbsj-sat-ticker-price.refreshing {
  animation: sat-price-pulse 0.4s ease both;
}
@keyframes sat-price-pulse {
  0%   { opacity: 0.4; }
  100% { opacity: 1; }
}

.tbsj-sat-ticker-change {
  font-family: var(--sat-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}
.tbsj-sat-ticker-change.pos {
  color: var(--sat-green);
  background: rgba(22, 163, 74, 0.09);
}
.tbsj-sat-ticker-change.neg {
  color: var(--sat-red);
  background: rgba(220, 38, 38, 0.09);
}

.tbsj-sat-ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sat-green);
  box-shadow: 0 0 5px var(--sat-green);
  margin-left: auto;
  animation: sat-dot-pulse 2.5s ease-in-out infinite;
}
@keyframes sat-dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* ── Fields container ──────────────────────────────────────── */
.tbsj-sat-fields {
  border: 1px solid var(--sat-border);
  border-radius: var(--sat-radius);
  overflow: hidden;
}

/* ── Row ───────────────────────────────────────────────────── */
.tbsj-sat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sat-border);
  background: var(--sat-bg-row);
  transition: background 0.12s;
  position: relative;
}
.tbsj-sat-row:last-child {
  border-bottom: none;
}
.tbsj-sat-row:hover,
.tbsj-sat-row:focus-within {
  background: var(--sat-bg-row-hover);
}
/* Sats row — slightly tinted, feels like the "base unit" */
.tbsj-sat-row--sats {
  background: var(--sat-bg-sats);
}
.tbsj-sat-row--sats:hover,
.tbsj-sat-row--sats:focus-within {
  background: rgba(247, 147, 26, 0.09);
}

/* Active-row left accent bar */
.tbsj-sat-row:focus-within::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sat-orange);
  border-radius: 0 2px 2px 0;
}

/* ── Row meta (flag + name) ────────────────────────────────── */
.tbsj-sat-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: 160px;
}

/* Denomination flag / symbol */
.tbsj-sat-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--sat-border);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--sat-mono);
  color: inherit;
  opacity: 0.55;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.tbsj-sat-flag--btc {
  background: var(--sat-orange);
  border-color: var(--sat-orange);
  color: #fff;
  opacity: 1;
  font-size: 15px;
  box-shadow: 0 0 10px var(--sat-orange-glow);
}

.tbsj-sat-flag--sat {
  font-size: 14px;
  opacity: 0.75;
  border-color: var(--sat-orange-glow);
  color: var(--sat-orange);
}

.tbsj-sat-row-names {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tbsj-sat-unit-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.tbsj-sat-unit-code {
  font-size: 0.68rem;
  font-family: var(--sat-mono);
  opacity: 0.35;
  letter-spacing: 0.04em;
}

/* ── Input ─────────────────────────────────────────────────── */
.tbsj-sat-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sat-mono);
  font-size: 1.15rem;
  font-weight: 600;
  text-align: right;
  color: inherit;
  padding: 0;
  /* Remove browser spinners */
  -moz-appearance: textfield;
  appearance: textfield;
}
.tbsj-sat-input::-webkit-inner-spin-button,
.tbsj-sat-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tbsj-sat-input::placeholder {
  opacity: 0.18;
  font-weight: 400;
}
.tbsj-sat-input:focus {
  color: var(--sat-orange);
}

/* Flash animation on cascade update */
.tbsj-sat-input.tbsj-sat-updated {
  animation: sat-val-flash 0.28s ease both;
}
@keyframes sat-val-flash {
  0%   { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ── Footer ────────────────────────────────────────────────── */
.tbsj-sat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 2px 0;
  flex-wrap: wrap;
  gap: 4px;
}

.tbsj-sat-sats-worth {
  font-family: var(--sat-mono);
  font-size: 0.78rem;
  color: var(--sat-orange);
  opacity: 0.75;
  min-height: 1.2em;
}

.tbsj-sat-powered {
  font-size: 0.68rem;
  opacity: 0.28;
  letter-spacing: 0.06em;
}

/* ── Quick presets ─────────────────────────────────────────── */
.tbsj-sat-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 14px;
}

.tbsj-sat-presets-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.35;
  font-weight: 600;
  margin-right: 2px;
}

.tbsj-sat-preset {
  font-family: var(--sat-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--sat-border);
  background: transparent;
  cursor: pointer;
  line-height: 1.5;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
  color: inherit;
  opacity: 0.65;
}
.tbsj-sat-preset:hover {
  border-color: var(--sat-orange);
  color: var(--sat-orange);
  background: var(--sat-orange-dim);
  opacity: 1;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 420px) {
  .tbsj-sat-row-meta { width: 130px; }
  .tbsj-sat-flag     { width: 28px; height: 28px; }
  .tbsj-sat-input    { font-size: 1rem; }
  .tbsj-sat-unit-name { font-size: 0.78rem; }
}
