/* --- Estilos Minimalistas y Elegantes --- */

/* Paleta de colores:
  - Fondo: #f8f9fa (gris muy claro)
  - Texto principal: #212529 (casi negro)
  - Bordes/Divisores: #dee2e6 (gris claro)
  - Primario: #007bff (azul)
  - Secundario: #6c757d (gris medio)
*/

/* Estilos generales y tipografías */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background-color: #f8f9fa;
  color: #212529;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}



.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 30px 40px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #212529;
}

h2 {
  font-size: 22px;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 12px;
  margin-top: 0;
  margin-bottom: 25px;
}

h3 {
  font-size: 18px;
}


/* --- Estilos para tabla unificada --- */
.sort-icon {
  font-size: 12px;
  margin-left: 5px;
  color: #6c757d;
}

.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.sortable:hover {
  background-color: #333;
}

th[onclick] {
  cursor: pointer;
  user-select: none;
}

th[onclick]:hover {
  background-color: #f8f9fa;
}

/* Filter toggle button */
.filter-toggle-btn {
  background: none;
  border: none;
  padding: 8px;
  margin-left: 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-toggle-btn:hover {
  background-color: #e9ecef;
}

.filter-toggle-btn .material-icons-outlined {
  font-size: 20px;
  color: #6c757d;
}

/* Filter Modal */
.filter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.filter-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  background-color: #f8f9fa;
}

.filter-modal-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #212529;
}

.filter-modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.filter-modal-close:hover {
  background-color: #e9ecef;
}

.filter-modal-close .material-icons-outlined {
  font-size: 18px;
  color: #6c757d;
}

.filter-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

@media (max-width: 768px) {
  .filter-modal-body {
    grid-template-columns: 1fr;
  }
  
  .filter-modal-content {
    width: 95%;
    margin: 10px;
  }
}

/* Nota explicativa para la tabla */
.table-note {
  background-color: #e3f2fd;
  color: #1565c0;
  padding: 10px 15px;
  border-radius: 4px;
  border-left: 4px solid #2196f3;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.4;
}

.table-note strong {
  color: #0d47a1;
}


.action-buttons {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.btn-icon {
  background: none;
  border: none;
  padding: 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
  font-size: 16px;
}

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

.btn-icon.btn-edit {
  color: #007bff;
}

.btn-icon.btn-cancel {
  color: #ffc107;
}

.btn-icon.btn-delete {
  color: #dc3545;
}

.btn-icon.btn-edit:hover {
  background-color: #e7f3ff;
}

.btn-icon.btn-cancel:hover {
  background-color: #fff3cd;
}

.btn-icon.btn-delete:hover {
  background-color: #f8d7da;
}

/* --- Campos adicionales para anticipos --- */
#anticipo-fields {
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

/* --- Estados de productos --- */
.product-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

.status-active {
  background-color: #d4edda;
  color: #155724;
}

.status-cancelled {
  background-color: #f8d7da;
  color: #721c24;
}

.category-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.category-service {
  background-color: #cce5ff;
  color: #0066cc;
}

.category-course {
  background-color: #d1ecf1;
  color: #0c5460;
}

.category-anticipo {
  background-color: #fff3cd;
  color: #856404;
}

.section {
  margin-bottom: 50px;
  padding: 0 10px;
}

/* Formularios */
.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}

