/**
 * Estilos para TableMastDetWeb - Vistas Maestro-Detalle
 */

/* Contenedor principal maestro-detalle */
.mastdet-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Sección maestro */
.mastdet-master-section {
    flex: 0 0 auto;
    max-height: 50vh;
    overflow: auto;
}

/* Sección detalle */
.mastdet-detail-section {
    flex: 1 1 auto;
    min-height: 300px;
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
}

/* Título de sección detalle */
.mastdet-detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
}

/* Grid del detalle */
.mastdet-detail-grid {
    height: calc(100% - 150px);
    min-height: 200px;
}

/* Sección de totales */
.mastdet-totals-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
}

.mastdet-totals-row {
    display: flex;
    justify-content: flex-end;
    gap: 30px;
    flex-wrap: wrap;
}

.mastdet-total-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mastdet-total-label {
    font-weight: 600;
    color: #495057;
}

.mastdet-total-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0d6efd;
    min-width: 120px;
    text-align: right;
}

.mastdet-total-value.total {
    color: #198754;
    font-size: 1.4rem;
}

/* Resaltado de fila seleccionada en el maestro */
.dataTables_wrapper tbody tr.selected {
    background-color: #0d6efd !important;
    color: white !important;
}

.dataTables_wrapper tbody tr.selected td {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0a58ca !important;
}

.dataTables_wrapper tbody tr.selected:hover {
    background-color: #0a58ca !important;
    color: white !important;
}

.dataTables_wrapper tbody tr.selected:hover td {
    background-color: #0a58ca !important;
    color: white !important;
}

/* Cursor pointer en filas del maestro */
.mastdet-master-section tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.mastdet-master-section tbody tr:hover:not(.selected) {
    background-color: #e9ecef;
}

/* Indicador de carga en detalle */
.mastdet-detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6c757d;
}

.mastdet-detail-loading .spinner-border {
    margin-right: 10px;
}

/* Estado vacío del detalle */
.mastdet-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6c757d;
    text-align: center;
}

.mastdet-detail-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .mastdet-container {
        gap: 15px;
    }
    
    .mastdet-master-section {
        max-height: 40vh;
    }
    
    .mastdet-totals-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .mastdet-total-item {
        justify-content: space-between;
    }
}

/* Mejoras para DataTables en modo maestro-detalle */
.mastdet-master-section .dataTables_wrapper .dataTables_scroll {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.mastdet-detail-section .dataTables_wrapper .dataTables_scroll {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* Botones de acción en detalle */
.mastdet-detail-actions {
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
}

/* Badge para indicar número de líneas */
.mastdet-lines-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #0d6efd;
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Lookup button alignment fixes for inline editor */
.inline-editor-body .input-group .find-button {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #495057;
    padding: 0.375rem 0.5rem;
    display: flex;
    align-items: center;
}

.inline-editor-body .input-group .find-button:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.inline-editor-body .input-group {
    flex-wrap: nowrap;
}

.inline-editor-body .input-group .form-control {
    min-width: 0;
}
