/* ========================================
   MR Repuestos - Inventory Module Styles
   Identidad Visual Corporativa
   Last Updated: 2025-12-26 - v1.0
   ======================================== */

/* CSS Variables */
:root {
  --crushed-berry: #880d1eff;
  --raspberry: #dd2d4aff;
  --bubblegum-pink: #f26a8dff;
  --pink-mist: #f49cbbff;
  --light-cyan: #cbeef3ff;
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --border-color: #dee2e6;
  --medium-gray: #6c757d;
  --dark-gray: #212529;
}

/* Inventory Container */
.inventory-container {
  animation: fadeInUp 0.6s ease-out;
}

/* Inventory Header */
.inventory-header {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(136, 13, 30, 0.2);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--white);
}

.header-title i {
  font-size: 2rem;
}

.header-title h3 {
  margin: 0;
  padding-top: 0.25rem;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'Ubuntu', sans-serif;
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-stats {
  background: linear-gradient(135deg, var(--white), var(--light-gray));
  color: var(--raspberry);
  border: 2px solid var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.btn-stats:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
  background: var(--white);
}

/* Filtros de Inventario */
.inventory-filters {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filters-row {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--dark-gray);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: 'Ubuntu', sans-serif;
}

.filter-label i {
  margin-right: 0.25rem;
  color: var(--raspberry);
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--raspberry);
  box-shadow: 0 0 0 3px rgba(221, 45, 74, 0.1);
}

/* Filter Buttons */
.filter-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-filter-apply {
  background: linear-gradient(135deg, var(--crushed-berry), var(--raspberry));
  color: var(--white);
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
  box-shadow: 0 2px 6px rgba(136, 13, 30, 0.3);
}

.btn-filter-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(136, 13, 30, 0.4);
}

.btn-filter-clear {
  background: var(--white);
  color: var(--medium-gray);
  border: 1.5px solid var(--border-color);
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-family: 'Ubuntu', sans-serif;
}

.btn-filter-clear:hover {
  background: var(--light-gray);
  border-color: var(--medium-gray);
}

/* Info Card */
.inventory-info-card {
  background: linear-gradient(135deg, var(--light-cyan), var(--pink-mist));
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(203, 238, 243, 0.8);
  min-height: 50px;
  display: flex;
  align-items: center;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--dark-gray);
  font-family: 'Ubuntu', sans-serif;
  font-size: 0.95rem;
  width: 100%;
}

.info-item i {
  font-size: 1.25rem;
  color: var(--raspberry);
  flex-shrink: 0;
}

.info-item span {
  flex: 1;
  line-height: 1.5;
}

/* Inventory Table Container */
.inventory-table-container {
  background: var(--white);
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

/* Table Styles */
.table-inventory {
  width: 100%;
  margin-bottom: 0;
  color: var(--dark-gray);
  font-family: 'Ubuntu', sans-serif;
}

.table-inventory thead th {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  background-color: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  border-bottom: none !important;
  color: var(--white) !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8125rem;
  letter-spacing: 0.5px;
  padding: 0.875rem;
  border: none !important;
  white-space: nowrap;
  vertical-align: middle;
  min-width: 80px;
  text-align: center;
}

.table-inventory tbody td {
  padding: 0.875rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

/* Alineación de columnas numéricas a la derecha */
.table-inventory thead th:nth-child(1),
.table-inventory thead th:nth-child(7),
.table-inventory thead th:nth-child(8),
.table-inventory thead th:nth-child(9) {
  text-align: right;
}

.table-inventory tbody td:nth-child(1),
.table-inventory tbody td:nth-child(7),
.table-inventory tbody td:nth-child(8),
.table-inventory tbody td:nth-child(9) {
  text-align: right;
}

.table-inventory tbody tr {
  transition: all 0.2s ease;
}

.table-inventory tbody tr:hover {
  background-color: rgba(221, 45, 74, 0.03);
}

/* Product Info */
.product-info {
  min-width: 200px;
}

/* Quantity Styles */
.quantity {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Badges */
.badge {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Ubuntu', sans-serif;
}

.badge-lg {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
}

.badge-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: var(--white);
}

.badge-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: var(--white);
}

.badge-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: var(--white);
}