/* Date picker y campos de hora mejorados */
.date-picker {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.date-picker:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.date-picker:hover {
  border-color: #007bff;
}

.time-select {
  min-width: 160px;
  font-size: 14px;
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.time-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.time-select:hover {
  border-color: #007bff;
}

/* Estilos para opciones ocupadas */
.time-select option:disabled {
  color: #dc3545 !important;
  background-color: #f8f9fa;
  font-style: italic;
}

/* Información de disponibilidad de horarios */
.time-availability-info {
  margin-top: 8px;
  padding: 6px 10px;
  background-color: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 6px;
  font-size: 12px;
  color: #1976d2;
  text-align: center;
}

/* Nuevos estilos modernos para el POS */
.form-modern {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
  text-align: left;
  margin: 0;
}

.form-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.form-section h3 {
  margin: 0 0 15px 0;
  color: #343a40;
  font-size: 16px;
  font-weight: 600;
}

.products-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-selector {
  display: grid;
  grid-template-columns: 150px 1fr 80px 100px;
  gap: 12px;
  align-items: end;
}

.product-select {
  min-width: 200px;
}

.quantity-input {
  width: 70px !important;
  text-align: center;
  padding: 8px 4px !important;
}

.btn-add {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s;
}

.btn-add:hover {
  background-color: #218838;
}

.selected-products {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.product-item {
  display: grid;
  grid-template-columns: 1fr 80px 100px 40px;
  gap: 12px;
  align-items: center;
  background: white;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.product-item-name {
  font-weight: 500;
  color: #343a40;
}

.product-item-quantity {
  text-align: center;
  color: #6c757d;
  font-size: 14px;
}

.product-item-price {
  text-align: right;
  font-weight: 600;
  color: #28a745;
}

.btn-remove {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background-color: #c82333;
}

.totals-section {
  background: #343a40;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin: 10px 0;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.totals-row:last-child {
  border-bottom: none;
}

.total-final {
  font-size: 18px;
  font-weight: 600;
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  margin-top: 10px;
  padding-top: 15px;
}

/* Estilos para sección de descuentos colapsable */
.discount-section {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
}

.discount-header {
  padding: 0 0 15px 0;
  background: transparent;
  color: #343a40;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.2s ease;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 15px;
}

.discount-header:hover {
  color: #007bff;
}

.discount-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #007bff;
}

.discount-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  margin: 0;
  flex-grow: 1;
  color: inherit;
}

.discount-icon {
  font-size: 20px;
  opacity: 0.8;
}

.discount-container {
  background: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 300px;
  }
}

.discount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.full-width-discount {
  grid-column: 1 / -1;
}

.input-with-symbol {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-symbol input {
  flex: 1;
  padding-right: 35px;
}

.input-symbol {
  position: absolute;
  right: 12px;
  color: #6c757d;
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
}

.discount-preview {
  background: #e8f5e8;
  padding: 12px 15px;
  border-radius: 6px;
  border: 1px solid #d4edda;
}

.discount-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.discount-preview-item span:first-child {
  color: #495057;
}

.discount-amount {
  color: #28a745;
  font-size: 16px;
  font-weight: 700;
}

/* Oncological patient section styling */
#oncologico-fields.active h3 {
  color: #ea76cb;
  transition: color 0.3s ease;
}

/* Warrior option styling */
option[value="warrior"] {
  background-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .discount-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .discount-header {
    padding: 12px 15px;
  }
  
  .discount-label {
    font-size: 14px;
  }
}

.full-width {
  grid-column: 1 / -1;
}

.form-actions-modern {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
}

.btn-primary-large {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.2s;
}

.btn-primary-large:hover {
  background-color: #0056b3;
}

.btn-secondary-large {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.2s;
}

.btn-secondary-large:hover {
  background-color: #5a6268;
}

label {
  font-weight: 600;
  text-align: right;
  color: #495057;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
}
input:focus, select:focus, textarea:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
input:disabled {
  background-color: #e9ecef;
  cursor: not-allowed;
}

button {
  background-color: #343a40;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  margin-right: 10px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #212529;
}

.btn-secondary, button[type="reset"], button#btnTestTicket, #btnExport {
  background-color: #6c757d;
}
.btn-secondary:hover, button[type="reset"]:hover, button#btnTestTicket:hover, #btnExport:hover {
  background-color: #5a6268;
}

.btn-danger {
  background-color: #dc3545;
}
.btn-danger:hover {
  background-color: #c82333;
}

