/* ================================================== */
/* 🎨 SISTEMA DE TABLAS ESTILO FRAPPE MINIMALISTA    */
/* ================================================== */

.modern-table-container {
  background: #ffffff;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  border: none;
  padding-left: 8px;
  padding-right: 8px;
  margin-top: 6px;
}

.modern-table {
  margin: 0;
  border: none;
  font-size: 0.813rem;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100%;
}

/* Header con fondo gris y línea inferior como Frappe */
.modern-table thead {
  background: transparent !important;
  border-bottom: 0 !important;
}

.modern-table thead tr {
  /* evita huecos entre celdas y mantiene el “pill” continuo */
}

.modern-table thead th {
  background: var(--bg-sidebar, #f8f8f8) !important;  /* Cambiado de #e9ecef a --bg-sidebar */
  color: #5f6b76 !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  padding: 0.4375rem 0.5rem !important;
  border: 0 !important;
  /* border-bottom: 1px solid #d7dde3 !important; */ /* COMENTADO - quitar línea */
}

/* Bordes redondeados de la “pastilla” de la cabecera */
.modern-table thead th:first-child {
  border-top-left-radius: 6px !important;
  border-bottom-left-radius: 6px !important;
  padding-left: 0.5rem !important;
}
.modern-table thead th:last-child {
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
  padding-right: 0.5rem !important;
}

/* ===== HOVER más marcado estilo Frappe ===== */

/* Eliminar el hover actual para reemplazarlo */
.modern-table tbody tr:hover {
  background-color: transparent !important;
}

/* Nuevo hover: resalta toda la fila con un gris más visible */
.modern-table tbody tr {
  transition: background-color 0.1s ease;
  cursor: pointer;
  position: relative;
}

.modern-table tbody tr:hover td {
  background-color: var(--bg-sidebar, #f8f8f8) !important; /* Mismo color que sidebar/cabecera */
}

/* Bordes redondeados en el hover (primera y última celda) */
.modern-table tbody tr:hover td:first-child {
  border-top-left-radius: 6px !important;
  border-bottom-left-radius: 6px !important;
}

.modern-table tbody tr:hover td:last-child {
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
}

/* Si tienes fila seleccionada con checkbox, diferente color */
.modern-table tbody tr:has(input[type="checkbox"]:checked) td {
  background-color: #e8f4fd !important; /* Azul muy claro para seleccionadas */
}

/* Bordes redondeados para filas seleccionadas */
.modern-table tbody tr:has(input[type="checkbox"]:checked) td:first-child {
  border-top-left-radius: 6px !important;
  border-bottom-left-radius: 6px !important;
}

.modern-table tbody tr:has(input[type="checkbox"]:checked) td:last-child {
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
}

/* Hover sobre fila seleccionada */
.modern-table tbody tr:has(input[type="checkbox"]:checked):hover td {
  background-color: #ddeeff !important; /* Azul claro más oscuro al hover */
}

/* Celdas: aún más compactas para reducir márgenes verticales */
.modern-table tbody td {
  padding: 0.5rem 0.5rem !important;      /* 8px 8px */
  font-size: 0.813rem;
  border: none !important;  /* Añadir esta línea */
  border-bottom: none !important;  /* Añadir esta línea */
  border-top: none !important;  /* Añadir esta línea */
}

/* Primera/última columna sin sangrías extra */
.modern-table tbody td:first-child { padding-left: 0.5rem !important; }
.modern-table tbody td:last-child  { padding-right: 0.5rem !important; }

/* ================================================== */
/* 🎨 CHECKBOX ESTILO FRAPPE                          */
/* ================================================== */

.table-checkbox {
  width: 14px;
  height: 14px;
  border: 1px solid #cbd5e0;
  border-radius: 2px;
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

.table-checkbox:checked {
  background-color: #5e64ff;
  border-color: #5e64ff;
}

/* ================================================== */
/* 🎨 AVATARES ESTILO FRAPPE                         */
/* ================================================== */

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.75rem;
  margin-right: 0.625rem;
  border: none;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Colores por inicial */
.user-avatar.avatar-a { 
  background: #fce4ec; 
  color: #c2185b; 
}
.user-avatar.avatar-m { 
  background: #e8eaf6; 
  color: #5e35b1; 
}
.user-avatar.avatar-d { 
  background: #e0f2f1; 
  color: #00897b; 
}
/* Fallback para otras letras */
.user-avatar {
  background: #f0f0f0;
  color: #666;
}

/* ================================================== */
/* 🎨 INFO DE USUARIO                                */
/* ================================================== */

.user-info {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.user-details {
  display: inline-block;
  vertical-align: middle;
}

.user-details h6 {
  margin: 0;
  font-weight: 400;
  color: #212a31;
  font-size: 0.813rem;
  line-height: 1.2;
}

.user-details p {
  margin: 0.125rem 0 0 0;
  color: #6c7680;
  font-size: 0.75rem;
  line-height: 1.2;
}

/* ================================================== */
/* 🎨 TEXTO SIMPLE (SIN BADGES DE COLORES)           */
/* ================================================== */

/* Para el campo ROL y EMAIL - texto simple sin colores */
.text-muted {
  color: #6c7680;
  font-weight: 400;
  font-size: 0.813rem;
}

/* ================================================== */
/* 🎨 STATUS INDICATORS - ESTILO FRAPPE LIMPIO       */
/* ================================================== */

.status-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;  /* Reducido - más compacto */
  border-radius: 3px;         /* Menos redondeado */
  font-size: 0.688rem;        /* Más pequeño - 11px */
  font-weight: 400;           /* Normal, no bold */
  text-transform: none;
  letter-spacing: normal;
  border: none;
  vertical-align: middle;
  gap: 0.25rem;               /* Menos espacio entre punto y texto */
  line-height: 1.4;           /* Altura de línea ajustada */
}

/* Estado Activo - Verde más suave */
.status-indicator--active {
  background: #d4edda;        /* Verde aún más claro */
  color: #155724;             /* Verde oscuro */
}

/* Estado Inactivo - Gris más suave */
.status-indicator--inactive {
  background: #f8f9fa;        /* Gris muy claro */
  color: #6c757d;             /* Gris texto */
}

/* Estado Pendiente - Amarillo */
.status-indicator--pending {
  background: #fff3cd;        /* Amarillo claro */
  color: #856404;             /* Amarillo oscuro */
}

/* ================================================== */
/* 🎨 BARRA DE FILTROS                               */
/* ================================================== */

.table-filter-bar {
  padding: 0.4rem 0.4rem;     /* 8px */
  border-bottom: 1px solid #e3e7eb;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-toggle-btn {
  background: transparent;
  border: none;
  color: #6c757d;
  font-size: 0.813rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: 3px;
  transition: all 0.1s ease;
}

.filter-toggle-btn:hover {
  background: #e9ecef;
}

.filter-toggle-btn i {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.filter-toggle-btn.active i {
  transform: rotate(180deg);
}

/* ================================================== */
/* 🎨 ÁREA DE ESTADÍSTICAS                           */
/* ================================================== */

.table-stats {
  padding: 0.75rem 0.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  gap: 2rem;
  align-items: baseline;
}

.stat-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: #212529;
}

.stat-label {
  font-size: 0.813rem;
  color: #6c757d;
}

/* ================================================== */
/* 🎨 PAGINACIÓN                                     */
/* ================================================== */

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.5rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.table-pagination-info {
  font-size: 0.813rem;
  color: #6c757d;
}

.table-pagination-controls {
  display: flex;
  gap: 0.125rem;
}

.table-pagination-btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 3px;
  font-size: 0.813rem;
  cursor: pointer;
  transition: all 0.1s ease;
  color: #495057;
  min-width: 28px;
  text-align: center;
  line-height: 1.5;
}

.table-pagination-btn:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #adb5bd;
}

.table-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8f9fa;
}

