/**
 * Ponte Bootstrap 3 -> Bootstrap 5.
 * Carregar DEPOIS de bootstrap.min.css (5.3). Cobre classes BS3 que ainda estão no
 * markup e que o BS5 não tem mais. Cada bloco pode ser removido quando o markup
 * correspondente for reescrito com as classes nativas do BS5 (indicadas em cada bloco).
 *
 * Checklist de regressão (manual):
 * 1) login.php / loginsc.php — login e "esqueci a senha" (modal)
 * 2) principal.php — menu, logout, expandir/recolher
 * 3) Uma guia (exame/consulta) — formulário, datepicker, tabelas, bootbox
 * 4) Um popup — layout
 * 5) modalAuditMens — abrir/fechar/enviar
 */

/* ---------- Grid: .row > * do BS5 força width:100% em filhos que não são colunas ---------- */
.row > .clearfix,
.row > br,
.row > script,
.row > input[type="hidden"] {
    width: auto;
    padding: 0;
}
/* col-md-13 (inexistente) usado no shell */
.col-md-13 { flex: 0 0 auto; width: 100%; }
/* BS3 col-*-push/pull -> order-* no BS5 */

/* ---------- Botões (BS5: btn-outline-secondary / btn-sm / w-100) ---------- */
.btn-default {
    --bs-btn-color: #333;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #ccc;
    --bs-btn-hover-color: #333;
    --bs-btn-hover-bg: #e6e6e6;
    --bs-btn-hover-border-color: #adadad;
    --bs-btn-active-color: #333;
    --bs-btn-active-bg: #e6e6e6;
    --bs-btn-active-border-color: #adadad;
    --bs-btn-disabled-color: #333;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: #ccc;
}
.btn-xs {
    --bs-btn-padding-y: 1px;
    --bs-btn-padding-x: 5px;
    --bs-btn-font-size: 12px;
    --bs-btn-border-radius: 3px;
    line-height: 1.5;
}
.btn-block { display: block; width: 100%; }
.btn-block + .btn-block { margin-top: 5px; }
/* botão que usa btn-group-sm como tamanho (uso incorreto, mas frequente) */
.btn.btn-group-sm {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-font-size: 0.875rem;
}

/* ---------- Formulários (BS5: mb-3 / form-label / form-text / form-select) ---------- */
.form-group { margin-bottom: 1rem; }
.form-group-sm .form-control { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
.control-label { display: inline-block; margin-bottom: 0.25rem; }
.form-horizontal .control-label { padding-top: 7px; text-align: right; }
.radio label, .checkbox label, label.radio-inline, label.checkbox-inline { font-weight: 400; }
.radio, .checkbox { position: relative; display: block; margin: 10px 0; }
.radio-inline, .checkbox-inline { display: inline-block; margin-right: 10px; font-weight: 400; }
.help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #737373; font-size: 0.875em; }
/* BS5 tira a seta de <select class="form-control">; volta a seta nativa */
select.form-control {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: auto;
}
select.form-control[multiple], select.form-control[size] { appearance: none; }
.form-inline { display: flex; flex-flow: row wrap; align-items: center; gap: 0.5rem; }
.form-inline .form-group { margin-bottom: 0; display: flex; align-items: center; gap: 0.25rem; }
.form-inline .form-control { display: inline-block; width: auto; }
.has-error .form-control { border-color: var(--bs-danger); }
.has-error .help-block, .has-error .control-label { color: var(--bs-danger); }
.has-success .form-control { border-color: var(--bs-success); }

/* input-group BS3 (BS5: input-group-text, sem wrapper .input-group-btn) */
.input-group-addon {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--bs-body-color);
    text-align: center;
    white-space: nowrap;
    background-color: var(--bs-tertiary-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}
.input-group-btn { display: flex; }
.input-group-btn > .btn { position: relative; z-index: 2; height: 100%; }
.input-group > .input-group-addon:not(:last-child),
.input-group > .input-group-btn:not(:last-child) > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-addon:not(:first-child),
.input-group > .input-group-btn:not(:first-child) > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }

