/**
 * Notificaciones push: pestañas, panel Enviar, dispositivos.
 * Complementa admin.css en notificaciones.html.
 */

.notif-intro {
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.notif-intro-lead {
  font-size: 0.9375rem;
  color: #334155;
  margin: 0 0 0.75rem 0;
  line-height: 1.45;
}
.notif-intro-steps {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.6;
}
.notif-intro-steps li { margin-bottom: 0.25rem; }
.notif-intro-steps strong { color: #0f172a; }

/* Tabs y paneles */
.notif-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.notif-tabs button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--admin-border);
  background: var(--admin-card);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}
.notif-tabs button:hover {
  color: #334155;
  border-color: #cbd5e1;
}
.notif-tabs button.active {
  background: var(--admin-accent);
  color: #fff;
  border-color: var(--admin-accent);
}
.notif-panel {
  display: none;
}
.notif-panel.active {
  display: block;
}
.notif-panel .panel-desc {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1rem;
}

/* --- Enviar: bloques separados y ordenados --- */
.send-block {
  margin-bottom: 2rem;
}
.send-block:last-child {
  margin-bottom: 0;
}

.send-block-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.send-block-title i {
  color: var(--admin-accent);
  font-size: 1rem;
}

.send-block-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.send-form-row {
  margin-bottom: 1rem;
}
.send-form-row:last-of-type {
  margin-bottom: 0;
}

.send-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.4rem;
}

.send-input {
  width: 100%;
  max-width: 360px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: #0f172a;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
}
/* Misma causa que en modales: <select> con poco padding vertical recorta el texto */
select.send-input {
  min-height: 2.5rem;
  line-height: 1.5;
  box-sizing: border-box;
  cursor: pointer;
}
.send-input:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}
.send-input-sm {
  max-width: 160px;
}

.send-form-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.send-form-actions .btn-primary {
  margin: 0;
}
.send-feedback {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  min-height: 1.25rem;
}

/* Dispositivos: cabecera y tabla */
.send-block-devices {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--admin-border);
}

.send-devices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.send-devices-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.send-block-card.send-table-wrap {
  padding: 0;
  overflow-x: auto;
  border-radius: 12px 12px 0 0;
}
.send-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.send-table th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  color: #64748b;
  font-weight: 500;
  border-bottom: 1px solid var(--admin-border);
}
.send-table td {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  color: #334155;
}
.send-table tbody tr:hover td {
  background: #f8fafc;
}
.send-table .empty-state {
  padding: 2rem;
  text-align: center;
  color: #64748b;
}

.send-pagination {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--admin-card);
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--admin-border);
  border-top: none;
}

/* Vista unificada campañas */
.notif-page-lead {
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}
.notif-campaigns-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.notif-section-heading {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}
.notif-campaigns-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.notif-campaigns-card {
  padding: 0;
  overflow: hidden;
}
.notif-campaigns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.notif-campaigns-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}
.notif-campaigns-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: top;
  color: #334155;
}
.notif-campaigns-table tbody tr:hover td {
  background: #f8fafc;
}
.notif-campaigns-table .empty-state {
  padding: 2rem;
  text-align: center;
}
.notif-th-actions {
  width: 7rem;
  text-align: right;
}
.notif-td-actions {
  text-align: right;
  white-space: nowrap;
}
.notif-td-msg {
  max-width: 14rem;
}
.notif-metrics-cell {
  line-height: 1.35;
  min-width: 8rem;
}
.notif-dialog-wide .admin-modal-inner {
  max-width: min(960px, 96vw);
}

/* Modales anchos: el <dialog> tenía max-width ~480px en admin.css y forzaba scroll horizontal feo */
dialog.admin-modal.templates-manager-dialog,
dialog.admin-modal.notif-dialog-wide {
  max-width: min(880px, calc(100vw - 2rem));
  width: 100%;
  margin: auto;
}
.templates-manager-inner {
  padding: 1.5rem 1.75rem 1.25rem;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.templates-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}
.templates-manager-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.35rem 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
  border: none;
  padding: 0;
}
.templates-manager-sub {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}
.templates-manager-close {
  flex-shrink: 0;
  border-radius: 8px;
}
.templates-manager-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.templates-manager-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
}
.templates-manager-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.templates-manager-search {
  min-width: min(220px, 100%);
  width: 260px;
  max-width: 100%;
}

/* Un solo scroll vertical, sin barra horizontal fea; tabla adaptable */
.templates-modal-scroll {
  flex: 1;
  min-height: 0;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: #fafbfc;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}
.templates-modal-scroll::-webkit-scrollbar {
  width: 10px;
}
.templates-modal-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 0 10px 10px 0;
}
.templates-modal-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
  border: 2px solid #f1f5f9;
}
.templates-modal-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.templates-modal-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8125rem;
  background: #fff;
}
.templates-modal-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  border-bottom: 1px solid var(--admin-border);
  box-shadow: 0 1px 0 var(--admin-border);
}
.templates-modal-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
  word-break: break-word;
}
.templates-modal-table tbody tr:hover td {
  background: #f8fafc;
}
.templates-modal-table .col-name {
  width: 18%;
}
.templates-modal-table .col-title {
  width: 24%;
}
.templates-modal-table .col-body {
  width: auto;
}
.templates-modal-table .col-actions {
  width: 7.5rem;
  text-align: right;
  white-space: nowrap;
}
.templates-modal-table .cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.templates-modal-table .cell-muted {
  color: #64748b;
  font-size: 0.8rem;
}
.templates-modal-empty {
  padding: 2.5rem 1rem !important;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}
.templates-modal-err {
  color: #dc2626 !important;
}
.templates-modal-table .cell-name {
  font-weight: 500;
  color: #1e293b;
}

.notif-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
