/* Exportação de gráficos — UX progressiva (CTA → painel → download) */

.exportacao-graficos {
    width: 100%;
    max-width: 52rem;
    margin: 2.5rem auto 3.25rem;
    padding: 0 0.25rem;
}

.exportacao-graficos__intro {
    text-align: center;
}

.exportacao-graficos__lead {
    margin: 0 auto 1.15rem;
    max-width: 36rem;
    color: #3d4f5f;
    font-size: 1rem;
    line-height: 1.55;
}

.exportacao-graficos__cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.exportacao-graficos__cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.85rem;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.exportacao-graficos__cta-btn:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

.exportacao-graficos__cta-btn--primary {
    border: 0;
    background: linear-gradient(135deg, #17669b, #0189d3);
    color: #fff;
    box-shadow: 0 8px 22px rgba(23, 102, 155, 0.28);
}

.exportacao-graficos__cta-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(23, 102, 155, 0.34);
    color: #fff;
}

.exportacao-graficos__cta-btn--primary[aria-expanded="true"] {
    background: #145a88;
}

.exportacao-graficos__cta-btn--ghost {
    border: 1.5px solid rgba(23, 102, 155, 0.45);
    background: #fff;
    color: #17669b;
}

.exportacao-graficos__cta-btn--ghost:hover {
    border-color: #17669b;
    background: #e8f4fc;
    color: #0e4a6b;
}

.exportacao-graficos__cta-chevron {
    font-size: 0.7rem;
    transition: transform 0.35s ease;
}

.exportacao-graficos__cta-btn--primary[aria-expanded="true"] .exportacao-graficos__cta-chevron {
    transform: rotate(180deg);
}

/* Painel expansível */
.exportacao-graficos__painel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    margin-top: 0;
    transition: grid-template-rows 0.55s ease, opacity 0.45s ease, margin-top 0.45s ease;
}

.exportacao-graficos__painel[hidden] {
    display: none !important;
}

.exportacao-graficos__painel.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 1.35rem;
}

.exportacao-graficos__painel-inner {
    overflow: hidden;
    min-height: 0;
}

.exportacao-graficos__painel.is-open .exportacao-graficos__painel-inner {
    overflow: visible;
}

.exportacao-graficos__steps {
    list-style: none;
    margin: 0;
    padding: 1.25rem 1.35rem 1.4rem;
    border: 1px solid rgba(23, 102, 155, 0.16);
    border-radius: 1.15rem;
    background: linear-gradient(180deg, #f7fbfe 0%, #ffffff 48%);
    box-shadow: 0 10px 28px rgba(23, 102, 155, 0.08);
}

.exportacao-graficos__step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.85rem 1rem;
    align-items: start;
}

.exportacao-graficos__step + .exportacao-graficos__step {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(23, 102, 155, 0.22);
}

.exportacao-graficos__step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: #17669b;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.exportacao-graficos__step-title {
    margin: 0 0 0.25rem;
    color: #124f78;
    font-size: 1.05rem;
    font-weight: 700;
}

.exportacao-graficos__step-hint {
    margin: 0 0 0.85rem;
    color: #5a6b78;
    font-size: 0.92rem;
    line-height: 1.45;
}

