/* Archivo: css/inicio/configuraciones.css */

/* === LAYOUT === */
.cfg-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 0 24px;
}

/* === CARD BASE === */
.cfg-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.cfg-card-header {
  padding: 18px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 10px;
}

.cfg-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.cfg-card-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

/* === FILTRO TIPO === */
.cfg-filter-bar {
  display: flex;
  gap: 6px;
}

.cfg-filter-btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}

.cfg-filter-btn:hover { border-color: #cbd5e1; }
.cfg-filter-btn.active { border-color: #0ea5e9; background: #f0f9ff; color: #0284c7; }

/* === TABLA === */
.cfg-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cfg-table-head {
  display: grid;
  grid-template-columns: 220px 120px 1fr 100px;
  padding: 10px 24px;
  background: #f8fafc;
  border-bottom: 1.5px solid #f1f5f9;
  min-width: 600px;
}

.cfg-table-head span {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cfg-table-body {
  overflow-y: auto;
  max-height: 420px;
}

.cfg-table-body::-webkit-scrollbar { width: 4px; }
.cfg-table-body::-webkit-scrollbar-track { background: #f8fafc; }
.cfg-table-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Fila */
.cfg-row {
  display: grid;
  grid-template-columns: 220px 120px 1fr 100px;
  padding: 14px 24px;
  border-bottom: 1px solid #f8fafc;
  align-items: center;
  transition: background 0.15s;
  min-width: 600px;
}

.cfg-row:last-child { border-bottom: none; }
.cfg-row:hover { background: #fafafa; }

/* Nombre tarea */
.cfg-cell-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cfg-task-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e293b;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Badge tipo */
.cfg-tipo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.71rem;
  font-weight: 700;
}

.cfg-tipo-badge.tarea        { background: #eff6ff; color: #2563eb; }
.cfg-tipo-badge.notificacion { background: #f5f3ff; color: #7c3aed; }

/* Usuarios asignados */
.cfg-usuarios-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cfg-usr-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  border-radius: 99px;
  padding: 3px 10px 3px 4px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #334155;
}

.cfg-usr-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.cfg-usr-chip-initials {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cfg-no-users {
  font-size: 0.76rem;
  color: #94a3b8;
  font-style: italic;
}

/* Acciones */
.cfg-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.cfg-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cfg-action-btn span { font-size: 15px; }
.cfg-btn-edit   { background: #f0f9ff; color: #0ea5e9; }
.cfg-btn-edit:hover   { background: #e0f2fe; }

/* Empty */
.cfg-empty {
  padding: 52px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cfg-empty span.material-symbols-outlined { font-size: 38px; color: #cbd5e1; }

/* === MODAL EDITAR USUARIOS === */
.cfg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.cfg-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.cfg-modal-box {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.14);
  width: 100%;
  max-width: 460px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s ease, opacity 0.22s ease;
  opacity: 0;
}

.cfg-modal-overlay.active .cfg-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cfg-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cfg-modal-titles { flex: 1; }

.cfg-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cfg-modal-title span.material-symbols-outlined { font-size: 20px; color: #0ea5e9; }

.cfg-modal-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
}

.cfg-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.cfg-modal-close:hover { background: #e2e8f0; }
.cfg-modal-close span  { font-size: 18px; }

.cfg-modal-divider {
  height: 1px;
  background: #f1f5f9;
  margin: -6px 0;
}

/* Lista de usuarios en el modal */
.cfg-modal-section-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.cfg-usr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.cfg-usr-list::-webkit-scrollbar { width: 4px; }
.cfg-usr-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

.cfg-usr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cfg-usr-item:hover { background: #f8fafc; border-color: #e2e8f0; }

.cfg-usr-item.selected {
  background: #f0f9ff;
  border-color: #0ea5e9;
}

.cfg-usr-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.cfg-usr-item-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cfg-usr-item-info { flex: 1; }

.cfg-usr-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.cfg-usr-item-rango {
  font-size: 0.72rem;
  color: #94a3b8;
}

.cfg-usr-item-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.cfg-usr-item.selected .cfg-usr-item-check {
  background: #0ea5e9;
  border-color: #0ea5e9;
}

.cfg-usr-item-check span { font-size: 13px; color: #ffffff; display: none; }
.cfg-usr-item.selected .cfg-usr-item-check span { display: flex; }

/* Footer modal */
.cfg-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.cfg-modal-btn {
  padding: 9px 20px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.cfg-modal-btn-cancel { background: #f1f5f9; color: #64748b; }
.cfg-modal-btn-cancel:hover { background: #e2e8f0; }
.cfg-modal-btn-save {
  background: #0ea5e9;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cfg-modal-btn-save:hover { background: #0284c7; }
.cfg-modal-btn-save span { font-size: 16px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .cfg-card-header { padding: 14px 16px 12px; }

  .cfg-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    -webkit-overflow-scrolling: touch;
  }

  .cfg-table-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
  .cfg-table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

  .cfg-table-head,
  .cfg-row {
    min-width: 600px;
  }

  .cfg-table-body {
    max-height: none;
    overflow: visible;
  }
}

/* ============================================================
   === SECCIÓN: MENSAJES DE SERVICIOS ===
   ============================================================ */

.cfg-msg-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.cfg-msg-card-header {
  padding: 18px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 10px;
}

.cfg-msg-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.cfg-msg-card-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

/* Grid de servicios */
.cfg-msg-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 20px 24px;
}

/* Card de cada servicio */
.cfg-svc-card {
  border-radius: 14px;
  border: 1.5px solid #f1f5f9;
  background: #fafafa;
  overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s;
}

.cfg-svc-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-color: #e2e8f0;
}

.cfg-svc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}

.cfg-svc-emoji {
  font-size: 1.4rem;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cfg-svc-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.cfg-svc-status-wrap {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

/* Dots de estado por tipo de mensaje */
.cfg-svc-dots {
  display: flex;
  gap: 4px;
}

.cfg-svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cfg-svc-dot.has-msg  { background: #22c55e; }
.cfg-svc-dot.no-msg   { background: #e2e8f0; }

.cfg-svc-dot-label {
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}

/* Botones de tipo de mensaje */
.cfg-svc-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid #f1f5f9;
}

.cfg-svc-btn {
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  color: #64748b;
}

.cfg-svc-btn:first-child {
  border-right: 1px solid #f1f5f9;
}

.cfg-svc-btn:hover { background: #f1f5f9; color: #1e293b; }

.cfg-svc-btn.has-msg { color: #0ea5e9; }
.cfg-svc-btn.has-msg:hover { background: #f0f9ff; }

.cfg-svc-btn span.material-symbols-outlined { font-size: 14px; }

/* === MODAL EDITOR DE MENSAJES === */
.cfg-msg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.cfg-msg-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.cfg-msg-modal-box {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s ease, opacity 0.22s ease;
  opacity: 0;
  overflow: hidden;
}

.cfg-msg-modal-overlay.active .cfg-msg-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cfg-msg-modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1.5px solid #f1f5f9;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.cfg-msg-modal-titles { flex: 1; }

.cfg-msg-modal-service {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cfg-msg-modal-type {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cfg-msg-modal-type.venta      { background: #f0f9ff; color: #0284c7; }
.cfg-msg-modal-type.renovacion { background: #f0fdf4; color: #16a34a; }

.cfg-msg-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.cfg-msg-modal-close:hover { background: #e2e8f0; }
.cfg-msg-modal-close span  { font-size: 18px; }

/* Área editable */
.cfg-msg-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfg-msg-hint {
  font-size: 0.76rem;
  color: #94a3b8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cfg-msg-hint span { font-size: 14px; }

.cfg-msg-textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.87rem;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.cfg-msg-textarea:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background: #ffffff;
}

.cfg-msg-char-count {
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: right;
  font-weight: 500;
}

/* Footer */
.cfg-msg-modal-footer {
  padding: 14px 24px 18px;
  border-top: 1.5px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.cfg-msg-clear-btn {
  padding: 8px 14px;
  border-radius: 9px;
  border: 1.5px solid #fee2e2;
  background: #fef2f2;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cfg-msg-clear-btn:hover { background: #fee2e2; }
.cfg-msg-clear-btn span  { font-size: 15px; }

.cfg-msg-modal-actions {
  display: flex;
  gap: 8px;
}

.cfg-msg-modal-btn {
  padding: 9px 20px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.cfg-msg-btn-cancel { background: #f1f5f9; color: #64748b; }
.cfg-msg-btn-cancel:hover { background: #e2e8f0; }
.cfg-msg-btn-save {
  background: #0ea5e9; color: #ffffff;
  display: flex; align-items: center; gap: 6px;
}
.cfg-msg-btn-save:hover { background: #0284c7; }
.cfg-msg-btn-save span  { font-size: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .cfg-msg-services-grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 12px;
  }

  .cfg-msg-modal-box { max-height: 95vh; }
}