/**
 * ===========================================================================
 * RENTTOOLS PRO - MODAL FIX FINAL
 * Corrección definitiva para modales transparentes/invisibles
 * PRIORIDAD MÁXIMA con selectores ultra-específicos
 * ===========================================================================
 */

/* ============================================
   RESET Y FORZAR OPACIDAD EN TODO
   QUITAR EL FONDO DEL .modal (viene de AdminLTE)
   ============================================ */
html body .modal,
html body .modal.fade,
html body .modal.in,
html body .modal.fade.in,
html body .modal.show,
.modal,
.modal.fade,
.modal.in {
    opacity: 1 !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* ============================================
   BACKDROP - Fondo oscuro semi-transparente
   ESTE es el único que debe tener fondo oscuro
   ============================================ */
html body .modal-backdrop,
html body .modal-backdrop.in,
html body .modal-backdrop.fade,
html body .modal-backdrop.fade.in,
html body .modal-backdrop.show,
.modal-backdrop,
.modal-backdrop.in,
.modal-backdrop.fade.in {
    background-color: rgba(0, 0, 0, 0.5) !important;
    background: rgba(0, 0, 0, 0.5) !important;
    opacity: 1 !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

/* ============================================
   MODAL CONTENT - FONDO BLANCO SÓLIDO
   ============================================ */
html body .modal-content,
html body .modal .modal-content,
html body .modal-dialog .modal-content,
html body div.modal-content,
.modal-content,
div.modal-content {
    background-color: #FFFFFF !important;
    background: #FFFFFF !important;
    opacity: 1 !important;
    border: 1px solid #E5E5EA !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

/* ============================================
   MODAL HEADER - GRADIENTE VISIBLE
   ============================================ */
html body .modal-header,
html body .modal .modal-header,
html body .modal-content .modal-header,
html body .modal-dialog .modal-content .modal-header,
.modal-header {
    background: linear-gradient(135deg, #5AC8FA 0%, #007AFF 100%) !important;
    background-color: #007AFF !important;
    padding: 18px 24px !important;
    border: none !important;
    border-bottom: none !important;
    border-radius: 16px 16px 0 0 !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* ============================================
   MODAL TITLE - TEXTO BLANCO
   ============================================ */
html body .modal-title,
html body .modal-header .modal-title,
html body .modal-header h4.modal-title,
html body .modal-header h4,
html body .modal-header h5,
html body h4.modal-title,
html body h5.modal-title,
.modal-title,
.modal-header .modal-title {
    color: #FFFFFF !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    opacity: 1 !important;
}

/* ============================================
   CLOSE BUTTON - VISIBLE EN BLANCO
   ============================================ */
html body .modal-header .close,
html body .modal-header button.close,
html body .modal-header .btn-close,
html body .modal-header button[data-dismiss="modal"],
html body .modal-header button[data-bs-dismiss="modal"],
.modal-header .close,
.modal-header button.close {
    color: #FFFFFF !important;
    opacity: 1 !important;
    text-shadow: none !important;
    font-size: 28px !important;
    font-weight: 300 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

html body .modal-header .close:hover,
html body .modal-header button.close:hover,
.modal-header .close:hover {
    color: #FFFFFF !important;
    opacity: 0.8 !important;
}

/* ============================================
   MODAL BODY - FONDO BLANCO SÓLIDO
   ============================================ */
html body .modal-body,
html body .modal .modal-body,
html body .modal-content .modal-body,
html body .modal-dialog .modal-content .modal-body,
.modal-body {
    background-color: #FFFFFF !important;
    background: #FFFFFF !important;
    color: #1D1D1F !important;
    padding: 24px !important;
    opacity: 1 !important;
}

/* ============================================
   FORM ELEMENTS INSIDE MODAL
   ============================================ */
html body .modal-body label,
html body .modal-body .form-group label,
html body .modal-body .control-label,
.modal-body label {
    color: #1D1D1F !important;
    font-weight: 600 !important;
    opacity: 1 !important;
}

html body .modal-body .form-control,
html body .modal-body input,
html body .modal-body select,
html body .modal-body textarea,
html body .modal-body input[type="text"],
html body .modal-body input[type="number"],
html body .modal-body input[type="email"],
html body .modal-body input[type="password"],
.modal-body .form-control,
.modal-body input,
.modal-body select,
.modal-body textarea {
    background-color: #FFFFFF !important;
    background: #FFFFFF !important;
    color: #1D1D1F !important;
    border: 2px solid #E5E5EA !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    opacity: 1 !important;
}

html body .modal-body .form-control:focus,
html body .modal-body input:focus,
html body .modal-body select:focus,
html body .modal-body textarea:focus,
.modal-body .form-control:focus,
.modal-body input:focus,
.modal-body select:focus {
    background-color: #FFFFFF !important;
    border-color: #007AFF !important;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2) !important;
    outline: none !important;
}

/* ============================================
   MODAL FOOTER - FONDO GRIS CLARO
   ============================================ */
html body .modal-footer,
html body .modal .modal-footer,
html body .modal-content .modal-footer,
html body .modal-dialog .modal-content .modal-footer,
.modal-footer {
    background-color: #F5F5F7 !important;
    background: #F5F5F7 !important;
    border-top: 1px solid #E5E5EA !important;
    padding: 16px 24px !important;
    opacity: 1 !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
}

/* ============================================
   BUTTONS IN MODAL
   ============================================ */
html body .modal-footer .btn,
html body .modal .modal-footer .btn,
.modal-footer .btn {
    border-radius: 10px !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    opacity: 1 !important;
}

html body .modal-footer .btn-primary,
.modal-footer .btn-primary {
    background: linear-gradient(135deg, #5AC8FA 0%, #007AFF 100%) !important;
    background-color: #007AFF !important;
    border: none !important;
    color: #FFFFFF !important;
}

html body .modal-footer .btn-default,
html body .modal-footer .btn-secondary,
.modal-footer .btn-default,
.modal-footer .btn-secondary {
    background-color: #E5E5EA !important;
    background: #E5E5EA !important;
    border: none !important;
    color: #636366 !important;
}

html body .modal-footer .btn-success,
.modal-footer .btn-success {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%) !important;
    background-color: #34C759 !important;
    border: none !important;
    color: #FFFFFF !important;
}

html body .modal-footer .btn-danger,
.modal-footer .btn-danger {
    background: linear-gradient(135deg, #FF3B30 0%, #FF2D55 100%) !important;
    background-color: #FF3B30 !important;
    border: none !important;
    color: #FFFFFF !important;
}

/* ============================================
   Z-INDEX HIERARCHY
   ============================================ */
html body .modal {
    z-index: 1050 !important;
}

html body .modal-backdrop {
    z-index: 1040 !important;
}

html body .modal-dialog {
    z-index: 1060 !important;
}

/* ============================================
   CHECKBOX AND RADIO LABELS
   ============================================ */
html body .modal-body .checkbox label,
html body .modal-body .radio label,
html body .modal-body .form-check-label,
.modal-body .checkbox label,
.modal-body .radio label {
    color: #1D1D1F !important;
    opacity: 1 !important;
}

/* ============================================
   SELECT2 INSIDE MODALS
   ============================================ */
html body .modal-body .select2-container .select2-selection,
.modal-body .select2-container .select2-selection {
    background-color: #FFFFFF !important;
    border: 2px solid #E5E5EA !important;
    border-radius: 10px !important;
    min-height: 44px !important;
}

html body .modal-body .select2-container--default .select2-selection--single .select2-selection__rendered,
.modal-body .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #1D1D1F !important;
    line-height: 44px !important;
}

/* ============================================
   FORCE TEXT VISIBILITY
   ============================================ */
html body .modal-body p,
html body .modal-body span,
html body .modal-body div,
html body .modal-body td,
html body .modal-body th,
.modal-body p,
.modal-body span {
    color: inherit !important;
    opacity: 1 !important;
}

/* ============================================
   HELP TEXT AND SMALL TEXT
   ============================================ */
html body .modal-body .help-block,
html body .modal-body small,
html body .modal-body .text-muted,
.modal-body .help-block,
.modal-body small,
.modal-body .text-muted {
    color: #8E8E93 !important;
    opacity: 1 !important;
}
