/* ============================================
   DATA BALANCE ALERTS
   Relies on tokens in css/variables.css
   ============================================ */

.data-alerts-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-base);
  padding-bottom: 80px;
}

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

.data-alerts-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;
}
.data-alerts-topbar__back svg { width: 16px; height: 16px; }

.data-alerts-topbar h1 {
  font-size: var(--text-md);
  font-weight: var(--font-semi);
  color: var(--text-primary);
  flex: 1;
}

.data-alerts-content {
  padding: var(--space-md) 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ---------- Balance cards ---------- */
.balance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balance-card.is-low {
  border-color: var(--danger);
}

.balance-card__network {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-card__value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--font-semi);
  color: var(--text-primary);
}

.balance-card.is-low .balance-card__value { color: var(--danger); }

.balance-card__updated {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Settings card ---------- */
.alert-settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.alert-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.alert-settings-row__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.alert-settings-row__sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.toggle-switch__track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: transform 0.15s, background 0.15s;
}

.toggle-switch input:checked + .toggle-switch__track {
  background: rgba(22, 163, 74, 0.15);
  border-color: var(--success);
}

.toggle-switch input:checked + .toggle-switch__track::before {
  transform: translateX(18px);
  background: var(--success);
}

/* Threshold slider */
.threshold-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.threshold-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--font-semi);
  color: var(--text-primary);
  text-align: center;
}

.threshold-slider {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  outline: none;
}

.threshold-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  cursor: pointer;
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border-soft);
}

.threshold-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  cursor: pointer;
  border: 3px solid var(--bg-card);
}

.threshold-marks {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Companion app card ---------- */
.companion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.companion-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.companion-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--info);
}
.companion-card__icon svg { width: 18px; height: 18px; }

.companion-card__title {
  font-size: var(--text-base);
  font-weight: var(--font-semi);
  color: var(--text-primary);
}

.companion-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.companion-status.is-connected {
  color: var(--success);
}
.companion-status.is-connected::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--success);
}

.companion-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.companion-step {
  display: flex;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.companion-step__num {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semi);
  color: var(--text-primary);
  flex-shrink: 0;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .data-alerts-page {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
  }
}
