/* ATT — customizações visuais Superset
 * Servido pelo Blueprint em /static/att/att.css
 * Editar e recarregar browser (sem rebuild). */

.filter-counts { display: none !important; }
div.toast.toast--visible.toast--warning { display: none !important; }
li[data-menu-id*="autorefresh_modal"] { display: none !important; }

/* Esconde + Dashboard, + Chart e View All da home */
.css-1xtos06 button.superset-button-tertiary,
.css-1xtos06 button.superset-button-link { display: none !important; }

/* ── LOGO NAVBAR ── */
.navbar-brand img { display: none !important; }
.navbar-brand::after {
    content: '';
    display: block;
    width: 140px;
    height: 140px;
    background-image: url('https://drive.google.com/thumbnail?id=1HM-6XSGqBHpOAjcbe8hVBQOFzT9lejOJ&sz=w1000');
    background-size: 100% 150%;
    background-repeat: no-repeat;
    background-position: center;
}

/* ── HOME PAGE ── */
.superset-home-override { display: none !important; }
#att-home-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    gap: 28px;
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    animation: attFadeIn 0.6s ease both;
}
@keyframes attFadeIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
#att-home-splash img {
    width: 320px;
    max-width: 80vw;
    object-fit: contain;
    filter: drop-shadow(0 4px 18px rgba(30,125,184,0.10));
}
#att-home-splash .att-msg {
    font-size: 1.25rem;
    color: #454E7C;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
}
#att-home-splash .att-no-history {
    font-size: 1rem;
    color: #888;
    font-weight: 400;
    text-align: center;
    max-width: 380px;
    line-height: 1.6;
    padding: 16px 24px;
    background: #f4f8fc;
    border-radius: 10px;
    border: 1px solid #d0e6f5;
    display: none;
}
#att-home-splash .att-back-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    color: #1E7DB8;
    font-size: 0.95rem;
    font-weight: 500;
    transition: transform 0.15s;
}
#att-home-splash .att-back-btn:hover { transform: translateY(-4px); }
#att-home-splash .att-back-btn svg {
    width: 40px; height: 40px;
    stroke: #1E7DB8; fill: none;
    stroke-width: 2.2;
    stroke-linecap: round; stroke-linejoin: round;
    filter: drop-shadow(0 2px 6px rgba(30,125,184,0.22));
    transition: stroke 0.15s;
}
#att-home-splash .att-back-btn:hover svg { stroke: #0D5280; }

/* ── MENU DE ACESSO POR USUÁRIO ── */
.att-dash-menu {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.att-dash-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #b0bac9;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.att-dash-divider::before, .att-dash-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e9f4;
}
.att-dash-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.att-dash-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: #f4f8fc;
    border: 1px solid #d0e6f5;
    border-radius: 10px;
    text-decoration: none;
    color: #1E7DB8;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    position: relative;
    cursor: pointer;
}
.att-dash-link:hover {
    background: #e3f0fa;
    border-color: #1E7DB8;
    transform: translateX(4px);
}
.att-dash-emoji {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
}
.att-dash-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    color: #aac8e0;
    transition: transform 0.2s;
}
/* ── SUBMENU DE PERÍODOS ── */
.att-period-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0 4px 42px;
    animation: attFadeIn 0.2s ease both;
}
.att-period-menu.open { display: flex; }
.att-period-btn {
    display: inline-block;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #d0e6f5;
    border-radius: 6px;
    text-decoration: none;
    color: #1E7DB8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, border-color 0.12s;
    width: fit-content;
}
.att-period-btn:hover {
    background: #e3f0fa;
    border-color: #1E7DB8;
}

/* ── PERIOD BUTTONS INLINE NO DASHBOARD (substitui textbox de 11 links) ── */
.att-period-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 4px;
    width: 100%;
    height: 100%;
}
.att-period-pill {
    border: 1px solid #d0e6f5;
    background: #f4f8fc;
    color: #1E7DB8;
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.12s ease;
    min-width: 44px;
}
.att-period-pill:hover {
    background: #e3f0fa;
    border-color: #1E7DB8;
    transform: translateY(-1px);
}
.att-period-pill.active {
    background: #1E7DB8;
    color: #fff;
    border-color: #1E7DB8;
    box-shadow: 0 2px 6px rgba(30,125,184,0.35);
}
.att-period-pill:active {
    transform: translateY(0);
}

/* ── BARRA DE FILTROS UNIFICADA ─────────────────────────────────────────── */

/* Garante que titulo do dashboard nunca seja cortado por overflow ou layout shift */
.dashboard-header-container {
    overflow: visible !important;
}
.dashboard-header-container .title-panel {
    padding-left: 16px !important;
    overflow: visible !important;
}

/* Libera overflow das linhas ate o markdown que contem a barra ATT */
body.att-fb-active .att-fb,
body.att-fb-active .grid-content,
body.att-fb-active .dashboard-grid,
body.att-fb-active .grid-row,
body.att-fb-active [data-test="grid-container"],
body.att-fb-active [data-test="grid-row-background--transparent"],
body.att-fb-active .dashboard-component-chart-holder:has(.att-fb),
body.att-fb-active .dashboard-markdown:has(.att-fb),
body.att-fb-active .dashboard-component:has(.att-fb) {
    overflow: visible !important;
    max-height: none !important;
}
body.att-fb-active .dashboard-component-chart-holder:has(.att-fb) { z-index: 5; }

