/**
 * TEKAN ADS — Blacklist page
 */

.bl-page {
  --bl-accent: var(--ds-color-danger);
}

.bl-root {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  width: 100%;
  max-width: none;
  margin: 0;
  padding-bottom: var(--ds-space-3);
}

/* ─── Header ─── */
.bl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
}

.bl-header h1 {
  margin: 0;
  font-size: var(--ds-text-h1-size);
  font-weight: var(--ds-text-h1-weight);
  color: var(--ds-color-text);
}

.bl-header__sub {
  margin: 0.35rem 0 0;
  font-size: var(--ds-text-body-size);
  color: var(--ds-color-text-muted);
  max-width: 42rem;
  line-height: 1.55;
}

.bl-header__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: var(--ds-radius-full);
  background: var(--ds-color-danger-muted);
  color: var(--ds-color-danger);
  border: 1px solid var(--ds-color-danger-border);
  font-size: var(--ds-text-caption-size);
  white-space: nowrap;
  box-shadow: var(--ds-shadow-sm);
}

.bl-header__badge strong {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ─── Stats ─── */
.bl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--ds-space-1);
}

.bl-stats .ds-stat-card {
  box-shadow: var(--ds-shadow-sm);
  transition: transform var(--ds-transition-fast), box-shadow var(--ds-transition-fast);
}

.bl-stats .ds-stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--ds-shadow-md);
}

/* ─── Quick actions ─── */
.bl-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-1);
}

/* ─── Filters ─── */
.bl-filter-bar {
  padding: 1rem 1.25rem;
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-card);
  background: var(--ds-color-surface);
  box-shadow: var(--ds-shadow-sm);
}

.bl-filter-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-1);
  align-items: flex-end;
}

.bl-filter-bar__search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  height: 2.5rem;
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-input);
  background: var(--ds-color-bg-subtle);
  transition: border-color var(--ds-transition-fast), box-shadow var(--ds-transition-fast);
}

.bl-filter-bar__search:focus-within {
  border-color: var(--ds-color-primary);
  box-shadow: 0 0 0 3px var(--ds-color-primary-muted);
}

.bl-filter-bar__search .ds-input {
  border: none;
  background: transparent;
  padding: 0;
  height: 100%;
  box-shadow: none;
}

.bl-filter-field {
  min-width: 120px;
  flex: 0 1 140px;
}

.bl-filter-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-inline-start: auto;
}

.bl-filter-mobile-toggle {
  display: none;
}

/* ─── Bulk bar ─── */
.bl-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-1);
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-radius: var(--ds-radius-card);
  background: var(--ds-color-primary-muted);
  border: 1px solid var(--ds-color-primary-border, var(--ds-color-border));
  animation: bl-slide-in 200ms ease;
}

@keyframes bl-slide-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bl-bulk-bar__count {
  font-size: var(--ds-text-caption-size);
  font-weight: 560;
  color: var(--ds-color-text-secondary);
}

.bl-bulk-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ─── Table shell ─── */
.bl-table-shell {
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-card);
  background: var(--ds-color-surface);
  box-shadow: var(--ds-shadow-sm);
  overflow: hidden;
}

.bl-table-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.bl-table tbody tr.bl-row td {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.bl-table tbody tr.bl-row td:first-child {
  border-radius: 0 var(--ds-radius-input) var(--ds-radius-input) 0;
}

.bl-table tbody tr.bl-row td:last-child {
  border-radius: var(--ds-radius-input) 0 0 var(--ds-radius-input);
}

[dir="rtl"] .bl-table tbody tr.bl-row td:first-child {
  border-radius: var(--ds-radius-input) 0 0 var(--ds-radius-input);
}

[dir="rtl"] .bl-table tbody tr.bl-row td:last-child {
  border-radius: 0 var(--ds-radius-input) var(--ds-radius-input) 0;
}

.bl-table tbody tr.bl-row {
  transition: background var(--ds-transition-fast), box-shadow var(--ds-transition-fast);
}

.bl-table tbody tr.bl-row:hover {
  background: var(--ds-color-hover);
}

.bl-table tbody tr.bl-row.is-selected {
  background: var(--ds-color-primary-muted);
}

.bl-table__check {
  width: 2.5rem;
  text-align: center;
}

.bl-table__check input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.bl-cell-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bl-cell-main__title {
  font-weight: 560;
  color: var(--ds-color-text);
}

.bl-cell-main__sub {
  font-size: var(--ds-text-caption-size);
  color: var(--ds-color-text-muted);
  line-height: 1.4;
}

.bl-row-actions {
  display: flex;
  gap: 0.15rem;
  justify-content: flex-end;
}

/* ─── Badges ─── */
.bl-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--ds-radius-full);
  font-size: var(--ds-text-badge-size);
  font-weight: var(--ds-text-badge-weight);
  white-space: nowrap;
}

.bl-type-badge--phone {
  background: transparent;
  color: var(--ds-color-text-secondary);
  border: 1px solid var(--ds-color-border-strong);
}

