/* ================================================================
   Dashboard Público — Grid, Tipografia e Responsividade
   Compartilhado por: santos_pilots, suape_pier, suape_ondografo
   ================================================================ */

/* ---------- Grid (substitui style= inline no JS) ---------- */
.dash-row-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}
.dash-row-fixed {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.5rem;
}
.dash-param-cell {
    min-width: 0;
    grid-column: span var(--ps, 12);
}

/* ---------- Compasso / Rosa-dos-Ventos ---------- */
.compass-container {
    position: relative;
    width: 100%;
}
.compass-bg {
    width: 100%;
    max-width: 250px;
    height: auto;
    display: block;
    margin: 0 auto;
}
.compass-arrow {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    height: auto;
}

/* ---------- Valores sobrepostos no compasso ---------- */
.compass-values {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ---------- Gráfico série temporal ---------- */
.chart-box {
    flex: 1;
    width: 100%;
    min-height: 230px;
}

/* ---------- Barra de histórico 24h ---------- */
.history-row {
    z-index: 1;
    display: flex;
    width: 100%;
    justify-content: flex-end;
}

/* ---------- Labels de eixos do gráfico ---------- */
.axis-left  { display: flex; flex-direction: column; align-items: flex-start; }
.axis-right { display: flex; flex-direction: column; align-items: flex-end; }

/* ================================================================
   BREAKPOINTS
   ================================================================ */

/* --- Mobile (< 768px) --- */
@media (max-width: 767.98px) {
    .dash-row-fixed {
        grid-template-columns: 1fr;
    }
    .dash-row-fixed .dash-param-cell {
        grid-column: span 1;
    }
    .dash-row-auto {
        grid-template-columns: 1fr;
    }

    .val-lg   { font-size: 1.5rem !important; }
    .val-md   { font-size: 1rem   !important; }
    .title-sm { font-size: 0.9rem !important; }
    .sub-sm   { font-size: 0.75rem!important; }

    .compass-bg      { max-width: 200px; }
    .chart-box       { min-height: 180px; }
    /* .history-row     { flex-direction: column !important; align-items: flex-start !important; gap: 4px; } */
    .history-row     { flex-direction: column !important; gap: 4px; }

    .navbar-brand img { height: 45px !important; }
    .nav-link         { font-size: 14px !important; }

    .axis-left, .axis-right { flex: 0 0 100% !important; max-width: 100% !important; align-items: flex-start !important; }

    .dashboard-card .card-body { padding: 0.5rem !important; }
    .dashboard-card .card-header { padding: 0.5rem !important; }

    .titulo-datatype-interno {
        font-size: 10px !important;
    }
}

/* --- Tablet (768px - 1023px) --- */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .dash-row-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
    .compass-bg    { max-width: 180px; }
    .chart-box     { min-height: 200px; }
}

/* --- Desktop (1024px - 1399px) — comportamento padrão, sem overrides --- */

/* --- Mobile em landscape: 2 cards por linha --- */
@media (max-width: 950px) and (orientation: landscape) {
    .dash-row-auto {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .dash-row-fixed {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .dash-row-fixed .dash-param-cell {
        grid-column: span 1 !important;
    }

    .titulo-datatype-interno {
        font-size: 10px !important;
    }

    .compass-bg      { max-width: 200px; }
    .chart-box       { min-height: 180px; }
}

/* --- TV / Telas grandes (≥ 1400px) --- */
@media (min-width: 1400px) {
    .container-fluid { max-width: 1400px; margin: 0 auto; }
    .dash-row-auto   { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

    .val-lg   { font-size: 2.5rem  !important; }
    .val-md   { font-size: 1.25rem !important; }
    .title-sm { font-size: 1.25rem !important; }

    .compass-bg { max-width: 300px; }
    .chart-box  { min-height: 350px; }
}

/* ================================================================
   FULLSCREEN
   ================================================================ */

/* --- Tela cheia (qualquer resolução): card preenche viewport --- */
[id^="dashboard"]:fullscreen {
    display: flex;
    flex-direction: column;
}
[id^="dashboard"]:fullscreen .card {
    flex: 1;
    display: flex;
    flex-direction: column;
}
[id^="dashboard"]:fullscreen .card-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
[id^="dashboard"]:fullscreen .card-body > div {
    flex: 1;
}
[id^="dashboard"]:fullscreen .card-header,
[id^="dashboard"]:fullscreen .card-footer {
    flex-shrink: 0;
}

/* --- Santos Pilots: zoom out 75% em fullscreen --- */
/* #dashboard865:fullscreen {
    transform: scale(0.4);
    transform-origin: top left;
    width: 133.33%;
    height: 133.33%;
    overflow: auto;
} */

#dashboard865:fullscreen {
    zoom: 0.9;
}

/* ================================================================
   DARK THEME
   ================================================================ */
.dash-publico-body {
    background-color: #0e0b29 !important;
}

.dash-card,
.dash-card > .card-header,
.dash-card > .card-body,
.dash-card > .card-footer {
    background-color: rgb(41, 60, 105);
    /* background-color: #0e0b29; */
    border-color: rgba(255, 255, 255, 0.1);
}

[id^="dashboard"] {
    color: white;
    font-weight: bold;
}

[id^="dashboard"] .text-primary { color: white !important; }
[id^="dashboard"] .text-secondary { color: white !important; }
[id^="dashboard"] .text-dark { color: white !important; }

[id^="dashboard"] .badge-dark-lighten {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.dash-fullscreen-btn {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.titulo-datatype {
    white-space: nowrap;
}

.dash-card-title {
    color: white !important;
    font-weight: bold;
}

.dash-param-title {
    color: white !important;
    font-weight: bold;
}

.dash-param-subtitle,
.dash-chart-title {
    color: white !important;
    font-weight: bold;
}

.dash-param-datetime {
    color: white !important;
    font-weight: bold;
}

.dash-param-history {
    color: white !important;
    font-weight: bold;
}

.dash-chart-axis .badge-dark-lighten {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ================================================================
   PARAMETER CARD (substitui style= inline)
   ================================================================ */
.dash-param-card {
    border: 2px solid #ededed;
}
.dash-card-header {
    /* background-color: rgba(255, 255, 255, 0.5); */
    background-color: rgb(41, 60, 105);
}
.dash-param-content {
    position: relative;
}
.dash-compass-images {
    position: relative;
    width: 100%;
}
.dash-compass-section {
    position: relative;
}
.dash-param-alarms-row {
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    gap: 5px;
}
.dash-compass-dir {
    color: #F9BC0D !important;
}
.dash-compass-value {
    /* color: #353F69 !important; */
    color: white !important;
}
.dash-param-icon-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.dash-param-icon-img {
    position: absolute;
    scale: 0.6;
}
.dash-param-icon {
    width: 40px;
}
.dash-axis-label {
    /* white-space: normal; */
    line-height: 1.5;
}

.dash-tabua-box {
    background-color: rgba(255, 255, 255, 0.1);
}

.titulo-datatype-interno {
    font-size: 16px;
}
