/* ===== ESTILOS GERAIS ===== */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== RESPONSIVIDADE PARA TABELAS ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table-responsive > table {
    width: 100%;
    min-width: 600px; /* Força scroll em telas menores */
    border-collapse: collapse;
    margin-bottom: 0;
}

.table-responsive > table th {
    white-space: nowrap;
    position: relative;
}

.table-responsive > table td {
    vertical-align: middle;
}

/* Indicador visual de scroll para mobile */
.table-responsive::after {
    content: '↔ Arraste para o lado';
    display: block;
    text-align: center;
    padding: 5px;
    font-size: 12px;
    color: #6c757d;
    background: linear-gradient(to right, rgba(0,0,0,0.05) 0%, transparent 50%, rgba(0,0,0,0.05) 100%);
}

/* ===== ESTILOS RESTANTES (mantidos do seu código) ===== */
/* Navbar */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.75rem 0.75rem 0 0 !important;
    background-color: rgba(0, 0, 0, 0.03);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.025);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
    transition: background-color 0.3s ease;
}

/* Forms */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select {
    border-radius: 0.5rem;
}

/* Input Groups */
.input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    background-color: var(--light-color);
    border-color: #ced4da;
    font-weight: 600;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.75rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    border-left-color: var(--success-color);
    color: #0a3622;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left-color: var(--danger-color);
    color: #58151c;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left-color: var(--warning-color);
    color: #664d03;
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    border-left-color: var(--info-color);
    color: #055160;
}

/* Dashboard Cards */
.bg-success {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #17a2b8 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%) !important;
}

.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%) !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Empty States */
.text-muted {
    color: #6c757d !important;
}

.text-muted i {
    opacity: 0.7;
}

/* Currency Formatting */
.currency {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Badge Enhancements */
.badge {
    font-size: 0.75em;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .card {
        margin-bottom: 1rem;
        border-radius: 0.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }

    .table-responsive > table {
        min-width: 650px; /* Ajuste para mobile */
    }

    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem 0.4rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Melhorar espaçamento em mobile */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }

    /* Ajustar modais para mobile */
    .modal-dialog {
        margin: 1rem;
    }

    .modal-content {
        border-radius: 0.75rem;
    }

    /* Melhorar navegação */
    .nav-pills .nav-link {
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }

    /* Ajustar formulários */
    .form-control {
        font-size: 16px; /* Evita zoom no iOS */
    }

    .form-select {
        font-size: 16px;
    }

    /* Melhorar botões flutuantes */
    .btn-floating {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        z-index: 1050;
    }
}

/* Ajustes para telas muito pequenas */
@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .btn-group-vertical .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* Tornar cards empilhados em telas pequenas */
    .row .col-md-6,
    .row .col-lg-4,
    .row .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Ajustar navbar brand */
    .navbar-brand {
        font-size: 1.1rem;
    }

    /* Ajustar dropdown menu */
    .dropdown-menu {
        min-width: 250px;
        font-size: 0.9rem;
    }
    
    /* Ajustes específicos para tabelas em mobile */
    .table-responsive::after {
        content: '↔ Deslize para o lado';
        font-size: 11px;
        padding: 3px;
    }
}

/* Dark theme styles */
[data-bs-theme="dark"] body {
    background-color: #121212;
}

[data-bs-theme="dark"] .card {
    background-color: #1e1e1e;
    border: 1px solid #333;
}

[data-bs-theme="dark"] .card-header {
    background-color: #2d2d30;
    border-bottom-color: #333;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    color: #fff;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.075);
}

[data-bs-theme="dark"] .form-control {
    background-color: #2d2d30;
    border-color: #495057;
    color: #fff;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: #2d2d30;
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

[data-bs-theme="dark"] .form-select {
    background-color: #2d2d30;
    border-color: #495057;
    color: #fff;
}

[data-bs-theme="dark"] .btn-outline-primary {
    color: #6ea8fe;
    border-color: #6ea8fe;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
    color: #000;
}

[data-bs-theme="dark"] .alert-success {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: #25835454;
    color: #75dd99;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: #dc354554;
    color: #f58c9a;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: #ffc10754;
    color: #ffda6a;
}

[data-bs-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.2);
    border-color: #0dcaf054;
    color: #86e0f7;
}

[data-bs-theme="dark"] .table-responsive::after {
    color: #aaa;
    background: linear-gradient(to right, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
}

/* Custom utilities */
.text-nowrap {
    white-space: nowrap !important;
}

.cursor-pointer {
    cursor: pointer;
}

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

/*Navbar mobile styles */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    background-image: none;
    width: 1.5rem;
    height: 1.5rem;
    position: relative;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after,
.navbar-toggler-icon {
    display: block;
    content: '';
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
}

.navbar-toggler-icon::before {
    position: absolute;
    top: 4px;
    width: 100%;
}

.navbar-toggler-icon::after {
    position: absolute;
    bottom: 4px;
    width: 100%;
}

/* Melhorar responsividade da navbar */
@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-nav {
        margin-bottom: 0.5rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        margin: 0.25rem 0;
        border-radius: 0.375rem;
    }

    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* Dark theme navbar adjustments */
[data-bs-theme="dark"] .navbar-collapse {
    border-top-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Custom utilities */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* AI Summary Styles */
#ai-summary-container {
    animation: fadeIn 0.5s ease-out;
}

#ai-summary-content {
    white-space: pre-wrap;
    line-height: 1.6;
}

#ai-loading {
    padding: 2rem 0;
}

/* Status Indicators */
.status-positive {
    color: var(--success-color);
    font-weight: bold;
}

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

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

/* Estilos personalizados */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.table th {
    border-top: none;
}

.btn-outline-danger:hover {
    color: white;
}

.alert {
    border: none;
    border-radius: 8px;
}

.financial-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
}

.debt-card {
    transition: transform 0.2s;
}

.debt-card:hover {
    transform: translateY(-2px);
}

.projection-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.projection-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Tema escuro */
[data-bs-theme="dark"] .card {
    box-shadow: 0 2px 4px rgba(255,255,255,0.1);
}

[data-bs-theme="dark"] .projection-table {
    background: var(--bs-dark);
}

[data-bs-theme="dark"] .projection-table th {
    background-color: var(--bs-secondary);
}

[data-bs-theme="dark"] .financial-summary {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Login page styles */
.min-vh-100 {
    min-height: 100vh;
}

.login-card {
    border-radius: 15px;
}

/* Melhorias para modal de mensagens */
.modal-content {
    border-radius: 1rem;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 1rem 1rem 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0 0 1rem 1rem;
}

/* Melhorar navbar dropdown */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

/* Estilo para campo obrigatório */
.required {
    color: var(--danger-color);
}

/* Melhorar formulários */
.form-floating {
    position: relative;
}

.form-floating > .form-control {
    padding: 1rem 0.75rem 0.25rem 0.75rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 0.75rem;
    margin-bottom: 0;
    font-size: 1rem;
    line-height: 1.25;
    color: #6c757d;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    transition: all 0.1s ease-in-out;
    pointer-events: none;
}

/* DataTables styles */
.dataTables_wrapper .dt-buttons {
    margin-bottom: 0.5rem;
}