/* ========================= */
/* RESET GLOBAL */
/* ========================= */

html, body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0b2b57;
    font-family: Arial, sans-serif;
}

#_dash-app-content {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* ========================= */
/* VARIÁVEIS GERAIS */
/* ========================= */

:root {
    --sidebar-width: 25vw;
    --sidebar-min: 380px;
    --sidebar-max: 520px;

    --sidebar-bg: #0b2b57;
    --content-bg: #ffffff;
    --text-light: #ffffff;
    --text-dark: #0b2b57;
    --text-active: #b30000;
    --border-light: rgba(255, 255, 255, 0.25);
    --submenu-bg: rgba(255, 255, 255, 0.04);
    --button-bg: rgba(255, 255, 255, 0.06);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.20);
}

/* ========================= */
/* LAYOUT PRINCIPAL */
/* ========================= */

.app-root {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* ========================= */
/* SIDEBAR FIXA */
/* ========================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;

    width: clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max));
    min-width: var(--sidebar-min);
    max-width: var(--sidebar-max);

    padding: 24px 20px;
    background-color: var(--sidebar-bg);
    color: var(--text-light);

    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================= */
/* CABEÇALHO FIXO DA SIDEBAR */
/* ========================= */

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    margin-bottom: 22px;
}

.sidebar-logo {
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: 0 auto 14px auto;
    display: block;
}

/* ========================= */
/* CARTÃO DE ORIENTAÇÃO */
/* ========================= */

.zoom-alert {
    width: 100%;
    margin: -2px 0 14px 0;
    padding: 10px 12px;

    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 10px;

    color: #0b2b57;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;

    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.zoom-alert strong{
    color: #0b2b57;
    font-weight: 700;
}
.sidebar-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-align: center;
    line-height: 1.2;
}

/* ========================= */
/* MENU DA SIDEBAR */
/* ========================= */

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;

    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: none;
    -ms-overflow-style: none;

    padding-right: 2px;
    padding-bottom: 6px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* ========================= */
/* BOTÕES PRINCIPAIS SIDEBAR */
/* ========================= */

.sidebar-button,
.contratos-toggle,
.processos-toggle,
.fracionamento-toggle,
.portarias-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 58px;
    padding: 16px 18px;
    border-radius: 10px;
    background: var(--button-bg);
    color: #ffffff;
    text-decoration: none;
    font-size: 20px;
    line-height: 1.3;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    cursor: pointer;
    font-weight: 600;
}

.sidebar-button:hover,
.contratos-toggle:hover,
.processos-toggle:hover,
.fracionamento-toggle:hover,
.portarias-toggle:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

.sidebar-button-active,
.contratos-toggle.active,
.processos-toggle.active,
.fracionamento-toggle.active,
.portarias-toggle.active {
    background: #ffffff;
    color: #0b2b57 !important;
    border-color: #ffffff;
    font-weight: 700;
}

/* ========================= */
/* CONTEÚDO PRINCIPAL */
/* ========================= */

.main-content {
    margin-left: clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max));
    width: calc(100vw - clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max)));
    min-height: 100vh;
    height: 100vh;
    background-color: var(--content-bg);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 0;
}

.page-wrapper {
    min-height: 100vh;
}

/* ========================= */
/* BARRA DE FILTROS STICKY */
/* ========================= */

.filtros-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #ffffff;
    padding: 6px 12px 10px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* ========================= */
/* HOME */
/* ========================= */

.home-container {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    background-image: url("/assets/Painel DCC.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% auto;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

.home-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 43, 87, 0);
    pointer-events: none;
}

/* ========================= */
/* COMPONENTES PADRÃO */
/* ========================= */

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    background-color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    min-width: 0;
}

.card-title {
    font-size: 14px;
    color: #555;
    text-align: center;
    line-height: 1.35;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #b30000;
    text-align: center;
    line-height: 1.2;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* ========================= */
/* TABELAS E GRÁFICOS */
/* ========================= */

.dash-table-container {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.js-plotly-plot {
    width: 100% !important;
    overflow: visible !important;
}

/* ========================= */
/* ACCORDION - CONTRATOS */
/* ========================= */

.contratos-container {
    width: 100%;
    margin-bottom: 10px;
}

.contratos-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.contratos-content.expanded {
    max-height: 360px;
}

.contratos-subbutton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: var(--submenu-bg);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    line-height: 1.3;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.contratos-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

.contratos-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 700;
}

/* ========================= */
/* ACCORDION - PROCESSOS */
/* ========================= */

.processos-container {
    width: 100%;
    margin-bottom: 10px;
}

.processos-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.processos-content.expanded {
    max-height: 360px;
}

.processos-subbutton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: var(--submenu-bg);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    line-height: 1.3;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.processos-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

.processos-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 700;
}

/* ========================= */
/* ACCORDION - FRACIONAMENTO */
/* ========================= */

.fracionamento-container {
    width: 100%;
    margin-bottom: 10px;
}

.fracionamento-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.fracionamento-content.expanded {
    max-height: 400px;
}

.fracionamento-subbutton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: var(--submenu-bg);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    line-height: 1.3;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.fracionamento-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

.fracionamento-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 700;
}

/* ========================= */
/* ACCORDION - PORTARIAS */
/* ========================= */

.portarias-container {
    width: 100%;
    margin-bottom: 10px;
}

.portarias-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.portarias-content.expanded {
    max-height: 360px;
}

