/* ============================
   Alerts tab
   ============================ */

.alerts-empty {
  background: var(--color-surface);
  border: 1px dashed var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--color-muted);
}
.alerts-empty p { margin: 4px 0; }
.alerts-empty .sub { font-size: 12px; color: var(--color-faint); }

/* Modal — reusable */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-md);
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-header,
.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}
.modal-header { border-bottom: 1px solid var(--color-hairline); justify-content: space-between; }
.modal-footer { border-top: 1px solid var(--color-hairline); justify-content: flex-end; }
.modal-header h4 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
}
.modal-body {
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.form-row > span,
.form-row > label > span {
  font-size: 12px;
  color: var(--color-muted);
}
.form-row input,
.form-row select {
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--color-surface);
}
.form-row-double {
  flex-direction: row;
  gap: var(--spacing-md);
}
.form-row-double > label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-row-double > label > input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sub.pos { color: var(--color-pos); }
.sub.neg { color: var(--color-neg); }

/* Alert rule card list */
#alerts-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}
.alert-card {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}
.alert-card.paused { opacity: 0.55; }
.alert-card-main { flex: 1; min-width: 0; }
.alert-card-title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.alert-card-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--color-muted);
}
.alert-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-faint);
  display: inline-block;
}
.alert-dot.active { background: var(--color-pos); }
.alert-kind {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--color-surface-soft);
  border-radius: 999px;
  color: var(--color-muted);
  font-weight: 500;
}

.hidden { display: none !important; }

/* Search dropdown (alert target picker) */
.search-input-wrap { position: relative; }
/* Modal body 의 overflow 가 dropdown 을 자르지 않도록 모달 본문은 visible 우선 — 거래 모달 외 영향 없음 */
#alert-rule-modal .modal-body { overflow: visible; }
#alert-target-dropdown.search-dropdown {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 2px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.search-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-hairline-soft);
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover, .search-item.highlight { background: var(--color-surface-soft); }
.search-item-meta {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 2px;
}
.search-empty {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
}