.table-pagination-btn.active {
  background: #5e64ff;
  color: white;
  border-color: #5e64ff;
}

/* ================================================== */
/* 🎨 EMPTY STATE                                    */
/* ================================================== */

.table-empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: #98a6ad;
}

.table-empty-state i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
  color: #dee2e6;
}

.table-empty-state h6 {
  margin-bottom: 0.375rem;
  color: #495057;
  font-weight: 400;
  font-size: 0.938rem;
}

.table-empty-state p {
  margin: 0;
  font-size: 0.813rem;
  color: #98a6ad;
}

/* ================================================== */
/* 🎨 HEADER DE PÁGINA                               */
/* ================================================== */

.page-header-frappe {
  padding: 0.75rem 0.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
}

.page-title-frappe {
  font-size: 1rem;
  font-weight: 500;
  color: #212529;
  margin: 0;
}

.page-breadcrumb-frappe {
  font-size: 0.75rem;
  color: #98a6ad;
  margin-top: 0.125rem;
}

/* ================================================== */
/* 🎨 BOTÓN CREAR                                    */
/* ================================================== */

.btn-create-frappe {
  background: #5e64ff;
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 3px;
  font-size: 0.813rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.1s ease;
  cursor: pointer;
}

.btn-create-frappe:hover {
  background: #4b51e6;
}

.btn-create-frappe i {
  font-size: 0.75rem;
}

/* ================================================== */
/* 🎨 RESPONSIVE                                     */
/* ================================================== */

@media (max-width: 768px) {
  .modern-table thead th,
  .modern-table tbody td {
    padding: 0.5rem 0.375rem;
    font-size: 0.75rem;
  }
  
  .action-buttons {
    opacity: 1;
  }
  
  .table-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width: 576px) {
  .modern-table thead th,
  .modern-table tbody td {
    padding: 0.375rem 0.25rem;
    font-size: 0.75rem;
  }
  
  .user-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.688rem;
  }
  
  .status-indicator {
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
  }
}