.btn-icon {
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon .material-icons-outlined {
  font-size: 20px;
}

.form-actions {
  grid-column-start: 2;
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
.form-actions button {
  margin-right: 0;
  margin-left: 10px;
}

/* Tabla */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}

.action-btn {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  padding: 5px;
  font-size: 13px;
  text-decoration: none;
}
.action-btn:hover {
  text-decoration: underline;
}
button.action-btn {
  color: #dc3545;
}

/* Estilos del Ticket */
.ticket {
  width: 58mm;
  max-width: 58mm;
  background: #fff;
  color: #000;
  padding: 6px 1mm;
  box-sizing: border-box;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  border: 1px solid #ccc; /* Visible en pantalla, no en impresión */
}
.t-logo {
  display: block;
  margin: 0 auto 8px auto;
  max-width: 75%;
  height: auto;
}
.t-center { text-align: center; }
.t-right { text-align: right; }
.t-left { text-align: left; }
.t-bold { font-weight: bold; }
.t-business-name { font-size: 14px; margin-bottom: 4px; }
.t-tagline { font-size: 11px; margin-bottom: 8px; font-style: italic; }
.t-spacer { height: 4px; }
.t-small { font-size: 11px; line-height: 1.3; }
.t-service-title { margin-bottom: 6px; font-size: 12px; }
.t-service-detail { margin-bottom: 3px; }
.t-anticipo-note { 
  word-wrap: break-word; 
  width: 100%; 
  text-align: left; 
  line-height: 1.4;
}
.t-divider { border-top: 1px dashed #000; margin: 8px 0; }
.t-row { display: flex; justify-content: space-between; margin-bottom: 2px; }
.t-row-label { font-weight: bold; }
.t-service-detail-label { font-weight: bold; }
.t-footer { margin-top: 10px; }
.t-total-large { font-size: 15px; margin: 6px 0; }

.t-qr-section {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #000;
  text-align: center;
}
.t-qr-section .t-small {
  margin-bottom: 4px;
}
#qr-canvas {
  margin: 8px auto 4px auto;
  display: block;
}

/* Estilos para columnas del ticket */
.t-client-appointment-section {
  margin: 8px 0;
}

.t-client-appointment-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.t-client-appointment-col {
  flex: 1;
  font-size: 11px;
  line-height: 1.3;
}

.t-client-appointment-col div {
  margin-bottom: 4px;
}


/***** MODO IMPRESIÓN *****/
@media print {
  * {
    visibility: hidden;
  }
  
  body {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
  }
  
  .no-print, .container, .main-footer-credits, .main-header, .main-footer, 
  .tabs, .tab-content, header, footer, nav, aside {
    display: none !important;
    visibility: hidden !important;
  }

  #printArea, #printArea * {
    visibility: visible !important;
    display: block !important;
  }
  
  @page {
    size: 58mm auto;
    margin: 0.1cm 0.05cm;
  }
  
  /* Configuración adicional para impresión PDF */
  @media print {
    body {
      width: 58mm !important;
      max-width: 58mm !important;
    }
  }
  
  .ticket {
    border: none;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .t-logo {
    display: block !important;
    margin: 0 auto 8px auto;
    max-width: 75%;
    height: auto;
    -webkit-print-color-adjust: exact;
    color-adjust: exact;
  }
}

/* --- Estilos de Pestañas --- */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  padding-bottom: 20px;
  border-bottom: 1px solid #dee2e6;
}

.header-logo {
  max-width: 20%;
  height: auto;
  padding-right: 50px;
}

.tabs {
  display: flex;
  flex-grow: 1;
}

.tab-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-link:hover {
  color: #343a40;
}

.tab-link.active {
  color: #343a40;
  border-bottom-color: #343a40;
}

.tab-link.active span:not(.material-icons-outlined) {
    display: inline-block;
}

.tab-link:not(.active) span:not(.material-icons-outlined) {
    display: none;
}

.tab-link:not(.active) {
    color: rgba(108, 117, 125, 0.5);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

table th, table td {
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
    text-align: left;
    white-space: nowrap;
}

table th {
    background-color: #000;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    border-bottom-width: 2px;
}

table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

table tbody tr:hover {
    background-color: #e9ecef;
}

.section-divider {
    border: 0;
    border-top: 1px solid #dee2e6;
    margin: 40px 0;
}

/* Dashboard Styles */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  text-align: center;
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #555;
  font-weight: 500;
}

.stat-card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: #343a40;
}

.dashboard-chart {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  position: relative;
  height: 300px;
}

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