/* ---------- Alertas (BS5: btn-close dentro de .alert-dismissible) ---------- */
.alert-dismissable { padding-right: 3rem; position: relative; }
.close {
    float: right;
    padding: 0;
    font-size: 1.3125rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.4;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.close:hover, .close:focus { opacity: 0.7; color: #000; text-decoration: none; }
.alert-dismissible .close,
.alert-dismissable .close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 0.9rem 1rem;
}
/* "fade" sem "in/show" deixado por markup antigo em alertas estáticos */
.alert.fade:not(.show):not(.alert-dismissible) { opacity: 1; }

/* ---------- Well (BS5: card card-body bg-body-tertiary) ---------- */
.well {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
.well-sm { padding: 9px; border-radius: 3px; }
.well-lg { padding: 24px; border-radius: 6px; }

/* ---------- Panel (BS5: card / card-header / card-body / card-footer) ---------- */
.panel {
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.panel-heading { padding: 10px 15px; border-bottom: 1px solid #ddd; background-color: #f5f5f5; border-top-left-radius: 3px; border-top-right-radius: 3px; }
.panel-title { margin: 0; font-size: 16px; }
.panel-body { padding: 15px; }
.panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #ddd; }
.panel-primary { border-color: var(--bs-primary); }
.panel-primary > .panel-heading { color: #fff; background-color: var(--bs-primary); border-color: var(--bs-primary); }
.panel-group .panel { margin-bottom: 0; }
.panel-group .panel + .panel { margin-top: 5px; }

/* ---------- Labels / badges (BS5: badge text-bg-*) ---------- */
.label {
    display: inline;
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
    background-color: #777;
}
.label-primary { background-color: var(--bs-primary); }
.label-success { background-color: var(--bs-success); }
.label-info { background-color: var(--bs-info); }
.label-warning { background-color: var(--bs-warning); }
.label-danger { background-color: var(--bs-danger); }
/* badge sem cor no BS5 fica transparente; BS3/BS4 tinham fundo cinza */
.badge:not([class*="bg-"]):not([class*="text-bg-"]):not([class*="badge-"]) { background-color: #777; }
.badge-pill { border-radius: 10rem; }
.badge-primary { background-color: var(--bs-primary); }
.badge-secondary { background-color: var(--bs-secondary); }
.badge-success { background-color: var(--bs-success); }
.badge-danger { background-color: var(--bs-danger); }
.badge-warning { background-color: var(--bs-warning); color: #000; }
.badge-info { background-color: var(--bs-info); color: #000; }
.badge-dark { background-color: var(--bs-dark); }

/* ---------- Utilitários BS3 (BS5: float-start/end, text-start/end, d-none, img-fluid, visually-hidden) ---------- */
.pull-right { float: right !important; }
.pull-left { float: left !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.hidden { display: none !important; }
.hide { display: none !important; } /* BS3: o código troca a classe (ex.: #wait em Lotes de Guias) */
.show-inline { display: inline !important; }
.center-block { display: block; margin-left: auto; margin-right: auto; }
.img-responsive { display: block; max-width: 100%; height: auto; }
.img-circle { border-radius: 50%; }
.img-rounded { border-radius: 6px; }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}
.dropdown-toggle .caret { display: none; } /* o BS5 já desenha a seta em ::after */

/* ---------- Tabelas (BS5: table-sm) ---------- */
.table-condensed > :not(caption) > * > * { padding: 0.25rem 0.25rem; }

/* ---------- Dropdown com markup BS3 (li > a, sem .dropdown-item) ---------- */
.dropdown-menu > li > a {
    display: block;
    padding: 0.25rem 1rem;
    clear: both;
    color: var(--bs-body-color);
    white-space: nowrap;
    text-decoration: none;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus { background-color: var(--bs-tertiary-bg); }
.dropdown-menu > .divider { height: 1px; margin: 0.5rem 0; overflow: hidden; background-color: var(--bs-border-color); }
.dropdown-menu-right { right: 0; left: auto; }

/* ---------- Nav com markup BS3 (li.active > a) ---------- */
/* BS3: .nav sem modificador era lista vertical; no BS5 .nav é flex em linha */
.nav:not(.nav-tabs):not(.nav-pills):not(.navbar-nav):not(.flex-row) { flex-direction: column; flex-wrap: nowrap; }
.nav > li > a { display: block; padding: 0.5rem 1rem; text-decoration: none; }
.nav-tabs > li > a { margin-bottom: -1px; border: 1px solid transparent; border-radius: 4px 4px 0 0; }
.nav-tabs > li.active > a,
.nav-tabs > li > a.active { color: #555; background-color: #fff; border-color: #ddd #ddd transparent; }
.nav-pills > li.active > a { color: #fff; background-color: var(--bs-primary); border-radius: 4px; }
.navbar-default { background-color: #f8f8f8; border: 1px solid #e7e7e7; }

/* ---------- Modal com markup BS3 ---------- */
/* BS3: botão fechar ANTES do título; no BS5 o header é flex — joga o X para a direita */
.modal-header .close { order: 2; margin-left: auto; }
.modal-header .modal-title { order: 1; }
.modal-lg { --bs-modal-width: 900px; }

/* ---------- Glyphicons que restarem -> Font Awesome 4 (já carregado no shell) ---------- */
.glyphicon {
    display: inline-block;
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
}
.glyphicon-search:before { content: "\f002"; }
.glyphicon-download:before, .glyphicon-download-alt:before { content: "\f019"; }
.glyphicon-floppy-disk:before, .glyphicon-save:before { content: "\f0c7"; }
.glyphicon-plus-sign:before { content: "\f055"; }
.glyphicon-plus:before { content: "\f067"; }
.glyphicon-minus:before { content: "\f068"; }
.glyphicon-th:before { content: "\f00a"; }
.glyphicon-remove-circle:before { content: "\f05c"; }
.glyphicon-remove:before { content: "\f00d"; }
.glyphicon-ok:before, .glyphicon-check:before { content: "\f00c"; }
.glyphicon-paperclip:before { content: "\f0c6"; }
.glyphicon-hand-up:before { content: "\f0a6"; }
.glyphicon-trash:before { content: "\f1f8"; }
.glyphicon-print:before { content: "\f02f"; }
.glyphicon-upload:before { content: "\f093"; }
.glyphicon-info-sign:before { content: "\f05a"; }
.glyphicon-warning-sign:before { content: "\f071"; }
.glyphicon-exclamation-sign:before { content: "\f06a"; }
.glyphicon-question-sign:before { content: "\f059"; }
.glyphicon-file:before { content: "\f15b"; }
.glyphicon-open-file:before, .glyphicon-folder-open:before { content: "\f07c"; }
.glyphicon-credit-card:before { content: "\f09d"; }
.glyphicon-ban-circle:before { content: "\f05e"; }
.glyphicon-hourglass:before { content: "\f254"; }
.glyphicon-refresh:before { content: "\f021"; }
.glyphicon-circle-arrow-left:before { content: "\f0a8"; }
.glyphicon-circle-arrow-right:before { content: "\f0a9"; }
.glyphicon-circle-arrow-down:before { content: "\f0ab"; }
.glyphicon-circle-arrow-up:before { content: "\f0aa"; }
.glyphicon-list:before { content: "\f03a"; }
.glyphicon-list-alt:before { content: "\f022"; }
.glyphicon-edit:before { content: "\f044"; }
.glyphicon-pencil:before { content: "\f040"; }
.glyphicon-cog:before { content: "\f013"; }
.glyphicon-chevron-up:before { content: "\f077"; }
.glyphicon-chevron-down:before { content: "\f078"; }
.glyphicon-chevron-left:before { content: "\f053"; }
.glyphicon-chevron-right:before { content: "\f054"; }
.glyphicon-zoom-in:before { content: "\f00e"; }
.glyphicon-share:before { content: "\f064"; }
.glyphicon-send:before { content: "\f1d8"; }
.glyphicon-lock:before { content: "\f023"; }
.glyphicon-globe:before { content: "\f0ac"; }
.glyphicon-filter:before { content: "\f0b0"; }
.glyphicon-eye-open:before { content: "\f06e"; }
.glyphicon-eye-close:before { content: "\f070"; }
.glyphicon-envelope:before { content: "\f0e0"; }
.glyphicon-comment:before { content: "\f075"; }
.glyphicon-calendar:before { content: "\f073"; }
.glyphicon-user:before { content: "\f007"; }
.glyphicon-home:before { content: "\f015"; }
.glyphicon-off:before { content: "\f011"; }
.glyphicon-time:before { content: "\f017"; }
.glyphicon-arrow-left:before { content: "\f060"; }
.glyphicon-ok-circle:before { content: "\f05d"; }
.glyphicon-paste:before { content: "\f0ea"; }
.glyphicon-refresh-animate { animation: bs3-spin 0.7s infinite linear; }
@keyframes bs3-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- bootstrap-datepicker dentro de modal/tabela ---------- */
.datepicker.dropdown-menu { z-index: 3000 !important; }

/* ---------- Offcanvas antigo do shell ---------- */
.row-offcanvas { position: relative; }
.sidebar-offcanvas { width: 100%; }
.layout-expanded .container-fluid { width: 100%; }