.badge-light {
  background: var(--light-gray);
  color: var(--dark-gray);
  border: 1px solid var(--border-color);
}

/* Action Buttons */
.btn-group-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.btn-view {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: var(--white);
}

.btn-view:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Movement Detail Modal */
.movement-detail {
  padding: 1rem;
}

.detail-group {
  margin-bottom: 1.5rem;
}

.detail-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--medium-gray);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-group p {
  margin: 0;
  color: var(--dark-gray);
  font-size: 1rem;
}

.detail-box {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.detail-box label {
  display: block;
  font-weight: 600;
  color: var(--medium-gray);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-box .value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.notes {
  background: var(--light-gray);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--raspberry);
  font-style: italic;
}

/* Stats Container */
.stats-container {
  padding: 1rem;
}

.stats-period {
  background: linear-gradient(135deg, var(--light-cyan), var(--pink-mist));
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Ubuntu', sans-serif;
}

.stats-period i {
  color: var(--raspberry);
  font-size: 1.25rem;
}

.stats-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--dark-gray);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--raspberry);
  font-family: 'Ubuntu', sans-serif;
}

.stats-title i {
  color: var(--raspberry);
}

/* Stat Cards */
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-card.card-success {
  border-color: #10b981;
}

.stat-card.card-danger {
  border-color: #ef4444;
}

.stat-card.card-warning {
  border-color: #f59e0b;
}

.stat-card i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.card-success i {
  color: #10b981;
}

.card-danger i {
  color: #ef4444;
}

.card-warning i {
  color: #f59e0b;
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0;
  color: var(--dark-gray);
}

.stat-card p {
  font-weight: 600;
  color: var(--medium-gray);
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.stat-card small {
  color: var(--medium-gray);
  font-size: 0.875rem;
}

/* Modal Styles */
.modal-corporate .modal-header {
  background: linear-gradient(135deg, var(--crushed-berry), var(--raspberry));
  color: var(--white);
  border-radius: 12px 12px 0 0;
  padding: 1.25rem 1.5rem;
}

.modal-corporate .modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-family: 'Ubuntu', sans-serif;
}

.modal-corporate .btn-close {
  filter: brightness(0) invert(1);
}

.modal-corporate .modal-body {
  padding: 2rem;
}

