/* ===========================================
   SISTEMA DE VENTAS Y TPV
   =========================================== */

/* Forzar que el body y html no tengan scroll cuando está activo */
body:has(.sgt-ventas-system) {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

html:has(.sgt-ventas-system) {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
}

/* Forzar también elementos padre de WordPress */
body.admin-bar:has(.sgt-ventas-system) {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ocultar admin bar de WordPress cuando está activo el sistema */
body:has(.sgt-ventas-system) #wpadminbar {
    display: none !important;
}

/* Forzar contenedores padre pero preservar el menú */
body:has(.sgt-ventas-system) .wrap,
body:has(.sgt-ventas-system) #wpbody,
body:has(.sgt-ventas-system) #wpbody-content,
body:has(.sgt-ventas-system) .wp-admin {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* No aplicar overflow hidden al menú para que mantenga su layout original */
body:has(.sgt-ventas-system) #sgt-menu {
    overflow: visible !important;
}

/* ===========================================
   SECCIONES COMPACTAS DEL TPV
   =========================================== */

/* Cliente compacto */
.sgt-tpv-cliente-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 8px 12px;
    position: relative;
}

.sgt-tpv-cliente-compact label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    min-width: 55px;
    margin: 0;
}

.sgt-input-compact {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    height: 32px;
}

/* Configuración de precios compacta */
.sgt-tpv-precio-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 12px 8px 12px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.sgt-tpv-precio-compact label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    margin: 0;
}

.sgt-tpv-precio-compact .sgt-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #007cba;
    cursor: pointer;
}

/* Pago y notas compactos */
.sgt-tpv-pago-notas-compact {
    display: flex;
    gap: 10px;
    margin: 0 12px 8px 12px;
}

.sgt-tpv-pago-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.sgt-tpv-pago-compact label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    min-width: 40px;
    margin: 0;
}

/* Botones de método de pago */
.sgt-metodo-pago-buttons {
    display: flex;
    gap: 6px;
    flex: 1;
}

.sgt-metodo-pago-btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.75rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 500;
    color: #495057;
}

.sgt-metodo-pago-btn i {
    font-size: 0.8rem;
}

.sgt-metodo-pago-btn:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.sgt-metodo-pago-btn.active {
    background: #007cba;
    border-color: #007cba;
    color: white;
    font-weight: 600;
}

.sgt-metodo-pago-btn.active:hover {
    background: #005a87;
    border-color: #005a87;
}

.sgt-tpv-notas-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1.5;
}

.sgt-tpv-notas-compact label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    min-width: 45px;
    margin: 0;
}

.sgt-textarea-compact {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    resize: none;
    height: 32px;
    font-family: inherit;
}

/* Base imponible visible cuando se usa precios con IVA */
#sgt-tpv-base-imponible-line {
    color: #6c757d;
    font-size: 14px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

/* Cambiar estilo de totales según el modo */
.sgt-tpv-precio-config:has(.sgt-checkbox:checked) ~ .sgt-tpv-totales .sgt-tpv-total-line:first-child {
    background-color: #e8f4fd;
    border-radius: 4px;
    padding: 8px;
}

/* Estilos para el help text en el modal */
.sgt-help-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* Estilos para mostrar código en las líneas del ticket */
.sgt-tpv-linea-codigo {
    font-size: 9px;
    color: #6c757d;
    font-weight: 500;
    margin-top: 1px;
    padding: 1px 3px;
    background-color: #e9ecef;
    border-radius: 2px;
    display: inline-block;
    line-height: 1;
    max-width: fit-content;
}

/* Contenedor principal del sistema - dejar espacio para el menú */
.sgt-ventas-system {
    position: fixed !important;
    top: 250px !important; /* Dejar mucho más espacio para el menú completo */
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 250px) !important; /* Ajustar altura para el menú */
    z-index: 100 !important; /* Menor z-index para que el menú quede encima */
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sgt-tpv-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f8f9fa;
    overflow: hidden;
}

