/* Layout Expandido 100% da Tela com Rolagem Suave */
.container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Layout Expandido da Tabela */
.table-escala {
    width: max-content !important;
    min-width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table-escala th, .table-escala td {
    text-align: center !important;
    vertical-align: middle !important;
    font-size: 0.78rem !important;
    padding: 2px !important;
    white-space: nowrap !important;
    border: 1px solid #dee2e6;
}

/* EFEITO ZEBRA EM TODA A EXTENSÃO DA LINHA */
.table-escala tbody tr:nth-child(even) td {
    background-color: #f1f5f9 !important;
}

.table-escala tbody tr:nth-child(odd) td {
    background-color: #ffffff !important;
}

.table-escala tbody tr:hover td {
    background-color: #e2e8f0 !important;
}

.cell-dia-escala {
    width: 120px !important;
    min-width: 120px !important;
}

/* =========================================================
   HIERARQUIA DE CONGELAMENTO DUPLO (TOPO E ESQUERDA)
   ========================================================= */

/* 1. Colunas fixas da esquerda (Corpo da Tabela) -> Camada 15 */
.col-sticky-1 {
    position: sticky !important;
    left: 0px !important;
    z-index: 15 !important;
    width: 130px !important;
    min-width: 130px !important;
}

.col-sticky-2 {
    position: sticky !important;
    left: 130px !important;
    z-index: 15 !important;
    width: 100px !important;
    min-width: 100px !important;
}

.col-sticky-3 {
    position: sticky !important;
    left: 230px !important;
    z-index: 15 !important;
    width: 120px !important;
    min-width: 120px !important;
    border-right: 3px solid #64748b !important;
}

/* Célula mesclada no rodapé (colspan="3") -> Camada 15 */
.col-sticky-merged {
    position: sticky !important;
    left: 0px !important;
    z-index: 15 !important;
    width: 350px !important;
    min-width: 350px !important;
    background-color: #f8fafc !important;
    border-right: 3px solid #64748b !important;
    text-align: right !important;
    padding-right: 12px !important;
}

/* 2. Cabeçalho Superior Móvel (Pelotões e Datas) -> Camada 10 (Passa por baixo de GUERRA) */
.table-escala thead tr.bg-header-pelotao th {
    position: sticky !important;
    top: 0 !important;
    height: 28px !important;
    background-color: #1e293b !important;
    color: #ffffff !important;
    font-weight: bold !important;
    z-index: 10 !important;
}

.table-escala thead tr.bg-header-data th {
    position: sticky !important;
    top: 28px !important; /* Encosta exatamente na linha de cima */
    height: 28px !important;
    background-color: #334155 !important;
    color: #ffffff !important;
    z-index: 10 !important;
}

/* 3. Canto Superior Esquerdo (FUNÇÃO/DIST., POSTO, GUERRA) -> Camada 25 (Topo Absoluto) */
.table-escala thead tr.bg-header-pelotao th.col-sticky-1,
.table-escala thead tr.bg-header-pelotao th.col-sticky-2,
.table-escala thead tr.bg-header-pelotao th.col-sticky-3 {
    position: sticky !important;
    top: 0 !important;
    background-color: #1e293b !important;
    color: #ffffff !important;
    z-index: 25 !important;
}

/* =========================================================
   CORES DAS SITUAÇÕES E ESTILIZAÇÃO DE CÉLULAS
   ========================================================= */
.escala-select {
    width: 100%;
    height: 28px;
    border: none;
    text-align: center;
    text-align-last: center;
    font-size: 0.78rem;
    cursor: pointer;
    outline: none;
}

.cell-expediente,
select.cell-expediente,
option.cell-expediente {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
    font-weight: bold !important;
}
.cell-rotam, select.cell-rotam { background-color: #334155 !important; color: #ef4444 !important; font-weight: bold; }
.cell-gtam, select.cell-gtam { background-color: #1e293b !important; color: #eab308 !important; font-weight: bold; }
.cell-inspecao, select.cell-inspecao { background-color: #1e293b !important; color: #38bdf8 !important; font-weight: bold; }
.cell-afastamento { background-color: #ffedd5 !important; color: #c2410c !important; font-weight: bold; height: 30px; display: flex; align-items: center; justify-content: center; }
.cell-curso { background-color: #f3e8ff !important; color: #7e22ce !important; font-weight: bold; height: 30px; display: flex; align-items: center; justify-content: center; }
.cell-folga, select.cell-folga { background-color: transparent !important; color: #000000 !important; }
.cell-folga option { background-color: #ffffff !important; color: #000000 !important; }

.legenda-box { padding: 5px 12px; border-radius: 4px; font-weight: bold; font-size: 0.8rem; display: inline-block; }

/* =========================================================
   DESTAQUE DE FIM DE SEMANA (SÁBADO E DOMINGO)
   ========================================================= */
.bg-header-pelotao th.col-weekend {
    background-color: #0f172a !important;
    color: #38bdf8 !important;
    border-left: 2px solid #0284c7 !important;
    border-right: 2px solid #0284c7 !important;
}

.bg-header-data th.col-weekend {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    font-weight: bold !important;
    border-left: 2px solid #0284c7 !important;
    border-right: 2px solid #0284c7 !important;
}

td.col-weekend {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
    border-left: 1px dashed #94a3b8 !important;
    border-right: 1px dashed #94a3b8 !important;
}

th.col-weekend-start, td.col-weekend-start {
    border-left: 2px solid #475569 !important;
}

th.col-weekend-end, td.col-weekend-end {
    border-right: 2px solid #475569 !important;
}

td.col-weekend .escala-select.cell-folga {
    background-color: transparent !important;
    color: #0f172a !important;
    font-weight: bold !important;
}

/* Ocultação forçada para o filtro de escalas */
.linha-oculta {
    display: none !important;
}