/* ============================================================
   GENERIC STYLES
   Estilos que aplican en ambos modos (light y dark).
   No dependen de .light o .dark, usan variables del DS.
   ============================================================ */


/* --- Mensajes (Toast-style) --- */
.messages-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--ds-z-toast);
  max-width: 480px;
  width: 90%;
  padding: 0;
}

.messages-container .alert {
  margin-bottom: var(--ds-space-2);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-lg);
  padding: var(--ds-space-3) var(--ds-space-4);
  font-size: var(--ds-text-sm);
  font-weight: var(--ds-font-medium);
  animation: ds-fadeInUp var(--ds-transition-slow) ease-out;
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
}

.messages-container .alert .close,
.messages-container .alert [data-dismiss="alert"] {
  opacity: 0.6;
  transition: opacity var(--ds-transition-fast);
  margin-left: auto;
  padding-left: var(--ds-space-2);
}

.messages-container .alert .close:hover,
.messages-container .alert [data-dismiss="alert"]:hover {
  opacity: 1;
}


/* --- Main content area --- */
.main-content {
  animation: ds-fadeIn var(--ds-transition-slow) ease-out;
}


/* --- Contenedor de pagina --- */
.container-fluid {
  padding-left: var(--ds-space-5);
  padding-right: var(--ds-space-5);
}


/* --- Separador suave --- */
hr {
  border-top: 1px solid var(--ds-border-color);
  opacity: 1;
}


/* --- Links sin decoracion en nav --- */
.nav-link {
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: none;
}


/* --- Transiciones globales suaves --- */
.card,
.btn,
.form-control,
.custom-select,
.nav-link,
.dropdown-item,
.page-link,
.badge,
.alert {
  transition-property: background-color, border-color, color, box-shadow, transform, opacity;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}


/* --- Transicion suave entre modos dark/light --- */
body.mode-transitioning,
body.mode-transitioning *,
body.mode-transitioning *::before,
body.mode-transitioning *::after {
  transition: background-color 300ms ease,
              color 300ms ease,
              border-color 300ms ease,
              box-shadow 300ms ease,
              fill 300ms ease,
              stroke 300ms ease !important;
}


/* --- Acciones en tablas (reemplazo visual de iconos PNG) --- */
.table .btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--ds-radius-md);
  border: none;
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: all var(--ds-transition-fast);
}

.table .btn-action:hover {
  background-color: var(--ds-bg-hover);
  color: var(--ds-text-primary);
}

.table .btn-action.btn-action-edit:hover {
  color: var(--ds-primary);
  background-color: var(--ds-primary-subtle);
}

.table .btn-action.btn-action-delete:hover {
  color: var(--ds-danger);
  background-color: var(--ds-danger-subtle);
}

.table .btn-action.btn-action-view:hover {
  color: var(--ds-info);
  background-color: var(--ds-info-subtle);
}


/* --- Breadcrumbs (si se usan) --- */
.breadcrumb {
  background: transparent;
  padding: var(--ds-space-2) 0;
  margin-bottom: var(--ds-space-4);
  font-size: var(--ds-text-sm);
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--ds-text-muted);
}

.breadcrumb-item a {
  color: var(--ds-text-link);
}

.breadcrumb-item.active {
  color: var(--ds-text-muted);
}


/* --- Page header (titulo de pagina) --- */
.page-header {
  margin-bottom: var(--ds-space-6);
}

.page-header .page-title {
  font-size: var(--ds-text-2xl);
  font-weight: var(--ds-font-semibold);
  color: var(--ds-text-primary);
  margin-bottom: var(--ds-space-1);
}

.page-header .page-subtitle {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
}


/* --- Estados vacios --- */
.empty-state {
  text-align: center;
  padding: var(--ds-space-12) var(--ds-space-6);
}

.empty-state .empty-state-icon {
  font-size: 3rem;
  color: var(--ds-text-disabled);
  margin-bottom: var(--ds-space-4);
}

.empty-state .empty-state-title {
  font-size: var(--ds-text-lg);
  font-weight: var(--ds-font-semibold);
  color: var(--ds-text-secondary);
  margin-bottom: var(--ds-space-2);
}

.empty-state .empty-state-text {
  font-size: var(--ds-text-sm);
  color: var(--ds-text-muted);
  max-width: 400px;
  margin: 0 auto;
}


