/**
 * ChimeStore - Vouchers Section Styles
 * Estilos para la sección de comprobantes (vouchers/tickets)
 */

/* Contenedor principal */
.vouchers-section {
  margin-top: 16px;
  padding: 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.vouchers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
}

.vouchers-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #e0e0e0;
  color: #333;
}

/* Formulario de comprobantes */
.voucher-form {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.voucher-form .form-group {
  margin-bottom: 12px;
}

.voucher-form .form-group:last-of-type {
  margin-bottom: 16px;
}

.voucher-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: #555;
}

.voucher-form .form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.voucher-form .form-control:focus {
  outline: none;
  border-color: var(--chimestore-primary, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.voucher-form .form-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #777;
}

.voucher-form textarea.form-control {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

/* Lista de comprobantes */
.vouchers-list {
  background: white;
  padding: 16px;
  border-radius: 8px;
}

.vouchers-list h5 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #555;
}

.no-vouchers {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 13px;
  margin: 0;
}

#sale-vouchers-items,
#purchase-vouchers-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item individual de comprobante */
.voucher-item {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.2s;
}

.voucher-item:hover {
  border-color: #ccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.voucher-item-content {
  flex: 1;
}

.voucher-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.voucher-type-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: #007bff;
  color: white;
}

.voucher-type-badge.ticket {
  background: #28a745;
}

.voucher-type-badge.factura {
  background: #007bff;
}

.voucher-type-badge.cheque {
  background: #d7a203;
}

.voucher-type-badge.orden_compra {
  background: #6f42c1;
}

.voucher-type-badge.orden_pago {
  background: #00d4bb;
}

.voucher-type-badge.remito {
  background: #fd7e14;
}

.voucher-number {
  font-weight: 600;
  color: #333;
  font-size: 13px;
}

.voucher-item-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.voucher-detail {
  display: flex;
  align-items: center;
  gap: 4px;
}

.voucher-detail strong {
  color: #333;
}

.voucher-notes {
  font-size: 12px;
  color: #777;
  font-style: italic;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e9ecef;
}

.voucher-item-actions {
  display: flex;
  gap: 4px;
}

.btn-remove-voucher {
  background: transparent;
  border: none;
  color: #dc3545;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s;
}

.btn-remove-voucher:hover {
  background: #dc3545;
  color: white;
}

/* Selector de método de pago */
.cart-payment-method {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.cart-payment-method label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 13px;
  color: #555;
}

.payment-method-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.payment-method-select:focus {
  outline: none;
  border-color: var(--chimestore-primary, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Gestión de Comprobantes en Tablas */
.vouchers-manager-container {
  margin: 0 auto;
  padding: 20px;
}

.vouchers-manager-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.vouchers-manager-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
  flex: 1;
}

.vouchers-manager-content {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

@media (max-width: 1000px) {
  .vouchers-manager-content {
    flex-direction: column;
  }
}

.vouchers-manager-content-main {
  display: flex;
  flex-direction: column;
  flex: 3;
  gap: 12px;
}

.vouchers-manager-content-sidebar {
  display: flex;
  flex-direction: column;
  flex: 2;
  gap: 12px;
}

.voucher-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.vouchers-manager-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
}

.btn-remove-voucher-manager {
  background: transparent;
  border: none;
  color: #dc3545;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
  transition: all 0.2s;
}

.btn-remove-voucher-manager:hover {
  background: #dc3545;
  color: white;
}

/* Responsive */
@media (max-width: 1000px) {
  .vouchers-section {
    padding: 12px;
  }

  .voucher-form {
    padding: 12px;
  }

  .voucher-item-details {
    flex-direction: column;
    gap: 4px;
  }

  .vouchers-manager-container {
    padding: 12px;
  }

  .voucher-form-grid {
    grid-template-columns: 1fr;
  }

  .vouchers-manager-actions {
    flex-direction: column;
  }

  .vouchers-manager-actions button {
    width: 100%;
  }
}

/* ========================================
   VOUCHER IMAGE PREVIEW & MODAL
   ======================================== */

/* Vista previa de imagen en el comprobante */
.voucher-image-preview {
  margin-top: 10px;
  text-align: center;
  padding: 10px;
  background: #fff;
  border-radius: 4px;
}

.voucher-thumbnail {
  max-width: 200px;
  max-height: 150px;
  border-radius: 4px;
  border: 2px solid #ddd;
  display: block;
  margin: 0 auto;
}

/* Modal de visualización de imagen */
.voucher-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voucher-image-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.voucher-image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.voucher-image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f44336;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.3s ease;
  z-index: 100001;
}

.voucher-image-modal-close:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

/* Controles de zoom */
.voucher-image-modal-zoom-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 8px 15px;
  background: #f5f5f5;
  border-radius: 25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.voucher-zoom-btn {
  background: white;
  border: 1px solid #ddd;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voucher-zoom-btn:hover {
  background: #007bff;
  color: white;
  border-color: #007bff;
  transform: scale(1.1);
}

.voucher-zoom-level {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  min-width: 50px;
  text-align: center;
}

/* Wrapper de imagen con scroll */
.voucher-image-wrapper {
  max-width: 85vw;
  max-height: 65vh;
  overflow: auto;
  border-radius: 4px;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voucher-image-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
  transition: transform 0.1s ease;
  transform-origin: center center;
}

.voucher-image-modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.voucher-image-download {
  padding: 10px 20px;
  text-decoration: none;
  display: inline-block;
}

/* Responsive para modal */
@media (max-width: 1000px) {
  .voucher-image-modal-content {
    padding: 10px;
  }

  .voucher-image-wrapper {
    max-width: 95vw;
    max-height: 75vh;
  }

  .voucher-thumbnail {
    max-width: 150px;
    max-height: 100px;
  }

  .voucher-image-modal-zoom-controls {
    padding: 5px 10px;
    gap: 6px;
  }

  .voucher-zoom-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .voucher-zoom-level {
    font-size: 12px;
    min-width: 45px;
  }
}
