﻿/* =====================================================
   formvalidation.css (Theme-aware + limpio)
   ===================================================== */

/* Resultados de validación RFC */
.rfc-validation-result.oknt {
    background-color: var(--color-danger, #dc3545);
    color: var(--on-danger, #ffffff);
    font-weight: bold;
}

.rfc-validation-result.ok {
    background-color: var(--color-success, #198754);
    color: var(--on-success, #ffffff);
}

/* Caja de receptor */
.receiver-box {
    border: 1px solid var(--border-muted, #b9b9b9);
    border-radius: var(--radius-md, 15px);
    margin-top: 20px;
    padding: 10px;
    background-color: var(--surface-card, #ffffff);
    color: var(--surface-fg, #111827);
}

.btn-valk {
    margin-top: 10px;
}

.receiver-name {
    margin-top: 0;
}

/* Campos inválidos */
input[type="text"].invalid,
input.invalid,
select.invalid,
textarea.invalid {
    border-color: var(--color-danger, #b10845) !important;
}

/* Mensajes de error */
.error {
    color: var(--color-danger, #b10845);
}

/* Datepicker por encima de modales */
.ui-datepicker {
    z-index: 20000 !important;
}

/* Efecto flash para duplicados */
.flash-dup {
    animation: flashDup 1s ease-in-out 2;
}

@keyframes flashDup {
    0% {
        background-color: var(--danger-tint, #ffe6e6);
    }

    50% {
        background-color: var(--surface-card, #ffffff);
    }

    100% {
        background-color: var(--danger-tint, #ffe6e6);
    }
}

/*Modales con colores dinámicos del tema*/
body.valk-theme .modal-content {
    background-color: var(--surface-bg, #ffffff) !important;
    color: var(--surface-fg, #212529) !important;
}

body.valk-theme .modal-header {
    background-color: var(--color-primary, #ffffff) !important;
    color: var(--surface-fg, #212529) !important;
    border-bottom: 1px solid var(--surface-border, #dee2e6) !important;
}

body.valk-theme .modal-body {
    background-color: var(--surface-bg, #ffffff) !important;
    color: var(--surface-fg, #212529) !important;
}

body.valk-theme .modal-footer {
    background-color: var(--surface-bg, #ffffff) !important;
    color: var(--surface-fg, #212529) !important;
    border-top: 1px solid var(--surface-border, #dee2e6) !important;
}

body.valk-theme .modal-header.bg-success-custom {
    background-color: var(--color-success, #198754) !important;
    color: white !important;
}

body.valk-theme .modal-header.bg-primary-custom {
    background-color: var(--color-primary, #0d6efd) !important;
    color: white !important;
}

body.valk-theme .modal-header.bg-success-custom .modal-title,
body.valk-theme .modal-header.bg-primary-custom .modal-title {
    color: white !important;
}

/*Form controls dentro del modal*/
body.valk-theme .modal-body .form-control,
body.valk-theme .modal-body .form-select {
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--input-fg, #212529) !important;
    border: 1px solid var(--input-border, #ced4da) !important;
}

body.valk-theme .modal-body .form-label {
    color: var(--surface-fg, #212529) !important;
}

body.valk-theme .modal-body input[type="number"] {
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--input-fg, #212529) !important;
}

/*Toast de confirmación*/
#confirmToast {
    min-width: 350px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#confirmToast .toast-body {
    background: var(--surface-elevated-bg, #ffffff);
    color: var(--surface-fg, #212529);
}

#confirmToast .toast-header {
    background: var(--surface-elevated-bg, #ffffff);
    color: var(--surface-fg, #212529);
    border-bottom: 1px solid var(--surface-border, #dee2e6);
}

/*Barra de búsqueda*/
#searchDiv .input-group-text {
    background-color: var(--surface-elevated-bg, #e9ecef);
    border-color: var(--input-border, #ced4da);
    color: var(--surface-fg, #212529);
}

/*Icono de búsqueda*/
#searchDiv .input-group-text i {
    color: var(--color-primary) !important;
}

/*Inputs de búsqueda*/
#search-hint {
    color: var(--surface-fg, #6c757d) !important;
    opacity: 0.75;
}

/*resultados de búsqueda*/
.search-highlight {
    background-color: rgba(255, 193, 7, 0.3);
    padding: 0 2px;
    border-radius: 2px;
}

/*Contenedor de tabla*/
.table-container {
    max-height: calc(100vh - 350px);
    overflow: hidden;
    border: none;
    border-radius: 0;
}

.table-header {
    position: sticky;
    top: 0;
    background-color: transparent;
    border-bottom: 2px solid var(--surface-border, #dee2e6);
    z-index: 10;
}

.table-header .row {
    background-color: var(--surface-bg, #ffffff);
    color: var(--surface-fg, #212529);
    margin: 0;
}

.table-body {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--surface-bg, #f1f1f1) 70%, var(--surface-fg, #000) 30%) var(--surface-bg, #f1f1f1);
    background-color: var(--surface-bg, #ffffff);
}

.table-body .row {
    background-color: var(--surface-bg, #ffffff);
    color: var(--surface-fg, #212529);
    margin: 0;
}

.table-body .row:hover {
    background-color: color-mix(in srgb, var(--surface-bg, white) 85%, var(--surface-fg, #000) 15%) !important;
}

/* ========== Select2 Styling Completo - Bootstrap Integration ========== */

/* Contenedor principal */
.select2-container {
    width: 100% !important;
}

/* Selection box */
.select2-container--default .select2-selection--single,
body.valk-theme .select2-container--default .select2-selection--single,
.modal .select2-container--default .select2-selection--single {
    height: 34px !important;
    background-color: var(--surface-elevated-bg, #ffffff) !important;
    border: 1px solid var(--input-border, #ced4da) !important;
    border-radius: 16px !important;
    padding: 0.375rem 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    line-height: 1.5 !important;
}

/*Texto renderizado*/
.select2-container--default .select2-selection--single .select2-selection__rendered,
body.valk-theme .select2-container--default .select2-selection--single .select2-selection__rendered,
.modal .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--input-fg, #212529) !important;
    line-height: 1.5 !important;
    padding-left: 0 !important;
    padding-right: 30px !important;
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder,
body.valk-theme .select2-container--default .select2-selection--single .select2-selection__placeholder,
.modal .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--input-placeholder, #6c757d) !important;
}

/* Flecha */
.select2-container--default .select2-selection--single .select2-selection__arrow,
body.valk-theme .select2-container--default .select2-selection--single .select2-selection__arrow,
.modal .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
    top: 1px !important;
    right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b,
body.valk-theme .select2-container--default .select2-selection--single .select2-selection__arrow b,
.modal .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--input-fg, #212529) transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    left: 50% !important;
    margin-left: -4px !important;
    margin-top: -2px !important;
    position: absolute !important;
    top: 50% !important;
    width: 0 !important;
}

/* Focus state */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
body.valk-theme .select2-container--default.select2-container--focus .select2-selection--single,
body.valk-theme .select2-container--default.select2-container--open .select2-selection--single,
.modal .select2-container--default.select2-container--focus .select2-selection--single,
.modal .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--input-focus-border, #86b7fe) !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.25rem var(--input-focus-ring, rgba(13, 110, 253, 0.25)) !important;
}

/* Flecha cuando está abierto */
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
body.valk-theme .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
.modal .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--input-fg, #212529) transparent !important;
    border-width: 0 4px 5px 4px !important;
    margin-top: -7px !important;
}

/* Dropdown */
.select2-dropdown,
body.valk-theme .select2-dropdown,
.modal .select2-dropdown {
    background-color: var(--input-bg, #ffffff) !important;
    border: 1px solid var(--input-border, #ced4da) !important;
    border-radius: 0.375rem !important;
    color: var(--input-fg, #212529) !important;
}

/* Campo de búsqueda */
.select2-search--dropdown .select2-search__field,
body.valk-theme .select2-search--dropdown .select2-search__field,
.modal .select2-search--dropdown .select2-search__field {
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--input-fg, #212529) !important;
    border: 1px solid var(--input-border, #ced4da) !important;
    border-radius: 0.375rem !important;
    padding: 0.375rem 0.75rem !important;
}

/* Opciones del dropdown */
.select2-container--default .select2-results__option,
body.valk-theme .select2-container--default .select2-results__option,
.modal .select2-container--default .select2-results__option {
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--input-fg, #212529) !important;
    padding: 8px 12px !important;
}

/* Opción highlighted (hover) */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option[aria-selected],
body.valk-theme .select2-container--default .select2-results__option--highlighted[aria-selected],
.modal .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--color-primary, #0d6efd) !important;
    color: white !important;
}

/* Opción seleccionada */
.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option--selected,
body.valk-theme .select2-container--default .select2-results__option[aria-selected="true"],
.modal .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: color-mix(in srgb, var(--color-primary, #0d6efd) 20%, var(--input-bg, #ffffff) 80%) !important;
    color: var(--input-fg, #212529) !important;
}

/* Container de resultados */
.select2-results__options,
body.valk-theme .select2-results__options,
.modal .select2-results__options {
    background-color: var(--input-bg, #ffffff) !important;
}

/* Mensaje "No results" */
.select2-results__option--no-results,
body.valk-theme .select2-results__option--no-results,
.modal .select2-results__option--no-results {
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--input-fg, #212529) !important;
}

/* Botón de clear (X) si allowClear: true */
.select2-container--default .select2-selection--single .select2-selection__clear {
    color: var(--input-fg, #212529) !important;
    font-size: 1.2em !important;
    font-weight: bold !important;
    margin-right: 10px !important;
}

/* Para los botones*/
.table td button {
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.spinner-border-sm {
    width: 0.9rem;
    height: 0.9rem;
    border-width: 0.15em;
}

.btn-warning {
    color: #000;
}

.btn-warning:hover {
    color: #000;
    background-color: #ffc107;
    border-color: #ffc107;
}