.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.appointment-item {
  background-color: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-item a {
  text-decoration: none;
  color: #343a40;
  font-weight: 600;
}
.appointment-item a:hover {
  color: #0056b3;
}

.appointment-item .date {
  color: #6c757d;
  font-size: 14px;
}

/* --- Estilos específicos de Clientes --- */
.form-grid-single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-grid-single label {
  text-align: left;
  margin-bottom: -5px; /* Acercar la etiqueta al campo */
}
.form-grid-single input[type="tel"] {
  max-width: 250px;
}
.form-grid-single .checkbox-container {
  margin-top: 10px;
}
.form-grid-single .checkbox-container label {
  font-weight: 400; /* Peso normal para checkboxes */
}
.form-actions-single {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.checkbox-container {
  display: flex;
  align-items: center;
}
.checkbox-container input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.hidden {
  display: none !important;
}

#m-subtipo-container {
  /* Esto asegura que el contenedor del subtipo se alinee correctamente en el grid */
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}

.client-history-row td {
  padding: 0 !important;
  background-color: #f8f9fa;
}
.client-history-content {
  padding: 15px;
}
.client-history-content h4 {
  margin-top: 0;
  font-family: 'Montserrat', sans-serif;
}
.client-history-content table {
  width: 100%;
  border-collapse: collapse;
}
.client-history-content th, .client-history-content td {
  padding: 8px;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
}
.client-history-content th {
  text-align: left;
  font-weight: 600;
}

/* --- Estilos de Configuración --- */
.data-location-info {
  background-color: #e9ecef;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1.5;
}
.data-location-info strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.info-icon {
  font-size: 18px;
  color: #6c757d;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 8px;
}
.info-icon:hover {
  color: #343a40;
}

.sub-section {
  margin-top: 40px;
  margin-bottom: 40px;
  padding: 25px 15px;
  border-top: 1px solid #e9ecef;
}
.sub-section h3 {
  margin-top: 0;
  margin-bottom: 25px;
}

/* --- Estilos del Pie de Página --- */
.main-footer-credits {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 12px;
}

.main-footer-credits p {
  margin: 0 0 5px 0;
}

/* --- Estilos para Sub-Pestañas --- */
.sub-tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 25px;
}

.sub-tab-link {
  padding: 10px 20px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.sub-tab-link:hover {
  color: #343a40;
}

.sub-tab-link.active {
  color: #343a40;
  border-bottom-color: #343a40;
}

.sub-tab-content {
  display: none;
}

.sub-tab-content.active {
  display: block;
}

.client-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.client-history-header h4 {
  margin: 0;
}

#btn-export-history {
  background-color: #17a2b8;
}
#btn-export-history:hover {
  background-color: #138496;
}

/* --- Nuevos estilos para consulta de clientes --- */
.consult-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

.client-list-container h2, .client-record-container h2 {
    font-size: 20px;
}

.client-list-container .table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

#tblClients tbody tr {
    cursor: pointer;
}

#tblClients tbody tr:hover {
    background-color: #f1f3f5;
}

#tblClients tbody tr.selected {
    background-color: #e9ecef;
}

.client-record-container {
    border-left: 1px solid #dee2e6;
    padding-left: 30px;
}

#client-record-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
}

#client-details p {
    margin: 0 0 10px 0;
}

#client-details strong {
    display: inline-block;
    width: 100px;
}

.main-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    font-size: 12px;
}

.footer-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-logos img {
    height: 40px; /* Reducido para mejor proporción */
    width: auto;  /* Añadido para mantener la proporción */
    max-height: 40px; /* Añadido para evitar distorsión */
}

.footer-info p {
    margin: 5px 0;
}

/* Estilos para sección de anticipos */
.anticipos-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.anticipos-section h4 {
    margin: 0 0 15px 0;
    color: #28a745;
    font-size: 16px;
}

.anticipos-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.anticipo-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.anticipo-info {
    flex: 1;
}

.anticipo-monto {
    font-weight: bold;
    color: #28a745;
}

.anticipo-fecha {
    font-size: 12px;
    color: #6c757d;
}

.anticipo-actions {
    display: flex;
    gap: 8px;
}

.btn-aplicar-anticipo {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.btn-aplicar-anticipo:hover {
    background: #218838;
}

/* --- Cancellation Request Styles --- */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 80vh;
    overflow-y: auto;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
}

