﻿/* ── Loading screen ─────────────────────────────────────────── */

.loading-progress {
    position: relative;
    display: block;
    width: 5rem;
    height: 5rem;
    margin: 30vh auto 1.5rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #1E293B;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #F59E0B;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.75rem;
    color: #94A3B8;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    inset: calc(30vh + 6.5rem) 0 auto 0;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Carregando");
}

/* ── Blazor error UI ────────────────────────────────────────── */

#blazor-error-ui {
    background: #1E293B;
    color: #F1F5F9;
    border-top: 2px solid #F59E0B;
    bottom: 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 0.75rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    opacity: 0.6;
}

#blazor-error-ui .dismiss:hover { opacity: 1; }

.blazor-error-boundary {
    background: #1E293B;
    border-left: 4px solid #EF4444;
    padding: 1rem 1.25rem;
    color: #F87171;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "Ocorreu um erro ao carregar este componente."
}

/* ── Reset & base ───────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --flurio-amber:    #F59E0B;
    --flurio-emerald:  #10B981;
    --flurio-slate-900:#0F172A;
    --flurio-radius:   12px;
    --flurio-radius-sm: 8px;
    --flurio-transition: 0.18s ease;
}

html, body {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Animations ─────────────────────────────────────────────── */

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes flow-gradient {
    0%   { background-position: 0% 50%; opacity: 0.85; }
    100% { background-position: 100% 50%; opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Page container ─────────────────────────────────────────── */

.flurio-page {
    animation: fadeSlideIn 0.22s ease-out both;
}

/* ── Page header ────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.page-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Form card ──────────────────────────────────────────────── */

.flurio-form-card {
    border-radius: var(--flurio-radius) !important;
    animation: scaleIn 0.2s ease-out both;
}

.flurio-form-card .form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ── Card hover lift ────────────────────────────────────────── */

.flurio-card-hover {
    transition: box-shadow var(--flurio-transition), transform var(--flurio-transition);
}

.flurio-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

/* ── Balance card accent strip ──────────────────────────────── */

.balance-accent {
    height: 4px;
    width: 100%;
    border-radius: var(--flurio-radius) var(--flurio-radius) 0 0;
    background: linear-gradient(90deg, var(--flurio-amber), var(--flurio-emerald));
    background-size: 200% 100%;
    animation: flow-gradient 3s ease-in-out infinite alternate;
}

/* ── Brand wordmark ─────────────────────────────────────────── */

.flurio-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    color: #F8FAFC;
}

.flurio-brand span { color: var(--flurio-amber); }

/* ── Sidebar logo area ──────────────────────────────────────── */

.nav-brand-area {
    padding: 1.75rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 0.5rem;
}

/* ── Auth pages ─────────────────────────────────────────────── */

.auth-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 2.25rem;
    letter-spacing: -0.04em;
    color: #F1F5F9;
}

.auth-brand span { color: var(--flurio-amber); }

.auth-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #64748B;
    margin-top: 0.25rem;
}

/* ── Auth dark card — input overrides ───────────────────────── */

.auth-dark-card .mud-input-slot {
    background: transparent !important;
    color: #F1F5F9 !important;
}

.auth-dark-card .mud-input-slot input {
    color: #F1F5F9 !important;
    caret-color: #F59E0B;
}

.auth-dark-card .mud-input-outlined-border {
    border-color: rgba(255,255,255,0.15) !important;
}

.auth-dark-card .mud-input:hover .mud-input-outlined-border {
    border-color: rgba(255,255,255,0.35) !important;
}

.auth-dark-card .mud-input.mud-input-focused .mud-input-outlined-border {
    border-color: #F59E0B !important;
}

.auth-dark-card .mud-input-label,
.auth-dark-card label.mud-input-label {
    color: #94A3B8 !important;
    background-color: #131929 !important;
    padding: 0 4px !important;
}

.auth-dark-card .mud-input.mud-input-error .mud-input-outlined-border {
    border-color: #EF4444 !important;
}

/* ── DataGrid tweaks ────────────────────────────────────────── */

.mud-table-root {
    border-radius: var(--flurio-radius) !important;
}

/* ── MudChip T param click area ─────────────────────────────── */
.mud-chip { cursor: pointer !important; }

/* ── Mobile / PWA ───────────────────────────────────────────── */

@media (max-width: 599px) {
    .mud-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .page-title {
        font-size: 1.05rem !important;
    }

    /* Stack filter row on transaction list */
    .filters-row {
        flex-direction: column !important;
        gap: 0.5rem;
    }

    .filters-row .mud-select {
        width: 100% !important;
    }

    /* Hide DataGrid columns marked as hide-mobile */
    .col-hide-mobile {
        display: none !important;
    }

    /* FAB area spacing */
    .mud-main-content {
        padding-bottom: 80px;
    }
}

/* ── Floating Action Button (mobile) ────────────────────────── */

.flurio-fab {
    position: fixed !important;
    bottom: 24px;
    right: 20px;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(245,158,11,0.4) !important;
    animation: fadeIn 0.3s ease both;
}

/* ── Report table ───────────────────────────────────────────── */

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

.report-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.5;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    white-space: nowrap;
}

.report-table td {
    padding: 12px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    white-space: nowrap;
}

.report-table tfoot td {
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: none;
    padding-top: 14px;
}

.report-table tr:last-child td { border-bottom: none; }

.report-table .text-right { text-align: right; }

.month-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.value-positive { color: #10B981; font-weight: 600; }
.value-negative { color: #EF4444; font-weight: 600; }

/* ── Category bars ──────────────────────────────────────────── */

.category-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-bar-wrap {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
}

.category-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    min-width: 2px;
}

.category-bar-expense { background: linear-gradient(90deg, #EF4444, #F87171); }
.category-bar-income  { background: linear-gradient(90deg, #10B981, #34D399); }

.category-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.category-pct {
    font-size: 0.7rem;
    opacity: 0.45;
    font-weight: 600;
}

/* ── Reduced motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .balance-accent { animation: none; }
    .flurio-page, .flurio-form-card { animation: none; }
    .flurio-card-hover:hover { transform: none; }
}
