/******************************************* Variáveis **************************************************/
.table {
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075) !important;
}

/************************************************* Base *************************************************/
html,
body {
    width: 100%;
    height: 100%;
    padding: 0px;
    margin: 0px;
}

a,
tr,
td,
li,
button,
i {
    cursor: pointer;
}

textarea {
    resize: none;
}

textarea.campo-texto-amplo {
    min-height: 6rem;
}

/************************************************ Styles ************************************************/
.principal {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: hidden;
    padding-bottom: 3rem;
}

.window {
    margin-top: 0;
    padding: .25rem;
    width: 100%;
    max-height: -webkit-fill-available;
    height: -webkit-fill-available;
}

.janela {
    max-height: 100%;
    height: 100%;
    display: grid;
    gap: .25rem;
    align-content: stretch;
}

/* Divisões nas células da tabela (cor consistente com o cabeçalho) */
.lista tbody td {
    border-color: rgba(255, 255, 255, 0.2);
    border-width: 0 1px;
    padding: .25rem .5rem;
}

/* Tema claro: borda mais discreta para melhor contraste */
html[data-bs-theme="light"] .lista tbody td {
    border-color: rgba(0, 0, 0, 0.15);
}

/* Divisões em todas as colunas do cabeçalho */
.lista thead th {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Tema claro: cabeçalho com a mesma cor do corpo */
html[data-bs-theme="light"] .lista thead th {
    border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.lista thead th:last-child {
    border-right: none;
}

.lista tbody td:first-child {
    border-left-width: 0;
}

.lista tbody td:last-child {
    border-right-width: 0;
}

/* Destaque para a coluna de Status nas listas */
/* Anel (borda) ao redor da bola de status */
.lista tbody td.status-col .status-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lista tbody td.status-col .status-icon i {
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.lista tbody td.status-col .status-icon::after {
    content: "";
    position: absolute;
    width: 1.05em;
    height: 1.05em;
    border: 2px solid rgba(0, 0, 0, 0.55);
    /* cor da borda do anel */
    border-radius: 50%;
    box-sizing: border-box;
}

.lista tbody td.status-col .badge-status {
    font-weight: 700;
    letter-spacing: .5px;
}

.lista>thead>tr>th:has(i.bi-plus-lg) {
    border-left: 1px solid lightgray;
    text-align: center;
}

.table .selecionado td {
    background-color: #1f4f95 !important;
}

.scroll {
    overflow-y: auto;
    white-space: nowrap;
}

td.text-truncate {
    max-width: 0;
}

.autorizacao-linha-extra .form-group>label {
    min-height: 2.5rem;
    display: flex;
    align-items: flex-end;
}

.autorizacao-aprovacao-switch {
    min-height: calc(1.5em + .75rem + 2px);
    padding-left: 0;
    gap: .25rem;
}

.autorizacao-aprovacao-grupo {
    padding-top: 2.5rem;
}

.autorizacao-aprovacao-switch .form-check-label {
    line-height: 1.2;
    white-space: nowrap;
}

.autorizacao-aprovacao-switch .form-check-label .bi {
    margin-right: .15rem;
}

/************************************************* Alterações *************************************************/
.card-header>i,
.offcanvas-body i.bi,
.navbar i.bi {
    margin-right: .5rem;
}

.nav {
    z-index: 1021;
}

.offcanvas-body a {
    text-decoration: none;
    color: var(--bs-heading-color);
}

.janela>.card>.card-body {
    padding: 0px;
    overflow-y: auto;
    height: 100px;
}

ul.dropdown-menu {
    z-index: 2000;
}

.bootbox.secondary {
    z-index: 1056;
}

.bootbox.secondary+.modal-backdrop {
    z-index: 1055;
    opacity: 0.75 !important;
}

.bootbox.secondary .modal-content {
    color: #fff !important;
    background-color: RGBA(108, 117, 125, var(--bs-bg-opacity, 1)) !important;
}

.bootbox.p-0 .modal-body {
    padding: 0px;
}

.bootbox.p-1 .modal-body {
    padding: .25rem;
}

.bootbox.p-2 .modal-body {
    padding: .5rem;
}

.bootbox.p-3 .modal-body {
    padding: .75rem;
}

.bootbox.p-4 .modal-body {
    padding: 1rem;
}

.bootbox.p-5 .modal-body {
    padding: 1.25rem;
}

.bootbox.pdf .modal-dialog {
    height: 80% !important;
}

.bootbox.pdf .modal-content {
    height: 100% !important;
}

.bootbox.pdf .modal-body {
    padding: 0px;
}

.bootbox.pdf .bootbox-body {
    height: 100% !important;
}

/************************************************* Diversos *************************************************/
.col-minima {
    width: 10px !important;
    white-space: nowrap;
}

.preSelect {
    width: 136px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

input.sem-seletor::-webkit-calendar-picker-indicator,
input.sem-seletor::-webkit-inner-spin-button {
    display: none;
}

input.sem-seletor {
    appearance: textfield;
    -moz-appearance: textfield;
}

/******************************************** Select2 Dark theme **************************************************/

/* Select 2 bootstrap-5 theme override */
html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    background-color: transparent !important;
    border: 1px solid #495057;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: #dee2e6 !important;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
    color: #dee2e6 !important;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
    border: 1px solid var(--bs-gray-600);
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    color: #dee2e6 !important;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    background-color: transparent !important;
    color: #dee2e6 !important;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown {
    color: #dee2e6 !important;
    border: 1px solid #495057 !important;
    background-color: var(--bs-body-bg);
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[role=group] .select2-results__group {
    color: var(--bs-secondary-color) !important;
}

/******************************************** Ajustes de largura **************************************************/
form>div:has(.parent-100) {
    width: 100% !important;
}

form>div:has(.parent-75) {
    width: calc(75% - 0.25rem) !important;
}

form>div:has(.parent-50) {
    width: calc(50% - 0.25rem) !important;
}

form>div:has(.parent-25) {
    width: calc(25% - 0.25rem) !important;
}

/* Removido: form>div:has(.d-none) - Este seletor era muito genérico e ocultava rows inteiras
   Se necessário esconder elementos, usar .d-none diretamente no elemento */

/************************************************ DatePicker ************************************************/
.datepicker table tr td.range,
.datepicker table tr td.range:hover,
.datepicker table tr td.range.disabled,
.datepicker table tr td.range.disabled:hover,
.datepicker table tr td.day:hover,
.datepicker table tr td.day.focused,
.datepicker table tr td span:hover,
.datepicker table tr td span.focused,
.datepicker .datepicker-switch:hover,
.datepicker .prev:hover,
.datepicker .next:hover,
.datepicker tfoot tr th:hover {
    color: black;
}

/* Estilos para preservar formatação de observações */
#observacoes_saida_texto {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.observacoes-formatadas {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

/************************************************ Footer de Sugestões ************************************************/
.footer-sugestoes {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(13, 110, 253, 0.1);
    border-top: 1px solid rgba(13, 110, 253, 0.3);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: 0.75rem;
    padding: 0.25rem 0.75rem;
    z-index: 1000;
    text-align: center;
    margin: 0;
}

.footer-usuario-logado {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    grid-column: 1;
    justify-self: start;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-usuario-logado span,
.footer-ultimo-acesso span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-usuario-logado i,
.footer-ultimo-acesso i {
    flex: 0 0 auto;
}

.footer-usuario-nome {
    min-width: 0;
}

.footer-ultimo-acesso {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    grid-column: 2;
    justify-self: end;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/************************************************ Reservas ************************************************/
.reserva-header-acoes {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.reserva-header-acoes-com-solicitacao {
    min-width: min(38rem, 62vw);
    justify-content: space-between;
    gap: 2rem;
}

.reserva-solicitacoes-icone {
    font-size: 1rem;
}

.reserva-legenda-cores {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    line-height: 1.2;
}

.reserva-legenda-titulo {
    color: var(--bs-secondary-color);
    font-weight: 600;
}

.reserva-legenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.reserva-legenda-cor {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    display: inline-block;
}

.reserva-legenda-ativa {
    background-color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
}

.reserva-legenda-autorizada {
    background-color: #198754;
}

.reserva-legenda-pendente {
    background-color: #ffc107;
}

.reserva-legenda-cancelada {
    background-color: #dc3545;
}

@media (max-width: 767.98px) {
    .principal {
        padding-bottom: 3rem;
    }

    .footer-sugestoes {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        font-size: 0.75rem;
    }

    .footer-usuario-logado {
        grid-column: 1;
        justify-self: start;
        max-width: 100%;
    }

    .footer-ultimo-acesso {
        grid-column: 2;
        justify-self: end;
        max-width: 100%;
    }

    .reserva-header-acoes {
        float: none !important;
        display: flex;
        justify-content: flex-start;
        gap: 0.75rem;
        margin-top: 0.35rem;
        width: 100%;
    }

    .reserva-header-acoes-com-solicitacao {
        min-width: 0;
    }

    .autorizacao-linha-extra .form-group>label {
        min-height: 0;
    }

    .autorizacao-aprovacao-grupo {
        padding-top: 0;
    }
}
