/* ========================================= */
/* 🎨 ESTILOS MODULARES PARA TILLUP POS */
/* ========================================= */

.products-grid-temu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.product-card-temu {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.product-card-temu:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.product-card-temu.out-of-stock {
  opacity: 0.6;
  cursor: not-allowed;
}

.product-image-container {
  position: relative;
  margin-bottom: 0.75rem;
}

.product-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
}

.stock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: bold;
}

.product-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.product-price {
  font-size: 1.25rem;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 0.25rem;
}

.product-stock {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.product-category {
  font-size: 0.75rem;
  color: #6c757d;
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.product-actions {
  display: flex;
  justify-content: center;
}

.btn-add-cart {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-cart:hover:not(.disabled) {
  background: #0056b3;
}

.btn-add-cart.disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.empty-state-temu {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.floating-cart-btn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,123,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 1000;
}

.floating-cart-btn:hover {
  transform: scale(1.1);
}

.cart-count-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.cart-drawer-temu {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  z-index: 1050;
  display: flex;
  flex-direction: column;
}

.cart-drawer-temu.open {
  right: 0;
}

.cart-drawer-header {
  padding: 1rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.btn-close-cart {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
}

.cart-drawer-form {
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.cart-drawer-products {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.cart-drawer-footer {
  padding: 1rem;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  display: none;
}

.cart-drawer-overlay.show {
  display: block;
}

.balance-card-treinta {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.balance-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: rgba(0,123,255,0.1);
  color: #007bff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.balance-content {
  flex: 1;
}

.balance-title {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.balance-amount {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.balance-subtitle {
  font-size: 0.75rem;
  color: #6c757d;
}

.movement-item-treinta {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.movement-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0,123,255,0.1);
  color: #007bff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movement-content {
  flex: 1;
}

.movement-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.movement-subtitle {
  font-size: 0.875rem;
  color: #6c757d;
}

.movement-amount {
  font-weight: bold;
}

.advanced-stats-treinta {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.advanced-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card-treinta {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s;
}

.stat-card-treinta:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0,123,255,0.1);
  color: #007bff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 0.25rem;
}

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

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.insight-card-treinta {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.insight-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.insight-content {
  flex: 1;
}

.insight-title {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.insight-value {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.insight-subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Solución para modal backdrop que bloquea clics */
.modal-backdrop {
  display: none !important;
}

.modal.show {
  background: rgba(0,0,0,0.5);
}

/* Prevenir problemas de aria-hidden */
.modal[aria-hidden="true"] {
  display: none !important;
}

/* Asegurar que los modales visibles no tengan aria-hidden */
.modal.show[aria-hidden] {
  aria-hidden: false !important;
}

/* Limpiar estilos problemáticos del body */
body.modal-open {
  overflow: auto !important;
  padding-right: 0 !important;
}

/* ========================================= */
/* 📱 RESPONSIVE DESIGN */
/* ========================================= */
@media (max-width: 768px) {
  .cart-drawer-temu {
    width: 100vw;
    right: -100vw;
  }
  
  .products-grid-temu {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
  }
  
  .advanced-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================= */
/* 🧾 ESTILOS DE COMPROBANTES Y RECIBOS */
/* ========================================= */

/* Comprobante general */
.receipt-treinta {
  max-width: 400px;
  margin: 0 auto;
  font-family: 'Courier New', monospace;
  background: white;
  border: 2px solid #1F2D3D;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.receipt-header {
  text-align: center;
  border-bottom: 2px solid #1F2D3D;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.receipt-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.receipt-logo h3 {
  margin: 0;
  color: #1F2D3D;
  font-size: 1.5rem;
}

.receipt-info {
  text-align: center;
}

.receipt-title {
  font-weight: bold;
  font-size: 1.1rem;
  color: #1F2D3D;
  margin-bottom: 5px;
}

.receipt-number, .receipt-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 3px;
}

.receipt-client {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.receipt-client i {
  margin-right: 5px;
  color: #1F2D3D;
}

.receipt-items {
  margin-bottom: 20px;
}

.receipt-items-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  font-size: 0.9rem;
  color: #1F2D3D;
}

.receipt-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #eee;
  font-size: 0.9rem;
}

.receipt-total {
  border-top: 2px solid #1F2D3D;
  padding-top: 15px;
  margin-bottom: 20px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.total-line.final {
  font-weight: bold;
  font-size: 1.2rem;
  color: #1F2D3D;
}

.total-amount {
  font-weight: bold;
  color: #1F2D3D;
}

.payment-type {
  background: #e9ecef;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.payment-type i {
  margin-right: 5px;
  color: #1F2D3D;
}

.receipt-footer {
  text-align: center;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

.footer-message {
  font-weight: bold;
  color: #1F2D3D;
  margin-bottom: 5px;
}

.footer-message i {
  color: #dc3545;
  margin-right: 5px;
}

.footer-brand small {
  color: #666;
  font-size: 0.8rem;
}

/* Detalle de movimiento */
.movement-detail-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  max-width: 400px;
  margin: 0 auto;
}

.movement-detail-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.movement-detail-header .movement-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.movement-detail-header .movement-icon.sale {
  background: linear-gradient(135deg, #28a745, #20c997);
}

.movement-detail-header .movement-icon.chicken_sale {
  background: linear-gradient(135deg, #fd7e14, #ffc107);
}

.movement-detail-header .movement-icon.debt {
  background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.movement-detail-header .movement-icon.payment {
  background: linear-gradient(135deg, #007bff, #0056b3);
}

.movement-detail-amount {
  text-align: center;
  margin-bottom: 15px;
}

.movement-detail-amount .amount {
  font-size: 2rem;
  font-weight: bold;
}

.movement-detail-amount .amount.positive {
  color: #28a745;
}

.movement-detail-amount .amount.negative {
  color: #dc3545;
}

.movement-detail-date {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

.movement-detail-date i {
  margin-right: 5px;
}

/* Estilos para SweetAlert2 de comprobantes */
.swal2-receipt-treinta {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.swal2-receipt-treinta .swal2-html-container {
  padding: 0;
  margin: 0;
}

/* Responsive para comprobantes */
@media (max-width: 576px) {
  .receipt-treinta {
    max-width: 100%;
    margin: 0;
    border-radius: 8px;
    padding: 15px;
  }
  
  .receipt-items-header,
  .receipt-item {
    grid-template-columns: 2fr 0.8fr 0.8fr 1fr;
    font-size: 0.8rem;
  }
  
  .movement-detail-card {
    max-width: 100%;
    margin: 0;
    padding: 15px;
  }
}