/* ==========================================================================
   CONFIGURAÇÃO E DESIGN SYSTEM (style.css)
   ========================================================================== */

:root {
    /* Color Palette (HSL & Hex) */
    --bg-primary: #090d16;
    --bg-secondary: #111726;
    --card-bg: rgba(22, 28, 45, 0.6);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-hover-border: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --danger: #f43f5e;
    --danger-light: rgba(244, 63, 94, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    
    --glow-primary: rgba(99, 102, 241, 0.25);
    
    /* Typography & Spacing */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --sidebar-width: 260px;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    line-height: 1.5;
}

/* Custom scrollbar for the page to match the dark theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #ffffff;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR NAV
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
    transition: var(--transition-normal);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 4px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.brand-icon i {
    color: white;
    width: 20px;
    height: 20px;
}

.sidebar-brand h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-brand h2 span {
    background: linear-gradient(to right, #818cf8, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: white;
    background-color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.nav-item.active i {
    color: var(--primary);
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6));
}

.sidebar-footer {
    margin-top: auto;
}

.connection-status-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.status-indicator-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    animation: statusPulse 1.8s infinite ease-in-out;
}

.status-indicator-dot.online {
    background-color: var(--success);
}
.status-indicator-dot.online::after {
    background-color: var(--success);
}

.status-indicator-dot.demo-mode {
    background-color: var(--warning);
}
.status-indicator-dot.demo-mode::after {
    background-color: var(--warning);
}

.status-indicator-dot.error {
    background-color: var(--danger);
}
.status-indicator-dot.error::after {
    background-color: var(--danger);
}

.status-text-container {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 11px;
    color: var(--text-muted);
}

.status-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

@keyframes statusPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* ==========================================================================
   MAIN CONTENT AREA & HEADER
   ========================================================================== */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    max-width: calc(100vw - var(--sidebar-width));
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-welcome h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-welcome .subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

/* ==========================================================================
   TAB CONTROLLER
   ========================================================================== */
.tab-content {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

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

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--card-border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--border-radius-sm);
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-icon:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 4px 8px;
}

.btn-text:hover {
    color: #818cf8;
}

.btn-text.text-danger {
    color: var(--danger);
}
.btn-text.text-danger:hover {
    color: #fb7185;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--border-radius-sm);
}

/* ==========================================================================
   METRICS CARDS
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    transition: var(--transition-normal);
}

.metric-card:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-card.income .metric-icon {
    background-color: var(--success-light);
    color: var(--success);
}

.metric-card.expense .metric-icon {
    background-color: var(--danger-light);
    color: var(--danger);
}

.metric-card.balance .metric-icon {
    background-color: var(--primary-light);
    color: var(--primary);
}

.metric-card.forecast-metric .metric-icon {
    background-color: var(--warning-light);
    color: var(--warning);
}

.metric-value {
    font-size: 28px;
    font-family: var(--font-heading);
    font-weight: 700;
    margin: 12px 0 6px 0;
    letter-spacing: -0.5px;
}

.metric-footer {
    display: flex;
    align-items: center;
    font-size: 12px;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
    margin-right: 4px;
}

.trend i {
    width: 14px;
    height: 14px;
}

.trend.positive {
    color: var(--success);
}

.trend.negative {
    color: var(--danger);
}

.trend-label {
    color: var(--text-muted);
}

/* ==========================================================================
   CHARTS & CARDS
   ========================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    min-width: 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.history {
    background-color: var(--primary);
}

.legend-dot.projection {
    background-color: var(--warning);
}

.chart-body {
    position: relative;
    height: 280px;
    width: 100%;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TABLES & TRANSACTION CARD
   ========================================================================== */
