/* ============================================================
   ESTILOS PARA VENTAS - Inventario TX
   ============================================================ */

.text-esmeralda { color: var(--color-esmeralda) !important; }

/* ── PANEL FOOTER ──────────────────────────────────────── */
.panel-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── BUSQUEDA ──────────────────────────────────────────── */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--color-muted);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.search-box input {
    padding-left: 2.75rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.search-box:focus-within i {
    color: var(--color-primary);
    transform: scale(1.1);
}

/* ── ESTADISTICAS INLINE ───────────────────────────────── */
.stats-inline {
    display: flex;
    gap: 1.5rem;
}

.stats-inline-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.stats-inline-label {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.stats-inline-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-heading);
}

/* ── ITEMS DEL CARRITO ─────────────────────────────────── */
.cart-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    animation: deslizar-entrada var(--transition-normal) both;
}

.cart-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.cart-item-image {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.cart-item-image:hover {
    transform: scale(1.05);
}

.cart-item-info {
    flex: 1;
    min-width: 140px;
}

.cart-item-nombre {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: var(--font-size-sm);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-precio {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
}

.cart-item-controles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quantity selector - qty-control */
.qty-control {
    display: inline-flex;
    align-items: center;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.qty-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
}

.qty-control button:hover {
    background: var(--color-primary);
    color: white;
}

.qty-control button:active {
    transform: scale(0.9);
}

.qty-control input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-heading);
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-cantidad {
    width: 56px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    font-size: var(--font-size-sm);
}

.cart-item-total {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-sm);
    min-width: 80px;
    text-align: right;
}

.cart-item-quitar {
    background: none;
    border: none;
    color: var(--color-rubi);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-quitar:hover {
    background: var(--color-rubi-light);
    transform: scale(1.1);
}

/* ── VENTA RECIENTE ────────────────────────────────────── */
.venta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    animation: deslizar-entrada var(--transition-normal) both;
}

.venta-item:hover {
    background: var(--color-bg);
}

.venta-item:last-child {
    border-bottom: none;
}

.venta-item-info {
    min-width: 0;
    flex: 1;
}

.venta-item-productos {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.venta-item-fecha {
    font-size: var(--font-size-xs);
    color: var(--color-info);
    margin-top: 2px;
}

.venta-item-monto {
    font-weight: 700;
    color: var(--color-esmeralda);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    margin-left: 0.75rem;
}

/* ── RESUMEN DE VENTA (MODAL) ──────────────────────────── */
.resumen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    animation: deslizar-entrada var(--transition-normal) both;
}

.resumen-item:last-child {
    border-bottom: none;
}

.resumen-item-nombre {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resumen-item-monto {
    font-weight: 600;
    color: var(--color-esmeralda);
}

/* ── ITEM ANIMATION ───────────────────────────────────── */
.cart-item.removing {
    animation: deslizar-salida 0.3s ease forwards;
}

/* ── BADGE COUNT ───────────────────────────────────────── */
.badge-count {
    background: var(--color-rubi);
    color: white;
    font-size: 0.65rem;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
}

/* ── BADGE SERVICIO ──────────────────────────────────── */
.badge-servicio {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}

/* ── BOTONES SERVICIOS RAPIDOS ───────────────────────── */
#serviciosRapidos {
    border-top: 1px dashed var(--color-border);
    padding-top: 0.75rem;
}