.exportacao-graficos__inner,
.exportacao-graficos__downloads {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.exportacao-graficos__dropdown {
    position: relative;
    min-width: 11.5rem;
}

.exportacao-graficos__field-label {
    display: block;
    margin: 0 0 0.35rem;
    color: #4a5d6b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Select moderno (campo de formulário, não botão de ação) */
.exportacao-graficos__pill,
.exportacao-graficos__select {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    min-height: 2.65rem;
    background: #fff;
    color: #1f2a37;
    border: 1.5px solid #c5d3de;
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    box-shadow: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.exportacao-graficos__pill:hover,
.exportacao-graficos__select:hover {
    background: #f8fbfd;
    border-color: #9db6c8;
    box-shadow: none;
    outline: none;
}

.exportacao-graficos__pill:focus-visible,
.exportacao-graficos__select:focus-visible {
    background: #fff;
    border-color: #17669b;
    box-shadow: 0 0 0 3px rgba(23, 102, 155, 0.18);
    outline: none;
}

.exportacao-graficos__dropdown.is-open .exportacao-graficos__pill,
.exportacao-graficos__dropdown.is-open .exportacao-graficos__select {
    background: #fff;
    border-color: #17669b;
    box-shadow: 0 0 0 3px rgba(23, 102, 155, 0.18);
}

.exportacao-graficos__pill i.fa-calendar-alt {
    display: none;
}

.exportacao-graficos__pill-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1f2a37;
}

.exportacao-graficos__pill-text strong {
    font-weight: 600;
    color: #124f78;
}

.exportacao-graficos__chevron {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: #6b7c8a;
    opacity: 1;
    transition: transform 0.15s ease, color 0.15s ease;
}

.exportacao-graficos__dropdown.is-open .exportacao-graficos__chevron {
    transform: rotate(180deg);
    color: #17669b;
}

.exportacao-graficos__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 40;
    min-width: 100%;
    width: 100%;
    max-height: 16rem;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1.5px solid #c5d3de;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(18, 49, 72, 0.14);
    overflow-y: auto;
}

.exportacao-graficos__option {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: #1f2a37;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease;
}

.exportacao-graficos__option:hover,
.exportacao-graficos__option:focus-visible {
    background: #eef5fa;
    color: #124f78;
    outline: none;
}

.exportacao-graficos__option.is-selected {
    background: #17669b;
    color: #fff;
}

.exportacao-graficos__option.is-unavailable {
    color: #9aa5b1;
    background: transparent;
    cursor: not-allowed;
    opacity: 0.72;
    font-weight: 500;
}

.exportacao-graficos__option.is-unavailable:hover,
.exportacao-graficos__option.is-unavailable:focus-visible {
    background: transparent;
    color: #9aa5b1;
    outline: none;
}

.exportacao-graficos__option.is-unavailable.is-selected {
    background: transparent;
    color: #9aa5b1;
}

.exportacao-graficos__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1.5px solid #17669b;
    background: #fff;
    color: #17669b;
    border-radius: 999px;
    padding: 0.55rem 1.05rem;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(23, 102, 155, 0.08);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.exportacao-graficos__btn:hover,
.exportacao-graficos__btn:focus-visible {
    background: #17669b;
    color: #fff;
    outline: none;
    box-shadow: 0 4px 12px rgba(23, 102, 155, 0.22);
    transform: translateY(-1px);
}

.exportacao-graficos__btn:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

/* Modal */
.exportacao-graficos__modal[hidden] {
    display: none !important;
}

.exportacao-graficos__modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.exportacao-graficos__modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 28, 42, 0.55);
    backdrop-filter: blur(2px);
}

.exportacao-graficos__modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 34rem);
    max-height: min(90vh, 40rem);
    overflow: auto;
    background: #fff;
    border-radius: 1.15rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    animation: exportacaoModalIn 0.35s ease;
}

@keyframes exportacaoModalIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.exportacao-graficos__modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem 0.75rem;
}

.exportacao-graficos__modal-title {
    margin: 0;
    color: #124f78;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.exportacao-graficos__modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 0;
    border-radius: 999px;
    background: #eef4f9;
    color: #17669b;
    cursor: pointer;
    flex-shrink: 0;
}

.exportacao-graficos__modal-close:hover,
.exportacao-graficos__modal-close:focus-visible {
    background: #d9eaf6;
    outline: none;
}

.exportacao-graficos__modal-close:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

.exportacao-graficos__modal-body {
    padding: 0.35rem 1.35rem 1rem;
    color: #2c3e50;
    font-size: 0.98rem;
    line-height: 1.55;
}

.exportacao-graficos__modal-body p {
    margin: 0 0 1rem;
}

.exportacao-graficos__help-list {
    margin: 0 0 1.15rem;
    padding-left: 1.2rem;
}

.exportacao-graficos__help-list li {
    margin-bottom: 0.75rem;
}