.section-card, .recent-transactions-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    margin-bottom: 28px;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header.border-bottom {
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.transaction-table th {
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

.transaction-table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

.transaction-table tbody tr {
    transition: var(--transition-fast);
}

.transaction-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

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

/* Row elements specific styles */
.tx-val {
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: right;
}

.tx-val.income {
    color: var(--success);
}

.tx-val.expense {
    color: var(--danger);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge.badge-income {
    background-color: var(--success-light);
    color: var(--success);
}

.badge.badge-expense {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge.badge-recurrence {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
}

.badge.badge-recurrence.active {
    background-color: var(--primary-light);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.2);
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.category-tag i {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

/* Filters toolbar */
.filters-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    flex-grow: 1;
    min-width: 250px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 42px;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.form-control, select, input {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    color: white;
    font-family: var(--font-body);
    font-size: 14px;
    padding: 12px 16px;
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus, select:focus, input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Customização dos Calendários para o Modo Escuro */
input[type="date"], input[type="month"] {
    color-scheme: dark; /* Força o pop-up nativo do calendário a abrir em modo escuro */
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(175deg); /* Modifica o ícone do calendário para a cor primária do site */
    cursor: pointer;
    opacity: 0.85;
    transition: var(--transition-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

select {
    cursor: pointer;
    padding-right: 32px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   FORECAST VIEW SPECIFICS
   ========================================================================== */
.forecast-intro-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(245, 158, 11, 0.05)), var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    margin-bottom: 28px;
    backdrop-filter: blur(12px);
}

.intro-content {
    max-width: 60%;
}

.intro-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.intro-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.intro-stats {
    display: flex;
    gap: 24px;
}

.intro-stat-box {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 16px 24px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
}

.intro-stat-box .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.intro-stat-box .stat-value {
    font-size: 22px;
    font-family: var(--font-heading);
    font-weight: 700;
}

.forecast-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .forecast-intro-card {
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
    }
    .intro-content {
        max-width: 100%;
    }
    .forecast-tools-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-tip {
    font-size: 11px;
    color: var(--text-muted);
}

.margin-top {
    margin-top: 16px;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    width: 100%;
    padding-right: 90px;
}

.input-with-suffix .suffix {
    position: absolute;
    right: 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.scroll-y {
    overflow-y: auto;
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    line-height: 1.6;
}

/* Forecast Events list */
.forecast-events-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forecast-event-item {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
}

.forecast-event-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.03);
}

.fe-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fe-name {
    font-size: 14px;
    font-weight: 600;
}

.fe-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.fe-value-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fe-val {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
}

.fe-val.income {
    color: var(--success);
}
.fe-val.expense {
    color: var(--danger);
}

.btn-delete-event {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-delete-event:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

.btn-delete-event i {
    width: 14px;
    height: 14px;
}

/* Forecast Table Matrix */
.forecast-table td {
    padding: 14px 16px;
}

.forecast-table td.val-net {
    font-family: var(--font-heading);
    font-weight: 600;
}

.forecast-table td.val-net.positive {
    color: var(--success);
    background-color: rgba(16, 185, 129, 0.02);
}

.forecast-table td.val-net.negative {
    color: var(--danger);
    background-color: rgba(244, 63, 94, 0.02);
}

.forecast-table td.val-proj {
    font-family: var(--font-heading);
    font-weight: 700;
}

.forecast-table td.val-proj.positive {
    color: #ffffff;
}

.forecast-table td.val-proj.negative {
    color: var(--danger);
}

.btn-details {
    padding: 4px 8px;
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}

.btn-details:hover {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary);
}

.btn-details i {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   SETTINGS VIEW
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.settings-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.step-guide {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-guide li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.step-guide li strong {
    color: white;
}

.step-guide li ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-guide a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.step-guide a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(4, 7, 13, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-close-modal:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-close-modal i {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-6 {
    width: 50%;
}
.col-12 {
    width: 100%;
}

.toggle-switch-group {
    display: flex;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 4px;
    height: 48px;
}

.toggle-switch-group input[type="radio"] {
    display: none;
}

.toggle-switch-group .toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.toggle-switch-group input[type="radio"]:checked + .toggle-btn.expense-btn {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.2);
}

.toggle-switch-group input[type="radio"]:checked + .toggle-btn.income-btn {
    background-color: var(--success);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.modal-footer {
    padding: 16px 24px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================================================
   CONFIRM MODAL
   ========================================================================== */
.confirm-modal-card {
    max-width: 420px !important;
    text-align: center;
    overflow: visible !important;
}

.confirm-modal-icon-wrap {
    display: flex;
    justify-content: center;
    margin-top: -36px;
    margin-bottom: 4px;
}

.confirm-modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.25), rgba(244, 63, 94, 0.08));
    border: 2px solid rgba(244, 63, 94, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 32px rgba(244, 63, 94, 0.25), 0 0 0 8px rgba(244, 63, 94, 0.06);
}

.confirm-modal-icon i {
    width: 32px;
    height: 32px;
    color: var(--danger);
}

.confirm-modal-content {
    padding: 8px 28px 20px;
}

.confirm-modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.confirm-modal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.confirm-modal-footer {
    justify-content: center !important;
    gap: 16px !important;
    padding: 20px 24px !important;
    border-top: 1px solid var(--card-border);
    background: rgba(0,0,0,0.15);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text-secondary);
    padding: 10px 22px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    font-family: var(--font-body);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-ghost i {
    width: 16px;
    height: 16px;
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    border: none;
    color: #fff;
    padding: 10px 22px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.30);
    font-family: var(--font-body);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #fb4a6b, #f02344);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.45);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-danger i {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--primary);
    border-radius: var(--border-radius-md);
    padding: 16px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft var(--transition-normal);
    transition: all var(--transition-fast);
}

.toast.success {
    border-left-color: var(--success);
}
.toast.success i {
    color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}
.toast.error i {
    color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}
.toast.warning i {
    color: var(--warning);
}

.toast-message {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    flex-grow: 1;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
}

.toast-close:hover {
    color: white;
}

@keyframes slideInLeft {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.removing {
    transform: translateX(120%);
    opacity: 0;
}

/* Custom scrollbar for tables to fit the glassmorphism theme */
.table-container::-webkit-scrollbar {
    height: 6px;
}
.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    transition: var(--transition-fast);
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        width: 100%;
        overflow-x: hidden;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        padding: 16px;
    }
    
    .sidebar-brand {
        margin-bottom: 20px;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 6px;
        -ms-overflow-style: auto;
        scrollbar-width: thin;
    }
    
    .sidebar-nav::-webkit-scrollbar {
        height: 4px;
        display: block;
    }
    
    .sidebar-nav::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 2px;
    }
    
    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.12);
        border-radius: 2px;
    }
    
    .sidebar-nav::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.22);
    }
    
    .nav-item {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 13px;
        gap: 8px;
    }
    
    .sidebar-footer {
        display: none; /* Hide status bar on small screens to save space */
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 20px;
        overflow-x: hidden;
    }
    
    .header-welcome h1 {
        font-size: 24px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .col-6 {
        width: 100%;
    }

    /* Additional layout adjustments for tablet/mobile */
    .chart-body {
        height: 220px;
    }
    
    .filters-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-box {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 8px;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    #btn-clear-filters {
        width: 100%;
        justify-content: center;
    }
    
    /* Compact modals on small screens */
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 16px 20px;
        gap: 16px;
    }
    
    .modal-footer {
        padding: 12px 20px;
    }

    /* Responsive Transaction Tables: Show only Descrição, Valor, and Ações on mobile */
    .recent-transactions-card th:nth-child(1),
    .recent-transactions-card td:nth-child(1),
    .recent-transactions-card th:nth-child(3),
    .recent-transactions-card td:nth-child(3),
    .recent-transactions-card th:nth-child(4),
    .recent-transactions-card td:nth-child(4) {
        display: none;
    }
    
    #all-transactions-table th:nth-child(1),
    #all-transactions-table td:nth-child(1),
    #all-transactions-table th:nth-child(3),
    #all-transactions-table td:nth-child(3),
    #all-transactions-table th:nth-child(4),
    #all-transactions-table td:nth-child(4),
    #all-transactions-table th:nth-child(5),
    #all-transactions-table td:nth-child(5) {
        display: none;
    }

    /* Right-align Valor headers on mobile to match value alignment */
    .recent-transactions-card th:nth-child(5),
    #all-transactions-table th:nth-child(6) {
        text-align: right;
    }

    /* Reduce card and table paddings on mobile to prevent actions clipping */
    .section-card, .recent-transactions-card {
        padding: 16px;
    }
    
    .transaction-table th,
    .transaction-table td {
        padding: 12px 6px;
    }
}