.sgt-tpv-header {
    background: white;
    color: #2c3e50;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 2px solid #e1e8ed;
    flex-shrink: 0;
}

.sgt-tpv-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sgt-logo-small {
    height: 40px;
    width: auto;
}

.sgt-tpv-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.sgt-tpv-actions {
    display: flex;
    gap: 1rem;
}

/* Botón Nueva Venta */
#sgt-tpv-nueva-venta.sgt-warning-button {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    position: relative;
    overflow: hidden;
}

#sgt-tpv-nueva-venta.sgt-warning-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#sgt-tpv-nueva-venta.sgt-warning-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004a6f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.4);
}

#sgt-tpv-nueva-venta.sgt-warning-button:hover::before {
    left: 100%;
}

#sgt-tpv-nueva-venta.sgt-warning-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

#sgt-tpv-nueva-venta.sgt-warning-button i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

#sgt-tpv-nueva-venta.sgt-warning-button:hover i {
    transform: rotate(90deg);
}

/* Contenido TPV */
.sgt-tpv-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Panel de Productos */
.sgt-tpv-productos {
    flex: 1;
    background: white;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
}

.sgt-tpv-productos-header {
    padding: 1.5rem 1rem;
    border-bottom: 2px solid #e1e8ed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sgt-tpv-productos-header h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.sgt-tpv-search-container {
    display: flex;
    flex-direction: column;
}

.sgt-tpv-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #dd3333;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(221, 51, 51, 0.3);
    transition: all 0.3s ease;
}

.sgt-tpv-search-box:focus-within {
    box-shadow: 0 6px 20px rgba(221, 51, 51, 0.5);
    transform: translateY(-2px);
}

.sgt-search-icon-tpv {
    position: absolute;
    left: 1rem;
    color: white;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1;
}

.sgt-search-input-tpv {
    flex: 1;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    color: white;
    background: transparent;
    outline: none;
    font-weight: 500;
}

