:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Login page styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Header styles */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-brand {
    font-weight: 600;
}

/* Card styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

/* Dashboard cards */
.card.bg-success,
.card.bg-danger,
.card.bg-primary,
.card.bg-info {
    border-radius: 12px;
    border: none;
}

/* Category color indicator */
.category-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form styles */
.form-control,
.form-select {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Button styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 5px 10px;
}

/* Table styles */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table th {
    border-top: none;
    font-weight: 600;
    background-color: var(--light-color);
    color: var(--dark-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Badge styles */
.badge {
    font-size: 0.8em;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
}

/* Alert styles */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Modal styles */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #f1f3f4;
    padding: 20px 25px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #f1f3f4;
    padding: 20px 25px;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .container-fluid {
        padding: 15px;
    }
    
    /* Centralizar login no mobile */
    body.bg-light .container-fluid.vh-100 {
        padding: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    body.bg-light .container-fluid.vh-100 .row {
        width: 100% !important;
        margin: 0 !important;
        justify-content: center !important;
    }
    
    body.bg-light .container-fluid.vh-100 .card {
        width: 100% !important;
        max-width: 400px !important;
        margin: 0 auto !important;
    }
    
    .card-body {
        padding: 20px 15px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Mobile navigation improvements */
    .navbar-nav .nav-link {
        padding: 12px 16px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Mobile dashboard cards */
    .col-lg-3.col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Mobile forms */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Mobile tables */
    .table-responsive {
        border: none;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        font-size: 14px;
    }
    
    /* Esconder gráficos no mobile - Dashboard */
    .row .col-lg-8.mobile-chart-hide {
        display: none !important;
    }
    
    /* Esconder gráficos no mobile - Relatórios */
    #report-results .col-md-8.mobile-chart-hide {
        display: none !important;
    }
    
    /* Forçar canvas dos gráficos escondidos */
    #monthly-chart,
    #report-chart {
        display: none !important;
    }
    
    /* Resumo dos relatórios em largura total no mobile */
    .mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* Mobile recent transactions - layout igual página de transações */
    .mobile-transaction-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .mobile-transaction-info {
        width: 100%;
        order: 1;
    }
    
    .mobile-transaction-date {
        margin-bottom: 6px;
    }
    
    .mobile-transaction-desc {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 6px;
        color: #333;
    }
    
    .mobile-transaction-meta {
        margin-bottom: 8px;
    }
    
    .mobile-transaction-amount {
        width: 100% !important;
        text-align: left !important;
        order: 2;
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
    }
    
    .mobile-transaction-amount .fw-bold {
        font-size: 17px;
        font-weight: 700;
    }
    
    /* Mobile header balance info - evitar quebra de linha */
    .bg-light .d-flex {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }
    
    .bg-light .d-flex > div {
        width: 100%;
    }
    
    /* Saldo total e última atualização em linhas separadas */
    .bg-light .d-flex > div:first-child {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .bg-light .d-flex > div:first-child small {
        font-size: 12px;
    }
    
    /* Auto-atualizar sem quebra de linha */
    .bg-light .d-flex > div:last-child {
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .form-check {
        margin-bottom: 0;
    }
    
    .form-check-label {
        font-size: 11px !important;
    }
    
    /* Mobile buttons */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 10px;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    /* Mobile cards grid */
    .row .col-md-4 {
        margin-bottom: 15px;
    }
    
    /* Mobile filters */
    #filter-form .col-md-2,
    #filter-form .col-md-3 {
        margin-bottom: 10px;
    }
    
    /* Mobile footer reorganization */
    footer .row {
        flex-direction: column-reverse;
    }
    
    footer .col-md-6:first-child {
        margin-top: 15px;
        text-align: center;
    }
    
    footer .col-md-6:last-child {
        text-align: center;
    }
    
    footer .d-flex {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Hide some columns on mobile */
    @media (max-width: 576px) {
        .table .d-none-mobile {
            display: none !important;
        }
        
        /* Stack buttons vertically */
        .btn-group {
            flex-direction: column;
        }
        
        .btn-group .btn {
            border-radius: 0.375rem !important;
            margin-bottom: 5px;
        }
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .container-fluid {
        padding: 20px;
    }
    
    .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .modal-dialog {
        max-width: 600px;
    }
}

/* Desktop responsive */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .card,
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .table tbody tr:hover {
        background-color: rgba(0, 123, 255, 0.1);
    }
}

/* Loading animation */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for page transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Chart container */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Chart.js mobile fix */
@media (max-width: 768px) {
    .chart-container {
        height: 300px;
    }
    
    /* Garantir que o canvas seja responsivo */
    .chart-container canvas {
        max-width: 100% !important;
        max-height: 300px !important;
    }
}

/* Status indicators */
.status-positive {
    color: var(--success-color);
}

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

.status-neutral {
    color: var(--info-color);
}

/* Category grid improvements */
.category-grid .card {
    min-height: 140px;
}

/* Account type icons */
.account-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.7;
}

/* Utility classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-start-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-start-danger {
    border-left: 4px solid var(--danger-color) !important;
}

.border-start-primary {
    border-left: 4px solid var(--primary-color) !important;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
