﻿/* Form Controls - Refined borders and spacing */
.form-control,
.form-select,
.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text,
.input-group > .btn {
    border: 1px solid #d1d5db !important;
    border-radius: 0.25rem !important;
    padding: 0.2rem 0.5rem !important;
    font-size: 0.75rem !important;
    line-height: 1.25 !important;
    transition: all 0.15s ease-in-out !important;
    height: auto !important;
    min-height: 1.85rem !important;
}

.input-group {
    min-height: 1.85rem !important;
}

.form-control-sm,
.form-select-sm {
    min-height: 1.7rem !important;
    height: auto !important;
    padding: 0.15rem 0.45rem !important;
    font-size: 0.73rem !important;
}

.form-control-xs,
.form-select-xs {
    min-height: 1.55rem !important;
    height: auto !important;
    padding: 0.12rem 0.4rem !important;
    font-size: 0.72rem !important;
}

textarea.form-control,
textarea.form-control-sm,
textarea.form-control-xs {
    height: auto !important;
    min-height: 2.6rem !important;
    padding: 0.25rem 0.45rem !important;
}


.form-select {
    background-color: #fcfcfd !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
}

.form-control:disabled,
.form-select:disabled,
.form-control[disabled],
.form-select[disabled] {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    opacity: 1 !important;
    color: #1e293b !important;
}

/* Fused Table Override for Grid Inputs - Zero margin / border inside grid cells */
.table-fused td {
    padding: 0 !important;
}

.table-fused .form-control,
.table-fused .form-select,
.table-fused .form-control-xs,
.table-fused .form-select-xs {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: 1.8rem !important;
    height: 100% !important;
    padding: 0.15rem 0.35rem !important;
    background-color: transparent !important;
}

.table-fused .form-control:focus,
.table-fused .form-select:focus,
.table-fused .form-control-xs:focus,
.table-fused .form-select-xs:focus {
    background-color: #ffffff !important;
    box-shadow: inset 0 0 0 1px #0ea5e9 !important;
    outline: none !important;
}

/* Form Labels - Refined typography */
.form-label {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin-bottom: 0.25rem !important;
    letter-spacing: 0.01em !important;
}

/* Input Groups - Tighter spacing */
.row.g-3 {
    --bs-gutter-y: 0.5rem !important;
    --bs-gutter-x: 0.625rem !important;
}

/* Switch Controls - Refined appearance */
.form-check-input {
    width: 2.5rem !important;
    height: 1.25rem !important;
    border: 1px solid #d1d5db !important;
    border-radius: 1rem !important;
    cursor: pointer !important;
}

.form-check-input:checked {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

.form-check-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.form-check-label {
    font-size: 0.8125rem !important;
    color: #6b7280 !important;
    margin-left: 0.5rem !important;
    cursor: pointer !important;
}

/* Modal Refinements */
.modal-header {
    padding: 1rem 1.25rem !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.modal-title {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
}

.modal-body {
    padding: 1.25rem !important;
}

.modal-footer {
    padding: 0.875rem 1.25rem !important;
    border-top: 1px solid #e5e7eb !important;
}

/* Buttons - Refined sizing */
.btn-xs {
    padding: 0.2rem 0.55rem !important;
    font-size: 0.72rem !important;
    border-radius: 0.25rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    min-height: 1.6rem !important;
}

.btn-sm {
    padding: 0.25rem 0.65rem !important;
    font-size: 0.76rem !important;
    border-radius: 0.25rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    min-height: 1.8rem !important;
}

.btn {
    padding: 0.35rem 0.85rem !important;
    font-size: 0.78rem !important;
    border-radius: 0.25rem !important;
    font-weight: 600 !important;
    transition: all 0.15s ease-in-out !important;
}

.btn-light {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

.btn-light:hover {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Alert Refinements */
.alert {
    border-radius: 0.4rem !important;
    border: 1px solid transparent !important;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.72rem !important;
    line-height: 1.3 !important;
}


.alert-warning {
    background-color: #fef3c7 !important;
    border-color: #fde68a !important;
    color: #92400e !important;
}

.alert-danger {
    background-color: #fee2e2 !important;
    border-color: #fecaca !important;
    color: #991b1b !important;
}

/* Small text refinement */
small.text-muted {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
    display: block !important;
    margin-top: 0.25rem !important;
}

/* Card refinements */
.card {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
}

.card-header {
    border-bottom: 1px solid #e5e7eb !important;
    background-color: #ffffff !important;
}

/* Badge refinements */
.badge {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    padding: 0.25rem 0.625rem !important;
    border-radius: 0.375rem !important;
}

/* Required field indicator */
.text-danger {
    color: #dc2626 !important;
}

/* Input validation states */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444 !important;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .form-control,
    .form-select {
        font-size: 0.855rem !important;
        min-height: 2.5rem !important;
    }

    .form-label {
        font-size: 0.84rem !important;
    }
}

/* ==========================================================================
   ALINEACIÓN INFERIOR DE FORMULARIOS DE CABECERA (ORDEN DE PAGO Y COMPROBANTES)
   ========================================================================== */
.header-form-row {
    align-items: flex-end !important;
}

.header-form-row > [class*="col-"] {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

.header-form-row .form-label {
    margin-bottom: 0.25rem !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
}

/* Homogeneizar altura exacta y alineación inferior de todos los controles de la fila */
.header-form-row .form-control-xs,
.header-form-row .form-select-xs,
.header-form-row .input-group-xs,
.header-form-row .input-group-xs > .form-control,
.header-form-row .input-group-xs > .btn,
.header-form-row .input-group-xs > .input-group-text {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    font-size: 0.73rem !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
}

.header-form-row .input-group-xs {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.header-form-row .input-group-xs > .btn {
    padding: 0 0.45rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ==========================================================================
   TABLAS CON ENCABEZADOS INMÓVILES (STICKY HEADERS)
   ========================================================================== */
.sticky-table-container {
    overflow-y: auto !important;
    overflow-x: auto !important;
    position: relative !important;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
}

.sticky-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100%;
}

.sticky-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    border-top: none !important;
    box-shadow: inset 0 -1px 0 #cbd5e1, 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.sticky-table tfoot td {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 9 !important;
    background-color: #f8fafc !important;
    border-top: 2px solid #cbd5e1 !important;
    box-shadow: inset 0 1px 0 #cbd5e1, 0 -1px 2px rgba(0, 0, 0, 0.05) !important;
}