﻿html[data-nav="login"],
html[data-nav="login"] body {
    background-color: #2C4D5E;
}

[data-theme="dark"][data-nav="login"],
[data-theme="dark"][data-nav="login"] body {
    background-color: #1a1e24;
}

[data-theme="dark"][data-nav="app"],
[data-theme="dark"][data-nav="app"] body {
    background-color: #121518;
}

html, body,
input, button, select, textarea {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
    overscroll-behavior: none;
}

a, .btn-link {
    color: #0366d6;
}




.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

app {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--cor-fundo-pagina, white);
    padding: 0 !important;
    overscroll-behavior: none;
}

.top-row {
    height: 3.5rem;
    display: flex;
    align-items: center;
}

.main {
    flex: 1;
}

    .main .top-row {
        background-color: var(--cor-fundo-conteudo, white);
        border-bottom: 1px solid var(--cor-borda, #d6d5d5);
        justify-content: flex-end;
    }

        .main .top-row > a, .main .top-row .btn-link {
            white-space: nowrap;
            margin-left: 1.5rem;
        }

.main .top-row a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

    .sidebar .top-row {
        background-color: rgba(0,0,0,0.4);
    }

    .sidebar .navbar-brand {
        font-size: 1.1rem;
    }

    .sidebar .nav-item {
        font-size: 0.9rem;
        padding-bottom: 0.5rem;
    }

        .sidebar .nav-item:first-of-type {
            padding-top: 1rem;
        }

        .sidebar .nav-item:last-of-type {
            padding-bottom: 1rem;
        }

        .sidebar .nav-item a {
            color: #d7d7d7;
            border-radius: 4px;
            height: 3rem;
            display: flex;
            align-items: center;
            line-height: 3rem;
        }

            .sidebar .nav-item a.active {
                background-color: rgba(255,255,255,0.25);
                color: white;
            }

            .sidebar .nav-item a:hover {
                background-color: rgba(255,255,255,0.1);
                color: white;
            }

.content {
    padding-top: 1.1rem;
}

.navbar-toggler {
    background-color: rgba(255, 255, 255, 0.1);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

@media (max-width: 767.98px) {
    .main .top-row:not(.auth) {
        display: none;
    }

    .main .top-row.auth {
        justify-content: space-between;
    }

    .main .top-row a, .main .top-row .btn-link {
        margin-left: 0;
    }
}

@media (min-width: 768px) {
    app {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .main .top-row {
        position: sticky;
        top: 0;
    }

    .main > div {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }

    .navbar-toggler {
        display: none;
    }

    .sidebar .collapse {
        /* Never collapse the sidebar for wide screens */
        display: block;
    }
}

/* ── Error UI – Toast corporativo ── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    top: auto;
    width: auto;
    max-width: 420px;
    min-width: 320px;
    transform: none;
    z-index: 99998;
    background: var(--cor-fundo-conteudo, #fff);
    border: 1px solid var(--cor-erro-borda, #e0a0a0);
    border-left: 4px solid var(--cor-erro, #dc3545);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0;
    font-family: 'Inter', sans-serif;
    animation: ergon-error-enter 0.3s ease-out;
}

@keyframes ergon-error-enter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

#blazor-error-ui .blazor-error-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
}

#blazor-error-ui .blazor-error-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cor-erro-fundo, #fde8e8);
    border-radius: 50%;
    margin-top: 1px;
}

#blazor-error-ui .blazor-error-icon svg {
    width: 18px;
    height: 18px;
    fill: var(--cor-erro, #dc3545);
}

#blazor-error-ui .blazor-error-text {
    flex: 1;
    min-width: 0;
}

#blazor-error-ui .blazor-error-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cor-erro-texto, #721c24);
    margin-bottom: 4px;
}

#blazor-error-ui .blazor-error-text span {
    display: block;
    font-size: 0.82rem;
    color: var(--cor-texto-secundario, #6C757D);
    line-height: 1.45;
}

#blazor-error-ui .blazor-error-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

#blazor-error-ui .blazor-error-actions .reload {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    background: var(--cor-primaria, #2C4D5E);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

#blazor-error-ui .blazor-error-actions .reload:hover {
    background: var(--cor-primaria-escura, #1a3645);
}

#blazor-error-ui .blazor-error-actions .dismiss {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    background: transparent;
    color: var(--cor-texto-secundario, #6C757D);
    border: 1px solid var(--cor-borda, #DEE2E6);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

#blazor-error-ui .blazor-error-actions .dismiss:hover {
    background: var(--cor-fundo-hover, #e9ecef);
    border-color: var(--cor-texto-secundario, #6C757D);
}

@media (max-width: 480px) {
    #blazor-error-ui {
        bottom: 12px;
        right: 12px;
        left: 12px;
        min-width: auto;
        max-width: none;
    }
}

.vendas-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .vendas-charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .vendas-charts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Donut resumo contas a pagar ── */
.cp-donut-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cp-donut-chart {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.cp-donut-lista {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-donut-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 0.75rem;
    border-radius: 2px;
    border-bottom: 1px solid var(--cor-borda-leve, #f1f3f5);
}

.cp-donut-item:hover {
    background: var(--cor-fundo-hover, #f0f2f4);
}

.cp-donut-rank {
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: #2C4D5E;
}

.cp-donut-rank-2 { background: #008B98; }
.cp-donut-rank-3 { background: #3B8EA5; }

.cp-donut-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 0.5rem;
}

.cp-donut-nome {
    font-size: clamp(0.8rem, 2.5vw, 0.92rem);
    font-weight: 500;
    color: var(--cor-texto-principal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-donut-valores {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-shrink: 0;
}

.cp-donut-valor {
    font-size: clamp(0.8rem, 2.5vw, 0.92rem);
    font-weight: 700;
    color: var(--cor-texto-principal);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cp-donut-pct {
    font-size: clamp(0.68rem, 2vw, 0.78rem);
    font-weight: 600;
    color: var(--cor-texto-secundario);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 3.2em;
    text-align: right;
}

/* ── Skeleton donut (ErgonCardFinanceiro) ── */
.cp-donut-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.cp-donut-skeleton-chart {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.cp-donut-skeleton-donut {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 24px solid var(--cor-borda, #e5e7eb);
    background: transparent;
    animation: cp-donut-pulse 1.4s ease-in-out infinite;
}

.cp-donut-skeleton-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0.75rem;
}

.cp-donut-skeleton-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 0;
}

.cp-donut-skeleton-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--cor-borda, #e5e7eb);
    flex-shrink: 0;
    animation: cp-donut-pulse 1.4s ease-in-out infinite;
}

.cp-donut-skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cp-donut-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: var(--cor-borda, #e5e7eb);
    animation: cp-donut-pulse 1.4s ease-in-out infinite;
}

.cp-donut-skeleton-line-lg {
    width: 70%;
}

.cp-donut-skeleton-line-sm {
    width: 40%;
}

@keyframes cp-donut-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Skeleton / vazio gráfico de colunas (Evolução de Vendas) ── */
.chart-skeleton {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 0.75rem;
    height: 300px;
    padding: 1.5rem 1rem 0.5rem;
}

.chart-skeleton-bar {
    flex: 1;
    border-radius: 6px 6px 0 0;
    background: var(--cor-borda, #e5e7eb);
    animation: chart-skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes chart-skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--cor-texto-secundario);
    font-size: 0.9rem;
}

.chart-empty-icon {
    opacity: 0.35;
}
