/* ====================== */
/* ESTILOS GENERALES MEJORADOS */
/* ====================== */

form {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fafafa;
}

#contenedor_carga,
#contenedor_carga_modal {
    display: none;
}

/* ====================== */
/* TABLA DE PRODUCTOS - CORREGIDA */
/* ====================== */

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
    table-layout: fixed;
}

.table th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
    vertical-align: middle;
    text-align: center;
    font-size: 13px;
}

.table td {
    padding: 8px;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

/* Columnas específicas con anchos fijos */
.table th:nth-child(1),
/* Producto */
.table td:nth-child(1) {
    width: 30%;
    text-align: left;
    padding-left: 12px;
}

.table th:nth-child(2),
/* Cantidad */
.table td:nth-child(2) {
    width: 8%;
}

.table th:nth-child(3),
/* Precio */
.table td:nth-child(3) {
    width: 10%;
}

.table th:nth-child(4),
/* Total */
.table td:nth-child(4) {
    width: 10%;
}

.table th:nth-child(5),
/* Serie */
.table td:nth-child(5) {
    width: 15%;
}

.table th:nth-child(6),
/* MAC */
.table td:nth-child(6) {
    width: 15%;
}

.table th:nth-child(7),
/* Hidden */
.table td:nth-child(7) {
    width: 2%;
    padding: 0;
    border: none;
}

.table th:nth-child(8),
/* Acción */
.table td:nth-child(8) {
    width: 10%;
}

/* Ocultar completamente la columna hidden */
.table td:nth-child(7),
.table th:nth-child(7) {
    display: none;
}

/* Estilo para filas */
.table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table tr:hover {
    background-color: #e9ecef;
    transition: background-color 0.2s ease;
}

/* ====================== */
/* CELDAS Y CONTENIDO DE TABLA */
/* ====================== */

/* Select de productos */
.table td .select2-container {
    width: 100% !important;
}

.table td .select2-selection {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    height: 38px;
    display: flex;
    align-items: center;
}

/* Inputs dentro de la tabla */
.table input.form-control {
    width: 100%;
    height: 38px;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    text-align: center;
}

/* Inputs de precio y cantidad */
.table input[type="number"] {
    text-align: center;
}

/* Total */
.table .total {
    font-weight: 600;
    color: #28a745;
    font-size: 16px;
    display: block;
    padding: 8px 0;
}

/* Botón de eliminar */
.table .btn-danger {
    width: 100%;
    white-space: nowrap;
    padding: 0.375rem 0.75rem;
    font-size: 13px;
}

/* ====================== */
/* SELECT2 PERSONALIZADO PARA TABLA */
/* ====================== */

.select2-container--bootstrap4 {
    width: 100% !important;
}

.select2-container--bootstrap4 .select2-selection--single {
    height: 38px;
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background-color: #fff;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: 24px;
    padding-left: 0;
    padding-right: 24px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 6px;
}

.select2-container--bootstrap4 .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 9999 !important;
}

.select2-container--bootstrap4 .select2-results__option {
    padding: 8px 12px;
    font-size: 13px;
}

.select2-container--bootstrap4 .select2-results__option--highlighted {
    background-color: #007bff !important;
    color: white !important;
}

/* ====================== */
/* FORMULARIOS Y CONTROLES */
/* ====================== */

.form-control {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    height: 38px;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control:disabled {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 14px;
}

.form-select {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    height: 38px;
}

/* ====================== */
/* MÉTODOS DE PAGO */
/* ====================== */

.payment-method {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.payment-method-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.payment-method-header h5 {
    margin: 0;
    font-size: 16px;
    color: #495057;
}

.remove-payment {
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.remove-payment:hover {
    color: #bd2130;
}

/* ====================== */
/* BOTONES MEJORADOS */
/* ====================== */

.btn {
    padding: 0.5rem 1rem;
    font-size: 14px;
    border-radius: 0.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ====================== */
/* CAMPOS DE TOTALES */
/* ====================== */

.total-display {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.total-display strong {
    font-size: 18px;
    color: #495057;
}

#grand_total,
#total_pagado,
#restante_pagar {
    font-size: 20px;
    color: #007bff;
    font-weight: 600;
}

/* ====================== */
/* RESPONSIVIDAD PARA TABLA */
/* ====================== */

@media (max-width: 1200px) {

    .table th,
    .table td {
        padding: 6px;
        font-size: 12px;
    }

    .table .btn-danger {
        font-size: 12px;
        padding: 0.25rem 0.5rem;
    }

    .table .total {
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 900px;
        /* Ancho mínimo para evitar compresión */
    }

    .table th,
    .table td {
        white-space: nowrap;
    }
}

/* ====================== */
/* ESTILOS PARA ESTADOS DESHABILITADOS */
/* ====================== */

.form-control:disabled,
.form-select:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 1;
}


/* ====================== */
/* ESTILOS PARA EL BOTÓN AGREGAR PRODUCTO */
/* ====================== */

#add_product {
    margin-top: 10px;
    margin-bottom: 20px;
}

/* ====================== */
/* AJUSTES FINOS DE ALINEACIÓN */
/* ====================== */

.table td:first-child {
    text-align: left;
}

.table td:not(:first-child):not(:last-child) {
    text-align: center;
}

.table td:last-child {
    text-align: center;
}

/* Asegurar que todos los elementos dentro de las celdas estén centrados verticalmente */
.table td>* {
    vertical-align: middle;
}

/* ====================== */
/* ESTILOS PARA LOS INPUTS DE SERIE Y MAC */
/* ====================== */

.serial.form-control,
.mac.form-control {
    text-align: center;
    font-family: monospace;
    font-size: 13px;
}

/* ====================== */
/* ESTILOS PARA EL TOTAL EN TABLA */
/* ====================== */

.total {
    font-weight: 600;
    color: #28a745;
    background-color: #f8fff9;
    padding: 8px 4px;
    border-radius: 4px;
    display: block;
    min-height: 38px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Agregar al archivo CSS existente */
.autocomplete-client-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
}

.autocomplete-client-list li:hover {
    background-color: #f8f9fa;
    border-left: 3px solid #0d6efd;
}

.autocomplete-results {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.spinner-border {
    width: 1rem;
    height: 1rem;
}