.modal-corporate .modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .inventory-table-container {
    padding: 1rem;
  }

  .table-inventory thead th {
    font-size: 0.75rem;
    padding: 0.75rem 0.5rem;
  }

  .table-inventory tbody td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 992px) {
  .inventory-header {
    padding: 1.25rem 1.5rem;
  }

  .header-title h3 {
    font-size: 1.5rem;
  }

  .header-title i {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .header-title {
    justify-content: center;
    text-align: center;
  }

  .header-actions {
    justify-content: center;
    width: 100%;
  }

  .btn-stats {
    width: 100%;
    justify-content: center;
  }

  .filters-row {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
    min-width: auto;
  }

  .filter-actions {
    width: 100%;
    flex-direction: column;
  }

  .btn-filter-apply,
  .btn-filter-clear {
    width: 100%;
    justify-content: center;
  }

  .inventory-info-card {
    padding: 1rem;
  }

  .info-item {
    font-size: 0.875rem;
    flex-direction: column;
    text-align: center;
  }

  .inventory-table-container {
    padding: 0.75rem;
    border-radius: 8px;
  }

  /* Optimizar tabla para móviles */
  .table-inventory thead th {
    font-size: 0.7rem;
    padding: 0.5rem 0.25rem;
  }

  .table-inventory tbody td {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
  }

  .product-info {
    min-width: 150px;
  }

  .quantity {
    font-size: 1rem;
  }

  .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }

  .btn-action {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  /* Modales en móvil */
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-corporate .modal-body {
    padding: 1rem;
  }

  .detail-box .value {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card h3 {
    font-size: 1.75rem;
  }

  .stat-card i {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .inventory-header {
    padding: 1rem;
  }

  .header-title h3 {
    font-size: 1.25rem;
  }

  .inventory-filters {
    padding: 1rem;
  }

  .filter-label {
    font-size: 0.8rem;
  }

  .filter-input,
  .filter-select {
    font-size: 0.875rem;
    padding: 0.5rem;
  }

  .btn-filter-apply,
  .btn-filter-clear {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  /* Tabla ultra compacta en móviles pequeños */
  .table-inventory thead th {
    font-size: 0.65rem;
    padding: 0.4rem 0.2rem;
  }

  .table-inventory tbody td {
    padding: 0.4rem 0.2rem;
    font-size: 0.75rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* DataTables Custom Styles */
.dataTables_wrapper {
  width: 100%;
  font-family: 'Ubuntu', sans-serif;
}

.dataTables_wrapper .dataTables_length select {
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  font-family: 'Ubuntu', sans-serif;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 0.375rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  font-family: 'Ubuntu', sans-serif;
}

.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--raspberry);
  box-shadow: 0 0 0 3px rgba(221, 45, 74, 0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #343a40 !important;
  color: var(--white) !important;
  border: none !important;
  border-radius: 6px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--light-gray) !important;
  color: var(--dark-gray) !important;
  border: none !important;
  border-radius: 6px;
}

/* Fix DataTables thead gradient rendering */
.dataTables_wrapper table.dataTable thead th,
.dataTables_wrapper table.dataTable thead td {
  border-bottom: none !important;
}

.dataTables_wrapper table.dataTable.no-footer {
  border-bottom: 1px solid var(--border-color);
}

/* DataTables Responsive */
.dataTables_wrapper .dataTables_info {
  padding-top: 1rem;
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 1rem;
}

/* Responsive DataTables - Ocultar columnas en móviles */
@media (max-width: 768px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: center;
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: center;
    font-size: 0.75rem;
  }

  .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Asegurar que los estilos se vean en todos los navegadores */
table.dataTable thead th {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  background-color: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  background-image: none !important;
  border-bottom: none !important;
  position: relative;
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc,
table.dataTable thead .sorting_asc_disabled,
table.dataTable thead .sorting_desc_disabled {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  background-color: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  background-image: none !important;
  padding-right: 30px !important;
}

/* ========================================
   SweetAlert2 Override - Asegurar Visibilidad
   ======================================== */

/* Asegurar que SweetAlert esté por encima de todo */
.swal2-container {
  z-index: 99999 !important;
}

/* Mejorar el backdrop para mejor contraste */
.swal2-container.swal2-backdrop-show {
  background: rgba(0, 0, 0, 0.6) !important;
}

/* Asegurar que el popup sea visible y centrado */
.swal2-popup {
  z-index: 100000 !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

/* Mejorar legibilidad del contenido */
.swal2-html-container {
  font-size: 1rem !important;
  line-height: 1.6 !important;
  color: #333 !important;
}

/* Botones con colores corporativos */
.swal2-confirm {
  background: #343a40 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(52, 58, 64, 0.3) !important;
  padding: 0.75rem 2rem !important;
  font-weight: 600 !important;
  transition: all 0.3s ease !important;
}

.swal2-confirm:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(52, 58, 64, 0.4) !important;
}

/* Iconos más visibles */
.swal2-icon {
  border-width: 3px !important;
}

.swal2-icon.swal2-warning {
  border-color: #f39c12 !important;
  color: #f39c12 !important;
}

.swal2-icon.swal2-info {
  border-color: #3498db !important;
  color: #3498db !important;
}

/* Asegurar que la columna Acciones sea siempre visible y centrada */
table.dataTable thead th:last-child,
table.dataTable tbody td:last-child {
  text-align: center !important;
  min-width: 100px;
}