.att-fb {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f0f6fb 100%);
    border: 1px solid #d0e6f5;
    border-radius: 12px;
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.85rem;
    color: #454E7C;
    box-shadow: 0 1px 4px rgba(30,125,184,0.06);
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 1280px) {
    .att-fb { flex-wrap: wrap; }
}

/* Input data inicio + help icon */
.att-fb-min-input {
    width: 90px;
    padding: 3px 6px;
    border: 1px solid #d0e6f5;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.78rem;
    color: #1E7DB8;
    font-weight: 600;
    text-align: center;
    background: #fff;
    text-transform: none;
    letter-spacing: 0;
}
.att-fb-min-input:focus {
    outline: none;
    border-color: #1E7DB8;
    box-shadow: 0 0 0 2px rgba(30,125,184,0.15);
}
.att-fb-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #1E7DB8;
    cursor: help;
    user-select: none;
    flex-shrink: 0;
}
.att-fb-help span {
    color: #fff !important;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    text-transform: none;
    letter-spacing: 0;
}
.att-fb-help:hover { background: #0D5280; }
.att-fb-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.att-fb-time {
    flex: 1 1 600px;
    min-width: 480px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}
.att-fb-time-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.att-fb-label-text {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b7494;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.att-fb-date-range {
    color: #1E7DB8;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}
.att-fb-d-start, .att-fb-d-end { display: inline-block; }
/* slider preenche o espaco que sobra */
.att-fb-time .att-slider-wrap {
    flex: 1 1 auto;
}

/* Slider duplo ── */
.att-slider-wrap {
    position: relative;
    height: 28px;
    width: 100%;
}
.att-slider-track-bg {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    height: 4px;
    background: #d0e6f5;
    border-radius: 2px;
}
.att-slider-fill {
    position: absolute;
    top: 12px;
    height: 4px;
    background: linear-gradient(90deg, #1E7DB8, #4DA3D4);
    border-radius: 2px;
}
.att-slider-wrap input[type=range] {
    position: absolute;
    width: 100%;
    height: 28px;
    background: transparent;
    -webkit-appearance: none;
    pointer-events: none;
    margin: 0;
    padding: 0;
}
.att-slider-wrap .att-slider-min { z-index: 3; }
.att-slider-wrap .att-slider-max { z-index: 2; }
.att-slider-wrap input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1E7DB8;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(30,125,184,0.35);
    transition: transform 0.1s;
}
.att-slider-wrap input[type=range]::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.att-slider-wrap input[type=range]::-moz-range-thumb {
    pointer-events: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1E7DB8;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(30,125,184,0.35);
}

/* Multi-select dropdown ── */
.att-fb-ms {
    flex: 0 1 200px;
    position: relative;
}
.att-fb-ms-toggle {
    background: #fff;
    border: 1px solid #d0e6f5;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 0.85rem;
    color: #454E7C;
    transition: border-color 0.12s, box-shadow 0.12s;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
}
.att-fb-ms-toggle:hover, .att-fb-ms.open .att-fb-ms-toggle {
    border-color: #1E7DB8;
    box-shadow: 0 0 0 2px rgba(30,125,184,0.15);
}
.att-fb-ms-name { font-weight: 700; color: #6b7494; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.att-fb-ms-summary { font-weight: 600; color: #1E7DB8; flex: 1; }
.att-fb-ms-arrow { color: #6b7494; transition: transform 0.15s; }
.att-fb-ms.open .att-fb-ms-arrow { transform: rotate(180deg); }
.att-fb-ms-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d0e6f5;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 4px 16px rgba(30,125,184,0.18);
    z-index: 99999;  /* acima dos charts e seus kebab menus */
    max-height: 280px;
    overflow-y: auto;
}
.att-fb-ms.open { z-index: 99999; position: relative; }
.att-fb-ms.open .att-fb-ms-menu { display: block; }
.att-fb-ms-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.att-fb-ms-row:hover { background: #f4f8fc; }
.att-fb-ms-row input[type=checkbox] { accent-color: #1E7DB8; }

/* Clock ── */
.att-fb-clock {
    flex: 0 0 auto;
    text-align: center;
    padding: 0 8px;
}
.att-fb-clock-label {
    font-size: 0.72rem;
    color: #6b7494;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
}
.att-fb-clock-time {
    font-size: 1rem;
    color: #1E7DB8;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: block;
    margin-top: 2px;
}

/* Apply button ── */
.att-fb-apply {
    flex: 0 0 auto;
    align-self: stretch;
    background: #1E7DB8;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.12s;
    box-shadow: 0 2px 6px rgba(30,125,184,0.30);
    letter-spacing: 0.02em;
}
.att-fb-apply:hover:not(:disabled) {
    background: #0D5280;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(13,82,128,0.40);
}
.att-fb-apply:disabled { opacity: 0.6; cursor: wait; }
