/* ==========================================================================
   QBX System-Wide Modern Modal & Zero Scrollbar-Flash Layer
   ========================================================================== */

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

html.qbx-modal-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

body.modal-open,
body.qbx-modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

body.modal-open .navbar-fixed-top,
body.modal-open .navbar-fixed-bottom,
body.qbx-modal-open .navbar-fixed-top,
body.qbx-modal-open .navbar-fixed-bottom {
    padding-right: 0 !important;
    right: 0 !important;
}

/* Native Bootstrap 3 modal polish */
.modal-backdrop {
    background-color: #0f172a;
}

.modal-backdrop.in {
    opacity: 0.52;
    filter: alpha(opacity=52);
}

.modal.fade .modal-dialog {
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
    transform: translate(0, -10px) scale(0.98);
}

.modal.in .modal-dialog {
    transform: translate(0, 0) scale(1);
}

.modal-content {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
    overflow: hidden;
}

.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 18px;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.modal-body {
    padding: 18px;
    color: #1e293b;
    font-size: 13.5px;
    line-height: 1.55;
}

.modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 18px;
}

/* Modern QBX System Dialog (.qbx-sys-modal-*) */
.qbx-sys-modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10050;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.qbx-sys-modal-backdrop.is-visible {
    opacity: 1;
}

.qbx-sys-modal-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
    overflow: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.qbx-sys-modal-backdrop.is-visible .qbx-sys-modal-card {
    transform: translateY(0) scale(1);
}

.qbx-sys-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.qbx-sys-modal-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.qbx-sys-modal-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.qbx-sys-modal-icon--info    { background: #e8f1fb; color: #1e5a99; }
.qbx-sys-modal-icon--confirm { background: #e8f1fb; color: #1e5a99; }
.qbx-sys-modal-icon--warning { background: #fef3c7; color: #b45309; }
.qbx-sys-modal-icon--danger  { background: #fee2e2; color: #b91c1c; }
.qbx-sys-modal-icon--success { background: #dcfce7; color: #15803d; }

.qbx-sys-modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.qbx-sys-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.qbx-sys-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.qbx-sys-modal-body {
    padding: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    word-break: break-word;
}

.qbx-sys-modal-prompt-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.qbx-sys-modal-input {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13.5px;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.qbx-sys-modal-input:focus {
    border-color: #1e5a99;
    box-shadow: 0 0 0 3px rgba(30, 90, 153, 0.14);
}

.qbx-sys-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.qbx-sys-modal-footer .btn {
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
}

.qbx-sys-modal-btn-primary {
    background: #1e5a99;
    border-color: #16467a;
    color: #ffffff;
}

.qbx-sys-modal-btn-primary:hover,
.qbx-sys-modal-btn-primary:focus {
    background: #17487c;
    border-color: #123a65;
    color: #ffffff;
}