/* ==========================================================================
   AÇÕES DE TRANSAÇÃO (EDITAR/EXCLUIR) E CORREÇÃO SELECT OPTION
   ========================================================================== */
.table-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-table-action {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-table-action.edit {
    color: var(--text-secondary);
}
.btn-table-action.edit:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.btn-table-action.delete {
    color: var(--text-muted);
}
.btn-table-action.delete:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

/* Corrige fundo branco nos selects do modo escuro */
select option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Estilo do input escondido */
input[type="hidden"] {
    display: none;
}

/* ==========================================================================
   ESTILOS DO MODAL DE DETALHES DE PREVISÃO
   ========================================================================== */
.fd-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.fd-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.fd-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fd-section-title span.val {
    font-family: var(--font-heading);
    font-size: 16px;
}

.fd-section-title.income span.val {
    color: var(--success);
}

.fd-section-title.expense span.val {
    color: var(--danger);
}

.fd-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fd-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.fd-item span.name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fd-item span.name i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.fd-item span.val {
    font-weight: 600;
    color: white;
}

.fd-summary-box {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.fd-summary-item {
    display: flex;
    flex-direction: column;
}

.fd-summary-item span.label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.fd-summary-item span.value {
    font-size: 18px;
    font-family: var(--font-heading);
    font-weight: 700;
}

.fd-summary-item span.value.positive {
    color: var(--success);
}

.fd-summary-item span.value.negative {
    color: var(--danger);
}

/* ==========================================================================
   TELA DE LOGIN E GERENCIAMENTO DE CONTA (GLASSMORPHISM)
   ========================================================================= */

.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #060913;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-screen-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Esferas luminosas animadas de fundo */
.login-bg-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: 1;
    pointer-events: none;
}

.sphere-1 {
    width: 350px;
    height: 350px;
    background-color: var(--primary);
    top: -50px;
    left: -50px;
    animation: floatSphere 12s infinite alternate ease-in-out;
}

.sphere-2 {
    width: 400px;
    height: 400px;
    background-color: #0d9488;
    bottom: -100px;
    right: -50px;
    animation: floatSphere 15s infinite alternate-reverse ease-in-out;
}

.sphere-3 {
    width: 280px;
    height: 280px;
    background-color: #db2777;
    top: 40%;
    right: 25%;
    animation: floatSphere 10s infinite alternate ease-in-out 2s;
}

@keyframes floatSphere {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.1); }
}

/* Card de Login */
.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    background: rgba(13, 18, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(255, 255, 255, 0.02);
    animation: loginCardIntro 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.login-brand h2 {
    font-size: 24px;
    font-weight: 800;
}

.login-brand h2 span {
    background: linear-gradient(to right, #818cf8, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-full {
    width: 100%;
    padding: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.login-footer a:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* Gerenciamento de Conta nas Configurações */
.settings-form {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-form.active {
    display: block;
}

.settings-tab-buttons .btn {
    transition: var(--transition-fast);
}

.settings-tab-buttons .btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 24px 20px;
        max-width: 92%;
    }
    .login-brand {
        margin-bottom: 20px;
    }
    .login-brand h2 {
        font-size: 20px;
    }
    .login-header {
        margin-bottom: 20px;
    }
    .login-header h3 {
        font-size: 18px;
    }
}