.exportacao-graficos__help-list li:last-child {
    margin-bottom: 0;
}

.exportacao-graficos__help-note {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    background: #eef6fb;
    color: #124f78;
    font-size: 0.9rem;
}

.exportacao-graficos__help-note i {
    margin-top: 0.15rem;
    color: #17669b;
}

.exportacao-graficos__modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.35rem 1.35rem 1.35rem;
}

@media (max-width: 576px) {
    .exportacao-graficos__cta {
        flex-direction: column;
        align-items: stretch;
    }

    .exportacao-graficos__cta-btn {
        width: 100%;
    }

    .exportacao-graficos__steps {
        padding: 1.1rem 1rem 1.2rem;
    }

    .exportacao-graficos__inner,
    .exportacao-graficos__downloads {
        flex-direction: column;
        align-items: stretch;
    }

    .exportacao-graficos__pill,
    .exportacao-graficos__select {
        justify-content: space-between;
        width: 100%;
    }

    .exportacao-graficos__btn {
        justify-content: center;
        width: 100%;
    }

    .exportacao-graficos__menu {
        left: 0;
        right: 0;
        width: 100%;
    }

    .exportacao-graficos__modal-footer .exportacao-graficos__cta-btn {
        width: 100%;
    }
}

/* Exportação individual por gráfico (dropdown) */
.exportacao-grafico-individual {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0 0 0.85rem;
    z-index: 5;
}

.grafico-bloco__chart-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.35rem;
}

.grafico-bloco__chart-toolbar .chart-title {
    flex: 1 1 12rem;
    margin-bottom: 0;
    text-align: left;
}

.grafico-bloco__chart-toolbar .exportacao-grafico-individual {
    margin: 0;
    flex: 0 0 auto;
}

.exportacao-grafico-individual__toggle {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.15rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1.5px solid rgba(23, 102, 155, 0.45);
    background: #fff;
    color: #17669b;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.exportacao-grafico-individual__toggle:hover {
    border-color: #17669b;
    background: #e8f4fc;
    color: #0e4a6b;
    transform: translateY(-1px);
}

.exportacao-grafico-individual__toggle:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

.exportacao-grafico-individual.is-open .exportacao-grafico-individual__toggle {
    border-color: #17669b;
    background: #e8f4fc;
    color: #0e4a6b;
}

.exportacao-grafico-individual__chevron {
    font-size: 0.65rem;
    transition: transform 0.25s ease;
}

.exportacao-grafico-individual.is-open .exportacao-grafico-individual__chevron {
    transform: rotate(180deg);
}

.exportacao-grafico-individual__menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 20;
    min-width: 9.5rem;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(23, 102, 155, 0.18);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 61, 92, 0.16);
}

.exportacao-grafico-individual__option {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.exportacao-grafico-individual__option--pdf {
    color: #b91c1c;
}

.exportacao-grafico-individual__option--pdf:hover,
.exportacao-grafico-individual__option--pdf:focus-visible {
    background: #fee2e2;
    color: #991b1b;
}

.exportacao-grafico-individual__option--xlsx {
    color: #15803d;
}

.exportacao-grafico-individual__option--xlsx:hover,
.exportacao-grafico-individual__option--xlsx:focus-visible {
    background: #dcfce7;
    color: #166534;
}

.exportacao-grafico-individual__option:focus-visible {
    outline: 2px solid #ffc107;
    outline-offset: 1px;
}

@media (max-width: 640px) {
    .grafico-bloco__chart-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .exportacao-grafico-individual {
        justify-content: flex-start;
        align-self: flex-start;
    }

    .exportacao-grafico-individual__menu {
        left: 0;
        right: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .exportacao-graficos__painel,
    .exportacao-graficos__cta-btn,
    .exportacao-graficos__cta-chevron,
    .exportacao-graficos__btn,
    .exportacao-graficos__pill,
    .exportacao-grafico-individual__toggle,
    .exportacao-grafico-individual__chevron,
    .exportacao-grafico-individual__option {
        transition: none !important;
    }

    .exportacao-graficos__modal-dialog {
        animation: none !important;
    }
}
