/* ========================= */
/* 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;
}

/* ========================= */
/* VARIAVEIS 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.2);
}

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

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

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

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

.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;
}

.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;
}

.zoom-alert {
    width: 100%;
    margin: -2px 0 14px 0;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    color: #c00000;
    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: #c00000;
    font-weight: 700;
}

.sidebar-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.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;
}

.sidebar-button {
    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;
    font-weight: 600;
}

.sidebar-button:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

.sidebar-button-active {
    background: #ffffff;
    color: #0b2b57 !important;
    border-color: #ffffff;
    font-weight: 700;
}

/* ========================= */
/* CONTEUDO 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;
    padding: 0;
    background-color: var(--content-bg);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.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/fundo dcf.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 PADRAO */
/* ========================= */

.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: 14px;
    box-shadow: var(--shadow-soft);
    min-width: 0;
}

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

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

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

/* ========================= */
/* TABELAS E GRAFICOS */
/* ========================= */

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

.dash-table-container .dash-spreadsheet-container {
    border-radius: 14px;
    overflow: hidden;
}

.dash-table-container .dash-spreadsheet-inner {
    border-radius: 14px;
    overflow: hidden;
}

.dash-table-container table {
    border-collapse: separate;
    border-spacing: 0;
}

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

.filtros-sticky .Select-control,
.filtros-sticky .Select-menu-outer,
.filtros-sticky input[type="text"],
.filtros-sticky input[type="search"],
.filtros-sticky input[type="number"],
.filtros-sticky textarea {
    border-radius: 12px !important;
}

.filtros-sticky .Select-control {
    border-color: #cbd5e1 !important;
    min-height: 38px;
    box-shadow: none !important;
}

.filtros-sticky .Select.is-focused > .Select-control,
.filtros-sticky input[type="text"]:focus,
.filtros-sticky input[type="search"]:focus,
.filtros-sticky input[type="number"]:focus,
.filtros-sticky textarea:focus {
    border-color: #93b2dd !important;
    box-shadow: 0 0 0 2px rgba(147, 178, 221, 0.18) !important;
    outline: none;
}

.filtros-sticky .Select-placeholder,
.filtros-sticky .Select-value-label {
    border-radius: 12px;
}

/* ========================= */
/* MOBILE */
/* ========================= */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100vw;
        --sidebar-min: 100vw;
        --sidebar-max: 100vw;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-width: 100%;
        height: auto;
        padding: 18px 14px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 0 0 10px 0;
    }

    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        overflow: visible;
    }

    .sidebar-button {
        font-size: 13px;
        min-height: 42px;
        padding: 10px;
    }

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

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

    .filtros-sticky {
        position: static;
        box-shadow: none;
        padding: 6px 10px 8px 10px;
    }

    .card-value {
        font-size: 18px;
    }

    .card-title {
        font-size: 13px;
    }
}

@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 {
        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 {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px;
    }
}

@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 {
        min-height: 46px;
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.15;
    }

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