/* --- Loading skeleton placeholder --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--ds-gray-200) 25%,
    var(--ds-gray-100) 50%,
    var(--ds-gray-200) 75%
  );
  background-size: 200% 100%;
  animation: ds-pulse 1.5s ease-in-out infinite;
  border-radius: var(--ds-radius-sm);
}


/* --- Utilidad: truncar con ellipsis --- */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* --- Utilidad: separador vertical --- */
.divider-vertical {
  width: 1px;
  height: 24px;
  background-color: var(--ds-border-color);
  margin: 0 var(--ds-space-3);
  display: inline-block;
  vertical-align: middle;
}


/* --- Responsive: tablas con scroll horizontal --- */
.table-responsive {
  border-radius: var(--ds-radius-lg);
  border: 1px solid var(--ds-border-color);
}

.table-responsive .table {
  margin-bottom: 0;
}

.table-responsive .table thead th:first-child {
  border-top-left-radius: var(--ds-radius-lg);
}

.table-responsive .table thead th:last-child {
  border-top-right-radius: var(--ds-radius-lg);
}


/* --- Tooltip para iconos de navbar --- */
[data-toggle="tooltip"] {
  cursor: pointer;
}


/* --- Password visibility toggle --- */
.password-container-signin {
  position: relative;
}

.password-container-signin .bi-eye {
  color: var(--ds-text-muted);
  width: 1.25em;
  height: 1.25em;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  transition: color var(--ds-transition-fast);
}

.password-container-signin .bi-eye:hover {
  color: var(--ds-text-primary);
}


/* --- Responsive helpers --- */
@media (max-width: 768px) {
  .container-fluid {
    padding-left: var(--ds-space-3);
    padding-right: var(--ds-space-3);
  }

  h1, .h1 { font-size: var(--ds-text-2xl); }
  h2, .h2 { font-size: var(--ds-text-xl); }
  h3, .h3 { font-size: var(--ds-text-lg); }

  .card-body {
    padding: var(--ds-space-3);
  }

  .card-header {
    padding: var(--ds-space-3) var(--ds-space-3);
  }
}

@media (max-width: 576px) {
  .messages-container {
    width: 95%;
    bottom: 12px;
  }

  .btn-lg {
    padding: 0.5rem 1.25rem;
    font-size: var(--ds-text-sm);
  }

  /* Tablas responsive en mobile */
  .table th,
  .table td {
    white-space: nowrap;
    font-size: var(--ds-text-xs);
    padding: var(--ds-space-2) var(--ds-space-2);
  }

  /* Sidebar overlay en mobile */
  .sidebar-left {
    z-index: var(--ds-z-sidebar, 1040);
  }

  /* Page title responsive */
  .page-title {
    font-size: var(--ds-text-lg) !important;
  }

  /* Dropdown menus full width en mobile */
  .dropdown-menu {
    min-width: auto;
  }
}


/* --- Micro-animaciones: focus ring sutil en botones --- */
.btn:focus {
  box-shadow: 0 0 0 3px rgba(var(--ds-primary-rgb), 0.15);
}

.btn-primary:focus {
  box-shadow: 0 0 0 3px rgba(var(--ds-primary-rgb), 0.3);
}

.btn-success:focus {
  box-shadow: 0 0 0 3px rgba(var(--ds-success-rgb), 0.3);
}

.btn-danger:focus {
  box-shadow: 0 0 0 3px rgba(var(--ds-danger-rgb), 0.3);
}

.btn-warning:focus {
  box-shadow: 0 0 0 3px rgba(var(--ds-warning-rgb), 0.3);
}


/* --- Micro-animacion: ripple sutil en enlaces de sidebar --- */
.sidebar-left .nav-link:active {
  transform: scale(0.98);
}


/* --- Micro-animacion: dropdown fade in --- */
.dropdown-menu.show {
  animation: ds-fadeInUp 150ms ease-out;
}


/* --- Micro-animacion: tooltip fade --- */
.tooltip {
  animation: ds-fadeIn 150ms ease-out;
}


/* --- Micro-animacion: modal aparece con escala --- */
.modal.show .modal-dialog {
  animation: ds-modalIn 200ms ease-out;
}

@keyframes ds-modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}


/* --- Focus visible para accesibilidad --- */
:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}


/* --- Seleccion de texto con color primary --- */
::selection {
  background-color: rgba(var(--ds-primary-rgb), 0.2);
  color: inherit;
}