.sgt-search-input-tpv::placeholder {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.sgt-clear-search-btn-tpv {
    position: absolute;
    right: 0.5rem;
    background: #e74c3c;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.sgt-clear-search-btn-tpv:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.sgt-clear-search-btn-tpv i {
    font-size: 0.9rem;
}

.sgt-tpv-productos-grid {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-content: start;
}

.sgt-tpv-producto-item {
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sgt-tpv-producto-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.sgt-tpv-producto-info {
    margin-bottom: 0.5rem;
}

.sgt-tpv-producto-codigo {
    font-family: 'Courier New', monospace;
    background: #ecf0f1;
    color: #2c3e50;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #bdc3c7;
}

.sgt-tpv-producto-nombre {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.3;
}

.sgt-tpv-producto-precio {
    color: #27ae60;
    font-weight: 700;
    font-size: 1.1rem;
}

.sgt-tpv-producto-stock {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

.sgt-tpv-producto-categoria {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Estado de productos */
.sgt-tpv-producto-item.sin-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.sgt-tpv-producto-item.sin-stock:hover {
    border-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.15);
}

.sgt-tpv-producto-item.destacado {
    border-color: #f39c12;
    background: #fef9e7;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
    animation: pulse 0.5s ease-in-out;
}

.stock-agotado {
    color: #e74c3c !important;
    font-weight: 600;
}

/* Sin productos encontrados */
.sgt-tpv-no-products {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #95a5a6;
    text-align: center;
    grid-column: 1 / -1;
}

.sgt-tpv-no-products i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sgt-tpv-no-products p {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sgt-tpv-no-products small {
    opacity: 0.7;
}

/* Botón producto libre */
.sgt-tpv-producto-libre {
    padding: 1rem;
    border-top: 1px solid #e1e8ed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sgt-add-libre-button {
    width: 100%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sgt-add-libre-button:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Panel de Ticket */
.sgt-tpv-ticket {
    width: 510px;
    background: white;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e1e8ed;
}

.sgt-tpv-ticket-header {
    padding: 1rem;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sgt-tpv-ticket-header h3 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.sgt-tpv-ticket-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #7f8c8d;
}

#sgt-tpv-ticket-numero {
    font-weight: 600;
    color: #3498db;
}

/* Cliente */
.sgt-tpv-cliente {
    padding: 1rem;
    border-bottom: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.sgt-tpv-cliente label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.sgt-tpv-cliente-selector {
    position: relative;
}

.sgt-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e1e8ed;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sgt-cliente-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.sgt-cliente-suggestion:hover,
.sgt-cliente-suggestion.selected {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.sgt-cliente-suggestion.no-results {
    opacity: 0.6;
    cursor: default;
    font-style: italic;
}

.sgt-cliente-suggestion.no-results:hover {
    background: #f8f9fa;
    border-left: none;
}

.sgt-cliente-suggestion-nombre {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.sgt-cliente-suggestion-info {
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* Líneas de venta */
.sgt-tpv-lineas {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.sgt-tpv-lineas-header {
    display: grid;
    grid-template-columns: 1fr 60px 60px 80px 30px;
    gap: 0.3rem;
    padding: 0.5rem 0.6rem;
    background: #f5f5f5;
    border-bottom: 1px solid #e1e8ed;
    font-weight: 600;
    font-size: 0.75rem;
    color: #2c3e50;
    align-items: center;
}

.sgt-tpv-lineas-header span {
    text-align: center;
}

.sgt-tpv-lineas-header span:first-child {
    text-align: left;
}

.sgt-tpv-lineas-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem;
    height: 300px; /* Altura fija para scroll */
    max-height: 300px;
    min-height: 300px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    background: white;
}

/* Estilos de scroll personalizado */
.sgt-tpv-lineas-container::-webkit-scrollbar {
    width: 8px;
}

.sgt-tpv-lineas-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sgt-tpv-lineas-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.sgt-tpv-lineas-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.sgt-tpv-empty-ticket {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #95a5a6;
    text-align: center;
    position: relative;
}

.sgt-tpv-empty-ticket i.fas.fa-shopping-cart {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sgt-tpv-add-libre-fixed {
    width: 100%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.sgt-tpv-add-libre-fixed i {
    font-size: 1rem;
    margin: 0;
}

.sgt-tpv-add-libre-fixed:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.sgt-tpv-add-libre-fixed:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.sgt-tpv-linea {
    display: grid !important;
    grid-template-columns: 1fr 60px 60px 80px 30px;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    transition: background-color 0.2s ease;
    min-height: 40px;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.85rem;
}

.sgt-tpv-linea:hover {
    background: #f8f9fa;
}

.sgt-tpv-linea-producto {
    min-width: 0;
    display: block !important;
    visibility: visible !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 4px;
    border-radius: 4px;
}

.sgt-tpv-linea-producto:hover {
    background-color: #f0f7ff;
}

.sgt-tpv-linea-nombre {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.75rem;
    line-height: 1.1;
    word-break: break-word;
    display: block !important;
    visibility: visible !important;
    margin-bottom: 2px;
}

.sgt-tpv-linea-desc {
    font-size: 0.65rem;
    color: #7f8c8d;
    margin-top: 1px;
    line-height: 1;
}

.sgt-tpv-linea-cantidad,
.sgt-tpv-linea-precio {
    display: flex !important;
    justify-content: center;
    visibility: visible !important;
}

.sgt-input-small {
    width: 100%;
    max-width: 55px;
    padding: 0.25rem;
    border: 1px solid #e1e8ed;
    border-radius: 3px;
    font-size: 0.75rem;
    text-align: center;
    box-sizing: border-box;
    height: 28px;
}

.sgt-tpv-linea-total {
    font-weight: 600;
    color: #27ae60;
    text-align: center;
    font-size: 0.75rem;
    display: block !important;
    visibility: visible !important;
    line-height: 1.2;
}

.sgt-tpv-linea-actions {
    display: flex !important;
    justify-content: center;
    align-items: center;
    visibility: visible !important;
}

.sgt-linea-remove {
    background: #e74c3c;
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.sgt-linea-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Totales */
.sgt-tpv-totales {
    padding: 1rem;
    border-top: 2px solid #e1e8ed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sgt-tpv-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.95rem;
}

.sgt-tpv-total-line input {
    width: 80px;
    text-align: right;
}

.sgt-tpv-total-final {
    border-top: 2px solid #2c3e50;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: #2c3e50;
}

/* Método de pago y notas */
.sgt-tpv-pago,
.sgt-tpv-notas {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.sgt-tpv-pago label,
.sgt-tpv-notas label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Acciones */
.sgt-tpv-acciones {
    padding: 1rem;
    display: flex;
    gap: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.sgt-tpv-acciones button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#sgt-tpv-cobrar {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

#sgt-tpv-cobrar:hover:not(:disabled) {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

#sgt-tpv-cobrar:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Vista Lista de Ventas */
.sgt-ventas-lista {
    background: white;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header de la lista de ventas */
.sgt-ventas-lista .sgt-header {
    flex-shrink: 0;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e1e8ed;
}

/* Sección de filtros */
.sgt-filter-section {
    flex-shrink: 0;
    padding: 1rem 2rem 0.5rem;
}

/* Sección de búsqueda */
.sgt-search-section {
    flex-shrink: 0;
    padding: 0.5rem 2rem 1rem;
}

/* Contenedor de la tabla */
.sgt-table-container {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    background: white;
}

/* Tabla fija */
.sgt-table {
    width: 100%;
}

.sgt-table thead {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
}

.sgt-table tbody {
    /* height auto para ajuste natural */
}

/* Modal Producto Libre - Asegurar que esté por encima del menú y sistema */
#sgt-producto-libre-modal {
    z-index: 10000 !important;
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    overflow: auto !important;
}

#sgt-producto-libre-modal .sgt-modal-content {
    max-width: 500px;
    z-index: 10001 !important;
    position: relative !important;
}

/* Asegurar que todos los modales estén por encima del menú */
.sgt-modal {
    z-index: 10000 !important;
}

.sgt-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sgt-form-group {
    flex: 1;
}

.sgt-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 1200px) {
    .sgt-tpv-ticket {
        width: 350px;
    }
    
    .sgt-tpv-productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 968px) {
    .sgt-tpv-content {
        flex-direction: column;
    }
    
    .sgt-tpv-ticket {
        width: 100%;
        max-height: 50vh;
    }
    
    .sgt-tpv-productos {
        border-right: none;
        border-bottom: 1px solid #e1e8ed;
    }
    
    .sgt-tpv-productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 576px) {
    .sgt-tpv-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .sgt-tpv-actions {
        width: 100%;
        justify-content: center;
    }
    
    .sgt-tpv-productos-grid {
        grid-template-columns: 1fr 1fr;
        padding: 0.75rem;
    }
    
    /* En móvil simplificamos a solo producto y cantidad + total */
    .sgt-tpv-linea {
        grid-template-columns: 1fr 60px 70px;
        gap: 0.25rem;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    /* Ocultar precio y acciones en móvil */
    .sgt-tpv-linea .sgt-tpv-linea-precio,
    .sgt-tpv-linea .sgt-tpv-linea-actions {
        display: none;
    }
    
    .sgt-tpv-lineas-header {
        grid-template-columns: 1fr 60px 70px;
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    /* Ocultar columnas de precio y acciones en móvil */
    .sgt-tpv-lineas-header span:nth-child(3),
    .sgt-tpv-lineas-header span:nth-child(5) {
        display: none;
    }
    
    .sgt-input-small {
        max-width: 50px;
        padding: 0.3rem;
        font-size: 0.8rem;
    }
    
    .sgt-form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sgt-tpv-linea {
    animation: slideIn 0.3s ease;
}

/* Estados de carga */
.sgt-loading {
    opacity: 0.6;
    pointer-events: none;
}

.sgt-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===========================================
   TABLA DE VENTAS - BOTONES DE ACCIONES
   =========================================== */

.sgt-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.sgt-btn-view-venta,
.sgt-btn-edit-venta,
.sgt-print-ticket,
.sgt-facturar-venta,
.sgt-delete-venta {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: relative;
    overflow: hidden;
}

/* Botón Ver */
.sgt-btn-view-venta {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(149, 165, 166, 0.2);
}

.sgt-btn-view-venta:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #5d6d7e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.4);
}

.sgt-btn-view-venta:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(149, 165, 166, 0.2);
}

/* Botón Editar */
.sgt-btn-edit-venta {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.2);
}

.sgt-btn-edit-venta:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.sgt-btn-edit-venta:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.2);
}

/* Botón Imprimir */
.sgt-print-ticket {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.sgt-print-ticket:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f618d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.sgt-print-ticket:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

/* Botón Eliminar */
.sgt-delete-venta {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.sgt-delete-venta:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Botón Facturar */
.sgt-facturar-venta {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.2);
}

.sgt-facturar-venta:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.sgt-facturar-venta:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.2);
}

.sgt-delete-venta:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

/* Efectos adicionales */
.sgt-btn-view-venta i,
.sgt-btn-edit-venta i,
.sgt-print-ticket i,
.sgt-facturar-venta i,
.sgt-delete-venta i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.sgt-btn-view-venta:hover i {
    transform: scale(1.15);
}

.sgt-btn-edit-venta:hover i {
    transform: scale(1.1) rotate(-5deg);
}

.sgt-facturar-venta:hover i {
    transform: scale(1.15) rotate(5deg);
}

.sgt-print-ticket:hover i {
    transform: scale(1.1);
}

.sgt-delete-venta:hover i {
    transform: scale(1.1) rotate(5deg);
}

/* Estados deshabilitados */
.sgt-btn-view-venta:disabled,
.sgt-btn-edit-venta:disabled,
.sgt-print-ticket:disabled,
.sgt-facturar-venta:disabled,
.sgt-delete-venta:disabled {
    background: #bdc3c7;
    color: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sgt-btn-view-venta:disabled:hover,
.sgt-btn-edit-venta:disabled:hover,
.sgt-print-ticket:disabled:hover,
.sgt-delete-venta:disabled:hover {
    background: #bdc3c7;
    transform: none;
    box-shadow: none;
}

/* Tooltips personalizados */
.sgt-btn-view-venta::before,
.sgt-btn-edit-venta::before,
.sgt-print-ticket::before,
.sgt-delete-venta::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.sgt-btn-view-venta::after,
.sgt-btn-edit-venta::after,
.sgt-print-ticket::after,
.sgt-delete-venta::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.sgt-btn-view-venta:hover::before,
.sgt-btn-view-venta:hover::after,
.sgt-btn-edit-venta:hover::before,
.sgt-btn-edit-venta:hover::after,
.sgt-print-ticket:hover::before,
.sgt-print-ticket:hover::after,
.sgt-delete-venta:hover::before,
.sgt-delete-venta:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Animación de click */
@keyframes clickPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.sgt-btn-view-venta:active,
.sgt-btn-edit-venta:active,
.sgt-print-ticket:active,
.sgt-delete-venta:active {
    animation: clickPulse 0.2s ease;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .sgt-actions {
        gap: 0.25rem;
    }

    .sgt-btn-view-venta,
    .sgt-btn-edit-venta,
    .sgt-print-ticket,
    .sgt-delete-venta {
        width: 32px;
        height: 32px;
        padding: 0.4rem;
    }

    .sgt-btn-view-venta i,
    .sgt-btn-edit-venta i,
    .sgt-print-ticket i,
    .sgt-delete-venta i {
        font-size: 0.8rem;
    }

    /* Ocultar tooltips en móvil */
    .sgt-btn-view-venta::before,
    .sgt-btn-view-venta::after,
    .sgt-btn-edit-venta::before,
    .sgt-btn-edit-venta::after,
    .sgt-print-ticket::before,
    .sgt-print-ticket::after,
    .sgt-delete-venta::before,
    .sgt-delete-venta::after {
        display: none;
    }
}

/* Estilos adicionales para la tabla */
.sgt-table .sgt-actions {
    min-width: 160px;
}

/* ANULAR ESTILOS BASE DE STYLE.CSS - MÁXIMA ESPECIFICIDAD */
table.sgt-table tbody tr.sgt-venta-row:hover {
    background-color: #ffebee !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
}

/* ANULAR EL PSEUDO-ELEMENTO AZUL - ELIMINAR EL HOVER INDIVIDUAL */
table.sgt-table tbody tr.sgt-venta-row td:not(.sgt-acciones):not(.sgt-estado):hover::after {
    display: none !important;
    content: none !important;
}

/* FORZAR COLOR EN TODAS LAS CELDAS DE LA FILA */
table.sgt-table tbody tr.sgt-venta-row:hover td {
    background-color: #ffebee !important;
}

/* ANULAR CUALQUIER OTRO ESTILO HOVER EN CELDAS INDIVIDUALES */
table.sgt-table tbody tr.sgt-venta-row td:hover {
    background-color: #ffebee !important;
    box-shadow: none !important;
    transform: none !important;
}

/* CURSOR POINTER EN FILAS COMPLETAS */
table.sgt-table tbody tr.sgt-venta-row {
    cursor: pointer;
}

/* MANTENER CURSOR POR DEFECTO EN CELDAS DE ACCIONES */
table.sgt-table tbody tr.sgt-venta-row td.sgt-actions {
    cursor: default;
}

table.sgt-table tbody tr.sgt-venta-row td.sgt-actions button {
    cursor: pointer;
}

/* DOBLE ASEGURAMIENTO - ANULAR ESTILOS HEREDADOS */
table.sgt-table tr.sgt-venta-row:hover {
    background-color: #ffebee !important;
}

table.sgt-table tr.sgt-venta-row:hover td {
    background-color: #ffebee !important;
}

.sgt-venta-row:hover .sgt-btn-view-venta,
.sgt-venta-row:hover .sgt-btn-edit-venta,
.sgt-venta-row:hover .sgt-print-ticket,
.sgt-venta-row:hover .sgt-facturar-venta,
.sgt-venta-row:hover .sgt-delete-venta {
    transform: translateY(-1px);
}

/* Estados de carga para los botones */
.sgt-btn-view-venta.loading,
.sgt-btn-edit-venta.loading,
.sgt-print-ticket.loading,
.sgt-delete-venta.loading {
    pointer-events: none;
    opacity: 0.7;
}

.sgt-btn-view-venta.loading::after,
.sgt-btn-edit-venta.loading::after,
.sgt-print-ticket.loading::after,
.sgt-delete-venta.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Estilos para métodos de pago */
.sgt-payment-method {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sgt-payment-efectivo {
    background: #d5f4e6;
    color: #27ae60;
    border: 1px solid #a9dfbf;
}

.sgt-payment-tarjeta {
    background: #dbeafe;
    color: #3498db;
    border: 1px solid #aed6f1;
}

.sgt-payment-transferencia {
    background: #f3e5f5;
    color: #9b59b6;
    border: 1px solid #d7b6d9;
}

.sgt-payment-mixto {
    background: #fff3cd;
    color: #f39c12;
    border: 1px solid #f7dc6f;
}

/* Estilos para precios */
.sgt-price {
    font-weight: 700;
    color: #27ae60;
    font-size: 1.05rem;
    text-align: right;
}

/* Estado sin resultados */
.sgt-no-results {
    text-align: center;
}

.sgt-no-results-content {
    padding: 3rem 2rem;
    color: #95a5a6;
}

.sgt-no-results-content i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sgt-no-results-content p {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sgt-no-results-content small {
    opacity: 0.7;
    font-size: 0.9rem;
}