/* ============================================
   TBL Module - Estilos específicos de tablas
   ============================================ */

:root {
  --tbl-primary: #408cbc;
  --tbl-primary-dark: #2a5f7d;
  --tbl-accent: #4b7f52;
  --tbl-success: #28a745;
  --tbl-danger: #dc3545;
  --tbl-info: #10e4f4;
  --tbl-warning: #ffc107;
  --tbl-surface: #ffffff;
  --tbl-muted: #6c757d;
  --tbl-border: #d9e2ec;
}

.tbl-module .card {
  border-radius: 8px;
  border-color: var(--tbl-border);
}

.tbl-page-subtitle {
  font-size: 0.62em;
  line-height: 1.25;
}

/* Tabla Maestro - Estilos específicos del módulo TBL */
#tblCab {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: none;
}

#tblCab thead {
  background: linear-gradient(135deg, var(--tbl-primary) 0%, var(--tbl-primary-dark) 100%);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

#tblCab tbody tr {
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

#tblCab tbody tr:hover {
  background-color: rgba(64, 140, 188, 0.08);
  transform: translateX(2px);
}

#tblCab tbody tr.selected-row {
  background-color: #e3f2fd !important;
  border-left-color: var(--tbl-primary);
  box-shadow: inset 0 0 0 1px rgba(64, 140, 188, 0.2);
}

#tblCab tbody tr:focus-visible,
#tblCab tbody tr:focus-within {
  outline: 2px solid var(--tbl-primary);
  outline-offset: -2px;
}

/* Tabla Detalle - Estilos específicos */
#tblDet {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#tblDet thead {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #495057;
  font-weight: 600;
  border-bottom: 2px solid var(--tbl-primary);
}

#tblDet th,
#tblDet td {
  vertical-align: middle;
}

#tblDet tbody tr:hover {
  background-color: #f4f8fb;
}

#tblDet .tbl-col-description {
  min-width: 220px;
}

.tbl-detail-responsive {
  border: 1px solid var(--tbl-border);
  border-radius: 8px;
  background: var(--tbl-surface);
}

.tbl-detail-toolbar {
  display: flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--tbl-border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--tbl-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.tbl-detail-toolbar.is-loading {
  border-color: #b6d4fe;
  background: #eef6ff;
  color: #23527c;
}

.tbl-detail-toolbar.is-success {
  border-color: #b7dfc1;
  background: #f1fbf3;
  color: #276738;
}

.tbl-detail-toolbar.is-warning,
.tbl-detail-toolbar.is-empty {
  border-color: #ffe8a1;
  background: #fff9e6;
  color: #765c00;
}

.tbl-detail-toolbar.is-error {
  border-color: #f5c2c7;
  background: #fff1f2;
  color: #842029;
}

.tbl-actions {
  gap: 0.25rem;
}

.tbl-actions .btn {
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#btnNuevoRegistro:focus-visible,
#tblDet .btn:focus-visible,
#mdaTbl .btn:focus-visible,
#mdaTbl .form-control:focus-visible {
  outline: 2px solid var(--tbl-accent);
  outline-offset: 2px;
}

/* Dropdown de acciones - Estilo consistente con cld.php */
#tblDet .dropdown-toggle {
  background: linear-gradient(135deg, var(--tbl-primary) 0%, var(--tbl-primary-dark) 100%);
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

#tblDet .dropdown-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#tblDet .dropdown-menu {
  border: none;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 0.5rem 0;
  min-width: 180px;
  animation: dropdownFade 0.2s ease-out;
}

#tblDet .dropdown-item {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

#tblDet .dropdown-item:hover {
  background-color: #f8f9fa;
  transform: translateX(5px);
}

#tblDet .dropdown-item i {
  width: 20px;
  text-align: center;
}

/* Modal específico de Tablas */
#mdaTbl .modal-content {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  overflow: hidden;
}

#mdaTbl .modal-header {
  padding: 1.2rem 1.5rem;
  border: none;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--tbl-primary) 0%, var(--tbl-primary-dark) 100%);
  color: white;
}

#mdaTbl .modal-header .close {
  color: white;
  opacity: 0.8;
  text-shadow: none;
}

#mdaTbl .modal-header .close:hover {
  opacity: 1;
}

#mdaTbl .modal-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

#mdaTbl .modal-title {
  font-weight: 600;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

#mdaTbl .modal-body {
  padding: 1.8rem;
}

#mdaTbl .modal-footer {
  border-top: 1px solid #dee2e6;
  padding: 1rem 1.5rem;
  background-color: #f8f9fa;
}

/* Formulario - Estilos específicos */
#mdaTbl .form-group {
  margin-bottom: 1.2rem;
}

#mdaTbl label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

#mdaTbl label i {
  color: var(--tbl-primary);
}

#mdaTbl .form-control {
  border-radius: 8px;
  border: 1px solid #ced4da;
  padding: 0.6rem 1rem;
  transition: all 0.3s ease;
}

#mdaTbl .form-control:focus {
  border-color: var(--tbl-primary);
  box-shadow: 0 0 0 3px rgba(64, 140, 188, 0.15);
}

#mdaTbl .form-control[readonly] {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  color: #6c757d;
  font-weight: 600;
}

/* Badges y estados específicos */
#tblCab .badge {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  font-weight: 500;
}

#tblDet .badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

/* Animaciones específicas del módulo */
@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

/* Responsive específico */
@media (max-width: 768px) {
  #tblDet .dropdown-toggle {
    width: 32px;
    height: 32px;
  }
  
  #mdaTbl .modal-body {
    padding: 1.2rem;
  }
  
  #tblCab tbody tr {
    font-size: 0.9rem;
  }

  .tbl-page-subtitle {
    font-size: 0.58em;
  }

  .tbl-detail-toolbar {
    align-items: flex-start;
    font-size: 0.86rem;
    line-height: 1.3;
  }

  .tbl-actions .btn {
    width: 32px;
    height: 30px;
  }
}