.portarias-subbutton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: var(--submenu-bg);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    line-height: 1.3;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.portarias-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

.portarias-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 700;
}

/* ========================= */
/* RESPONSIVIDADE EXTRA */
/* ========================= */

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 28vw;
        --sidebar-min: 320px;
        --sidebar-max: 400px;
    }

    .sidebar-logo {
        max-width: 280px;
    }

    .zoom-alert {
        font-size: 12px;
        padding: 9px 10px;
    }

    .sidebar-title {
        font-size: 22px;
    }

    .sidebar-button,
    .contratos-toggle,
    .processos-toggle,
    .fracionamento-toggle,
    .portarias-toggle {
        font-size: 18px;
        min-height: 54px;
        padding: 14px 16px;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 30vw;
        --sidebar-min: 280px;
        --sidebar-max: 340px;
    }

    .sidebar {
        padding: 18px 14px;
    }

    .sidebar-logo {
        max-width: 220px;
    }

    .zoom-alert {
        font-size: 11px;
        line-height: 1.3;
        padding: 8px 9px;
        margin: 0 0 12px 0;
    }

    .sidebar-title {
        font-size: 18px;
    }

    .sidebar-button,
    .contratos-toggle,
    .processos-toggle,
    .fracionamento-toggle,
    .portarias-toggle {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px;
    }

    .contratos-subbutton,
    .processos-subbutton,
    .fracionamento-subbutton,
    .portarias-subbutton {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* ========================= */
/* AJUSTES APENAS PARA TV / TELAS MUITO LARGAS */
/* ========================= */

@media (min-width: 1600px) and (max-height: 900px) {
    :root {
        --sidebar-width: 22vw;
        --sidebar-min: 360px;
        --sidebar-max: 450px;
    }

    .sidebar {
        padding: 18px 16px;
    }

    .sidebar-header {
        margin-bottom: 14px;
    }

    .sidebar-logo {
        max-width: 290px;
        margin-bottom: 10px;
    }

    .zoom-alert {
        font-size: 12px;
        padding: 8px 10px;
        margin: 0 0 10px 0;
    }

    .sidebar-title {
        font-size: 21px;
    }

    .sidebar-menu {
        gap: 8px;
    }

    .sidebar-button,
    .contratos-toggle,
    .processos-toggle,
    .fracionamento-toggle,
    .portarias-toggle {
        font-size: 17px;
        min-height: 50px;
        padding: 12px 14px;
        line-height: 1.2;
    }

    .contratos-subbutton,
    .processos-subbutton,
    .fracionamento-subbutton,
    .portarias-subbutton {
        font-size: 15px;
        padding: 10px 12px;
        line-height: 1.2;
    }

    .contratos-content.expanded,
    .processos-content.expanded,
    .portarias-content.expanded {
        max-height: 300px;
    }

    .fracionamento-content.expanded {
        max-height: 340px;
    }
}

@media (min-width: 1920px) and (max-height: 1080px) {
    :root {
        --sidebar-width: 21vw;
        --sidebar-min: 340px;
        --sidebar-max: 420px;
    }

    .sidebar {
        padding: 16px 14px;
    }

    .sidebar-header {
        margin-bottom: 12px;
    }

    .sidebar-logo {
        max-width: 270px;
        margin-bottom: 8px;
    }

    .zoom-alert {
        font-size: 11px;
        padding: 8px 10px;
        margin: 0 0 10px 0;
    }

    .sidebar-title {
        font-size: 20px;
    }

    .sidebar-menu {
        gap: 7px;
    }

    .sidebar-button,
    .contratos-toggle,
    .processos-toggle,
    .fracionamento-toggle,
    .portarias-toggle {
        font-size: 16px;
        min-height: 48px;
        padding: 11px 13px;
        line-height: 1.15;
    }

    .contratos-subbutton,
    .processos-subbutton,
    .fracionamento-subbutton,
    .portarias-subbutton {
        font-size: 14px;
        padding: 9px 11px;
        line-height: 1.15;
    }

    .contratos-content.expanded,
    .processos-content.expanded,
    .portarias-content.expanded {
        max-height: 280px;
    }

    .fracionamento-content.expanded {
        max-height: 320px;
    }
}

/* ========================= */
/* AJUSTE ESPECÍFICO PARA TV */
/* ========================= */

@media (min-width: 1600px) {
    :root {
        --sidebar-width: 18vw;
        --sidebar-min: 300px;
        --sidebar-max: 360px;
    }

    .sidebar {
        padding: 14px 12px;
    }

    .sidebar-header {
        margin-bottom: 12px;
    }

    .sidebar-logo {
        max-width: 250px;
        margin: 0 auto 10px auto;
    }

    .zoom-alert {
        font-size: 11px;
        padding: 8px 9px;
        margin: 0 0 10px 0;
    }

    .sidebar-title {
        font-size: 18px;
    }

    .sidebar-menu {
        gap: 8px;
    }

    .sidebar-button,
    .contratos-toggle,
    .processos-toggle,
    .fracionamento-toggle,
    .portarias-toggle {
        min-height: 46px;
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.15;
        text-align: center;
    }

    .contratos-subbutton,
    .processos-subbutton,
    .fracionamento-subbutton,
    .portarias-subbutton {
        padding: 9px 10px;
        font-size: 14px;
        line-height: 1.15;
        text-align: center;
    }

    .home-container {
        background-position: center center;
        background-size: contain;
    }
}