.bl-type-badge--customer {
  background: var(--ds-color-danger-muted);
  color: var(--ds-color-danger);
  border: 1px solid var(--ds-color-danger-border);
}

.bl-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--ds-radius-full);
  font-size: var(--ds-text-badge-size);
  font-weight: var(--ds-text-badge-weight);
  white-space: nowrap;
}

.bl-source-badge--manual {
  background: var(--ds-color-danger-muted);
  color: var(--ds-color-danger);
  border: 1px solid var(--ds-color-danger-border);
}

.bl-source-badge--auto {
  background: var(--ds-color-warning-muted);
  color: var(--ds-color-warning);
  border: 1px solid var(--ds-color-warning-border);
}

.bl-reason-badge {
  display: inline-flex;
  align-items: center;
  max-width: 12rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--ds-radius-full);
  font-size: var(--ds-text-badge-size);
  font-weight: 500;
  background: var(--ds-color-bg-subtle);
  color: var(--ds-color-text-secondary);
  border: 1px solid var(--ds-color-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bl-reason-badge--auto {
  background: var(--ds-color-warning-muted);
  color: var(--ds-color-warning);
  border-color: var(--ds-color-warning-border);
}

.bl-reason-badge--empty {
  color: var(--ds-color-text-muted);
  font-style: italic;
}

/* ─── Footer / pagination ─── */
.bl-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-1);
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--ds-color-divider);
  background: var(--ds-color-bg-subtle);
}

.bl-table-footer__meta {
  font-size: var(--ds-text-caption-size);
  color: var(--ds-color-text-muted);
}

.bl-pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Empty state ─── */
.bl-empty__icon {
  width: 4rem !important;
  height: 4rem !important;
  border-radius: 50%;
  background: var(--ds-color-danger-muted);
  color: var(--ds-color-danger);
}

/* ─── Modals ─── */
.bl-modal-hint {
  margin: 0 0 var(--ds-space-2);
  font-size: var(--ds-text-caption-size);
  color: var(--ds-color-text-muted);
  line-height: 1.55;
}

.bl-preview {
  margin-top: var(--ds-space-1);
  padding: 0.85rem 1rem;
  border-radius: var(--ds-radius-input);
  background: var(--ds-color-bg-subtle);
  border: 1px solid var(--ds-color-border);
  font-size: var(--ds-text-caption-size);
  line-height: 1.65;
}

.bl-cust-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: var(--ds-space-2);
}

.bl-cust-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-input);
  background: var(--ds-color-bg-subtle);
  cursor: pointer;
  text-align: right;
  transition: border-color var(--ds-transition-fast), background var(--ds-transition-fast);
}

.bl-cust-pick:hover {
  border-color: var(--ds-color-primary);
  background: var(--ds-color-hover);
}

.bl-cust-pick.is-selected {
  border-color: var(--ds-color-danger);
  background: var(--ds-color-danger-muted);
}

.bl-cust-pick__name {
  font-weight: 560;
  color: var(--ds-color-text);
}

.bl-cust-pick__sub {
  font-size: var(--ds-text-caption-size);
  color: var(--ds-color-text-muted);
}

/* ─── Filter drawer (mobile) ─── */
.bl-filter-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--ds-z-modal) - 1);
  background: var(--ds-color-overlay);
}

.bl-filter-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: var(--ds-z-modal);
  width: min(100vw, 22rem);
  background: var(--ds-color-card);
  border-inline-start: 1px solid var(--ds-color-border);
  box-shadow: var(--ds-shadow-xl);
  display: flex;
  flex-direction: column;
  animation: bl-drawer-in 220ms ease;
}

@keyframes bl-drawer-in {
  from { transform: translateX(100%); opacity: 0.8; }
  to { transform: translateX(0); opacity: 1; }
}

[dir="rtl"] .bl-filter-drawer {
  animation-name: bl-drawer-in-rtl;
}

@keyframes bl-drawer-in-rtl {
  from { transform: translateX(-100%); opacity: 0.8; }
  to { transform: translateX(0); opacity: 1; }
}

.bl-filter-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ds-space-2);
  border-bottom: 1px solid var(--ds-color-divider);
}

.bl-filter-drawer__head h2 {
  margin: 0;
  font-size: var(--ds-text-h3-size);
}

.bl-filter-drawer__body {
  padding: var(--ds-space-2);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  overflow-y: auto;
}

.bl-filter-drawer__body .ds-field {
  width: 100%;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .bl-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .bl-filter-field,
  .bl-filter-bar__search + .ds-field {
    display: none;
  }

  .bl-filter-mobile-toggle {
    display: inline-flex;
  }

  .bl-filter-bar__search {
    flex: 1 1 100%;
  }
}

@media (max-width: 640px) {
  .bl-stats {
    grid-template-columns: 1fr;
  }

  .bl-quick-actions {
    flex-direction: column;
  }

  .bl-quick-actions .ds-btn {
    width: 100%;
  }

  .bl-header__badge {
    width: 100%;
    justify-content: center;
  }

  .bl-table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .bl-pagination {
    justify-content: space-between;
  }

  .bl-row-actions .ds-btn span {
    display: none;
  }
}
