/* =====================================================================
   Smart Alerts page styles — matches dashboard.css design language
   ===================================================================== */

/* ── Alerts layout (reuses dash-layout) ─────────────────────────────── */
.alerts-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px) 48px;
  gap: 24px;
  min-height: calc(100vh - 64px);
}

/* ── Page header ─────────────────────────────────────────────────────── */
.alerts-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.alerts-page-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy, #0f172a);
}

.alerts-page-header__sub {
  font-size: .875rem;
  color: var(--gray-500, #6b7280);
  margin-top: 2px;
}

/* ── Alert cards ──────────────────────────────────────────────────────── */
.alert-card {
  background: #fff;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: box-shadow .15s;
}

.alert-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

.alert-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.alert-card__name {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--navy, #0f172a);
  flex: 1;
}

.alert-card__badge {
  font-size: .6875rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.alert-card__badge--active {
  background: #dcfce7;
  color: #15803d;
}

.alert-card__badge--inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.alert-card__badge--pro {
  background: #ede9fe;
  color: #6d28d9;
}

.alert-card__badge--instant {
  background: #fef3c7;
  color: #92400e;
}

.alert-card__badge--daily {
  background: #dbeafe;
  color: #1e40af;
}

.alert-card__badge--digest {
  background: #f3f4f6;
  color: #374151;
}

.alert-card__criteria {
  font-size: .8125rem;
  color: var(--gray-500, #6b7280);
  margin-bottom: 10px;
}

.alert-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: .75rem;
  color: var(--gray-400, #9ca3af);
  margin-bottom: 12px;
}

.alert-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  padding-top: 12px;
  flex-wrap: wrap;
}

/* ── Toggle switch ───────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8125rem;
  color: var(--gray-600, #4b5563);
  cursor: pointer;
  user-select: none;
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 10px;
  transition: background .2s;
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--green, #16a34a);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green, #16a34a);
  color: #fff;
}

.btn-primary:hover {
  background: #15803d;
}

.btn-secondary {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-700, #374151);
  border: 1px solid var(--gray-200, #e5e7eb);
}

.btn-secondary:hover {
  background: var(--gray-200, #e5e7eb);
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-search {
  background: var(--green, #16a34a);
  color: #fff;
  font-size: .875rem;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-search:hover {
  background: #15803d;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.alerts-empty {
  text-align: center;
  padding: 40px 24px;
  background: #fff;
  border: 1px dashed var(--gray-300, #d1d5db);
  border-radius: 10px;
}

.alerts-empty__icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.alerts-empty__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy, #0f172a);
  margin-bottom: 6px;
}

.alerts-empty__sub {
  font-size: .875rem;
  color: var(--gray-500, #6b7280);
  margin-bottom: 20px;
}

/* ── Alert form modal ────────────────────────────────────────────────── */
.alert-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.alert-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.alert-modal__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-modal__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--navy, #0f172a);
}

.alert-modal__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  padding: 4px;
  line-height: 1;
}

.alert-modal__close:hover { color: var(--gray-600, #4b5563); }

.alert-modal__body {
  padding: 20px 24px;
}

.alert-form-group {
  margin-bottom: 16px;
}

.alert-form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--gray-700, #374151);
  margin-bottom: 5px;
}

.alert-form-group input[type="text"],
.alert-form-group input[type="number"],
.alert-form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 7px;
  font-size: .875rem;
  color: var(--navy, #0f172a);
  background: #fff;
}

.alert-form-group input:focus,
.alert-form-group select:focus {
  outline: none;
  border-color: var(--green, #16a34a);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.alert-form-group .hint {
  font-size: .75rem;
  color: var(--gray-400, #9ca3af);
  margin-top: 3px;
}

.alert-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.alert-form-section {
  margin-bottom: 20px;
}

.alert-form-section__title {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
}

.alert-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-chip {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--gray-200, #e5e7eb);
  background: #fff;
  color: var(--gray-600, #4b5563);
  transition: all .1s;
}

.alert-chip:hover {
  border-color: var(--green, #16a34a);
  color: var(--green-dark, #15803d);
}

.alert-chip--selected {
  background: #f0fdf4;
  border-color: var(--green, #16a34a);
  color: #15803d;
}

.alert-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Upgrade gate ────────────────────────────────────────────────────── */
.alerts-upgrade-gate {
  background: linear-gradient(135deg, #0d2340 0%, #163352 100%);
  border-radius: 10px;
  padding: 20px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.alerts-upgrade-gate__icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.alerts-upgrade-gate__text {
  flex: 1;
}

.alerts-upgrade-gate__title {
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.alerts-upgrade-gate__sub {
  font-size: .8125rem;
  color: #93c5fd;
}

/* ── Upgrade prompt (inline) ─────────────────────────────────────────── */
.alerts-upgrade-inline {
  background: #fff;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alerts-upgrade-inline__icon {
  font-size: 1.5rem;
}

.alerts-upgrade-inline__text {
  flex: 1;
}

.alerts-upgrade-inline__title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--navy, #0f172a);
}

.alerts-upgrade-inline__sub {
  font-size: .75rem;
  color: var(--gray-500, #6b7280);
}

/* ── Match history ──────────────────────────────────────────────────── */
.alert-match-list {
  margin-top: 12px;
}

.alert-match-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  font-size: .8125rem;
}

.alert-match-item:last-child { border-bottom: none; }

.alert-match-item__route {
  flex: 1;
  color: var(--gray-700, #374151);
  font-weight: 500;
}

.alert-match-item__meta {
  color: var(--gray-400, #9ca3af);
  font-size: .75rem;
}

.alert-match-item__score {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .6875rem;
  font-weight: 700;
  background: #f0fdf4;
  color: #15803d;
}

/* ── Toast notification ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy, #0f172a);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toast-in .2s ease-out;
}

.toast--success { background: #15803d; }
.toast--error { background: #b91c1c; }

@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .alerts-layout { flex-direction: column; gap: 16px; }
  .alert-form-row { grid-template-columns: 1fr; }
  .alert-modal { max-width: 100%; border-radius: 10px; }
  .alerts-upgrade-gate { flex-direction: column; text-align: center; }
  .alert-card__meta { flex-direction: column; gap: 4px; }
}