.btn-servicio-rapido {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-servicio-rapido:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-servicio-rapido:hover .servicio-rapido-precio,
.btn-servicio-rapido:hover .servicio-rapido-aleas {
    color: rgba(255,255,255,0.85);
}

.servicio-rapido-precio {
    font-family: monospace;
    background: var(--color-esmeralda-light);
    color: var(--color-esmeralda);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.servicio-rapido-aleas {
    color: var(--color-muted);
    font-size: 0.7rem;
    font-weight: 400;
    font-style: italic;
}

/* ── SEARCH RESULTS TABLE ──────────────────────────────── */
.product-results-table,
.search-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.product-results-table thead th,
.search-results-table thead th {
    background: var(--color-bg);
    padding: 0.5rem 0.625rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.product-results-table tbody tr.product-row,
.search-results-table tbody tr.sr-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.product-results-table tbody tr.product-row:hover,
.search-results-table tbody tr.sr-row:hover {
    background: var(--color-bg);
}

.product-results-table tbody tr.product-row:active,
.search-results-table tbody tr.sr-row:active {
    background: var(--color-primary-light);
}

.th-img, .td-img { width: 48px; text-align: center; }
.th-nombre, .td-nombre { text-align: left; }
.th-precio, .td-precio { width: 100px; text-align: right; }
.th-stock, .td-stock { width: 80px; text-align: center; }
.th-tipo, .td-tipo { width: 90px; text-align: center; }
.th-add, .td-add { width: 40px; text-align: center; }

.search-results-table td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.sr-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.sr-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.sr-thumb-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 1rem;
    border: 1px solid var(--color-border);
}

.td-nombre {
    font-weight: 500;
    color: var(--color-text-heading);
    line-height: 1.3;
}

.td-nombre small {
    font-weight: 400;
}

.td-add i {
    color: var(--color-esmeralda);
    font-size: 1rem;
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.td-add:hover i {
    color: var(--color-esmeralda);
    transform: scale(1.35);
}

/* ── PRODUCT RESULTS TABLE CELLS ───────────────────────── */
.product-results-table td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.image-cell {
    width: 56px;
    text-align: center;
}

.table-product-image {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.table-product-image:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.table-product-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    font-size: 1.1rem;
    border: 1px solid var(--color-border);
}

.name-cell {
    font-weight: 500;
    color: var(--color-text-heading);
}

.product-name {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: var(--font-size-sm);
}

.product-meta {
    font-size: var(--font-size-xs);
    color: var(--color-muted);
    margin-top: 2px;
}

.price-cell {
    font-weight: 600;
    color: var(--color-esmeralda);
    text-align: right;
    white-space: nowrap;
}

.type-cell {
    text-align: center;
}

.stock-cell {
    text-align: center;
    color: var(--color-muted);
    font-size: var(--font-size-xs);
}

.action-cell {
    text-align: center;
}

.btn-add-product {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: var(--color-esmeralda);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-product:hover {
    background: var(--color-esmeralda);
    color: white;
    border-color: var(--color-esmeralda);
    transform: scale(1.1);
}

/* ── SELECTED ROW ──────────────────────────────────────── */
.product-row.selected {
    background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary);
}

.product-row.selected td {
    border-bottom-color: var(--color-border);
}

/* ── EXPAND ROW FOR IMAGE PREVIEW ──────────────────────── */
.sr-expand-row td {
    padding: 0 !important;
    border-bottom: 2px solid var(--color-primary);
    animation: rowExpand 0.25s ease;
}

.sr-expand-content {
    padding: 0.75rem 1rem;
    text-align: center;
}

.sr-expand-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-muted);
}

.td-expand {
    text-align: center;
    padding: 0.5rem !important;
}

.sr-full-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    object-fit: contain;
    box-shadow: var(--shadow-md);
}

.sr-img-empty {
    padding: 1.5rem;
    color: var(--color-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px dashed var(--color-border);
}

.sr-img-empty i { font-size: 1.5rem; }

@keyframes rowExpand {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── PRODUCT TYPE BADGES (TABLE) ───────────────────────── */
.product-type-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.product-type-badge.badge-unitario {
    background: var(--color-info);
    color: white;
}

.product-type-badge.badge-paquete {
    background: var(--color-warning);
    color: white;
}

.product-type-badge.badge-servicio {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

/* ── RESPONSIVE TABLE ──────────────────────────────────── */
@media (max-width: 768px) {
    .search-results-table {
        font-size: var(--font-size-xs);
    }
    .sr-thumb {
        width: 32px;
        height: 32px;
    }
    .sr-thumb-placeholder {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    .th-stock, .td-stock { display: none; }
    .sr-full-img { max-height: 150px; }
}

/* ── CART ITEM IMAGE (CAROUSEL/EXPAND) ─────────────────── */
.cart-img-expand {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-align: center;
}

.cart-img-expand img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.cart-img-expand .img-preview-empty {
    padding: 1rem;
    color: var(--color-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.cart-img-expand .img-preview-empty i {
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .cart-item-image {
        width: 36px;
        height: 36px;
    }
    .cart-img-expand img {
        max-height: 150px;
    }
}