.cancellation-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.cancellation-info p {
    margin: 8px 0;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-approved {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-denied {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
    margin-right: 5px;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.reason-cell {
    max-width: 200px;
    word-wrap: break-word;
    cursor: help;
}

.processed-info {
    font-style: italic;
    color: #6c757d;
}

.processed-info small {
    font-size: 10px;
    color: #868e96;
}

.section-description {
    color: #6c757d;
    margin-bottom: 20px;
    font-style: italic;
}

/* --- Modern Sales Interface --- */
.sales-container {
    padding: 0;
    max-width: none;
    background: transparent;
}

.sales-header {
    background: #000000 !important;
    background-image: none !important;
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2);
}

.sales-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    border: none;
    padding: 0;
    color: white !important;
}

.sales-summary {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cart-count, .cart-total {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.sales-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

/* --- Products Panel --- */
.products-panel {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

.client-selector {
    margin-bottom: 25px;
}

.modern-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.modern-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modern-input::placeholder {
    color: #a0a8b0;
}

/* --- Categories --- */
.categories-container h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

.category-section {
    margin-bottom: 20px;
    border: 2px solid #f5f6fa;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.category-section:hover {
    border-color: #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.category-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.category-icon {
    font-size: 24px;
    margin-right: 12px;
}

.category-header h4 {
    margin: 0;
    flex: 1;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
}

.category-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.category-section.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.products-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    background: white;
}

.product-card {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: white;
    font-size: 13px;
}

.product-card:nth-child(even) {
    background: #f8f9fa;
}

.product-card:hover {
    background: #e3f2fd;
}

.product-card.selected {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    margin: 0;
}

.product-price {
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    text-align: right;
    min-width: 90px;
    display: block;
    justify-self: end;
}

.product-price.custom {
    color: #e74c3c;
    font-style: italic;
}

.product-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-self: end;
}

.btn-select-product {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-select-product:hover {
    background: #34495e;
}

/* Anticipos section */
.anticipos-grid {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 8px;
}

.anticipo-form {
    background: white;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.anticipo-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.anticipo-input-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#anticipo-amount {
    width: 100px;
}

#anticipo-comment {
    flex: 1;
}

.btn-add-anticipo {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-add-anticipo:hover {
    background: #218838;
}

/* Estilos para checkbox de confirmación de anticipo manual */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 10px 0;
  padding: 8px;
  border-radius: 6px;
  background: #fff8dc;
  border: 1px solid #f0ad4e;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

.checkbox-text {
  font-size: 14px;
  color: #856404;
  font-weight: 500;
}

.checkmark {
  margin-right: 5px;
}

.quantity-input {
    width: 45px;
    padding: 4px;
    border: 1px solid #e1e5e9;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
}

/* Tip para limpiar formulario */
.clear-form-tip {
    text-align: center;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    border-radius: 4px;
    color: #495057;
    font-size: 12px;
}

.clear-form-tip strong {
    color: #212529;
}

#clear-shortcut {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #343a40;
    border: 1px solid #ced4da;
    margin-left: 4px;
}

/* --- Checkout Panel --- */
.checkout-panel {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.modern-card {
    background: #fafbfc;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.modern-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-color: #d1d9e0;
}

.modern-card h3, .modern-card h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Cart Section --- */
.cart-section h3 {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.cart-items {
    max-height: 300px;
    overflow-y: auto;
}

.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-icon {
    font-size: 48px;
    opacity: 0.5;
    display: block;
    margin-bottom: 10px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f4;
}

.cart-item:last-child {
    border-bottom: none;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.item-details {
    font-size: 12px;
    color: #6c757d;
}

.item-price {
    font-weight: 600;
    color: #667eea;
    margin-left: 10px;
}

.btn-remove-item {
    background: #ff6b6b;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
}

/* --- Discount Section --- */
.modern-checkbox {
    display: none;
}

.discount-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
}

.discount-icon {
    font-size: 20px;
}

.modern-checkbox:checked + .discount-label .discount-icon {
    color: #ffc107;
}

.discount-options {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.modern-select {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.discount-input-group {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 2px;
    width: 120px;
}

.discount-input-group input {
    border: none;
    background: none;
    padding: 8px 10px;
    font-size: 14px;
    width: 80px;
}

.discount-input-group .input-symbol {
    background: #f8f9fa;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    border-radius: 6px;
    margin-right: 2px;
}

/* --- Payment Section --- */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.payment-option {
    cursor: pointer;
}

.payment-option input {
    display: none;
}

.payment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
}

.payment-option input:checked + .payment-card {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.payment-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

/* --- Totals Section --- */
.totals-breakdown {
    background: white;
    border-radius: 8px;
    padding: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.total-row:last-child {
    border-bottom: none;
}

.final-total {
    border-top: 2px solid #e9ecef;
    margin-top: 10px;
    padding-top: 15px;
    font-size: 18px;
}

.final-amount {
    color: #28a745;
    font-size: 20px;
}

.discount-amount {
    color: #ff6b6b;
}

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-checkout {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.btn-clear {
    background: #6c757d;
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 18px;
}

/* --- Notes Section --- */
.modern-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    background: white;
}

.modern-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
    .sales-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .checkout-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .sales-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .payment-grid {
        grid-template-columns: 1fr;
    }
    
    .discount-options {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}.btn-info {
    background-color: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
    margin-right: 5px;
}
.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}
