* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2px;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: #f0f2f5;
    flex-direction: row;
    /* Garante direção horizontal */
    justify-content: flex-start;
}

.app-sidebar {
    width: 160px;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    position: fixed;
    left: 0;
    /* Fixa à esquerda */
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.app-main {
    flex: 1;
    margin-left: 0px;
    /* Espaço para o sidebar fixo */
    padding: 0px;
    width: 100%;
    max-width: 100%;
}

/* Para telas menores */
@media (max-width: 992px) {
    .app-main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, #333, #c41e1e);
    color: white;
    padding: 20px 30px;
    border-radius: 12px 12px 0 0;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header h1 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.header h1 i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 50px;
}

.user-info i {
    font-size: 1.3rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 30px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    color: #333;
    font-size: 1rem;
}

.tab:hover {
    border-color: #c41e1e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(196, 30, 30, 0.1);
}

.tab.active {
    background: #c41e1e;
    border-color: #c41e1e;
    color: white;
}

.tab-content {
    display: none;
}

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

/* Cards */
.periodo-info {
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 6px solid #c41e1e;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.periodo-info i {
    color: #c41e1e;
    font-size: 1.5rem;
}

.periodo-info span {
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
}

.resumo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.resumo-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s;
}

.resumo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.resumo-card.receita {
    border-bottom: 4px solid #28a745;
}

.resumo-card.despesa {
    border-bottom: 4px solid #c41e1e;
}

.resumo-card.saldo {
    border-bottom: 4px solid #333;
}

.resumo-card h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resumo-card .valor {
    font-size: 2rem;
    font-weight: bold;
}

.resumo-card .valor.positivo {
    color: #28a745;
}

.resumo-card .valor.negativo {
    color: #c41e1e;
}

/* Tabelas */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.table-container thead {
    background: linear-gradient(135deg, #333, #444);
}

.table-container th {
    color: white;
    padding: 18px 15px;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.table-container td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    color: #444;
}

.table-container tbody tr:hover {
    background: #f9f9f9;
}

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

/* Botões */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.btn-primary {
    background: #c41e1e;
    color: white;
}

.btn-primary:hover {
    background: #a01818;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(196, 30, 30, 0.3);
}

.btn-secondary {
    background: #333;
    color: white;
}

.btn-secondary:hover {
    background: #444;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(51, 51, 51, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid #c41e1e;
    color: #c41e1e;
}

.btn-outline:hover {
    background: #c41e1e;
    color: white;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Formulários */
.form-container {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #c41e1e;
    box-shadow: 0 0 0 4px rgba(196, 30, 30, 0.1);
}

input.error,
select.error {
    border-color: #c41e1e;
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* Footer da Tabela */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: white;
    border-top: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.record-info {
    color: #666;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-info i {
    color: #c41e1e;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box input {
    width: 300px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

/* Paginação */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 20px 0;
}

.pagination .btn {
    min-width: 45px;
    padding: 10px;
    justify-content: center;
}

/* Alertas e Notificações */
.alert {
    padding: 18px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.alert i {
    font-size: 1.3rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 6px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 6px solid #c41e1e;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 6px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 6px solid #17a2b8;
}

/* Loading */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.loading.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #c41e1e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #333;
}

.badge-danger {
    background: #c41e1e;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

/* Menu Cards */
.menu-item {
    text-align: center;
    padding: 25px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.menu-item:hover {
    background: white;
    border-color: #c41e1e;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(196, 30, 30, 0.15);
}

.menu-item i {
    font-size: 2.5rem;
    transition: transform 0.3s;
}

.menu-item:hover i {
    transform: scale(1.1);
}

.menu-item span {
    font-weight: 600;
    font-size: 1rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

.dashboard-card .card-header h3 {
    color: #666;
    font-size: 1.1rem;
    font-weight: 600;
}

.dashboard-card .card-header i {
    font-size: 2rem;
    opacity: 0.3;
}

.dashboard-card .card-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.dashboard-card .card-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

/* Filtros */
.filter-bar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.botoes-esquerda {
    display: flex;
    justify-content: flex-start;
    /* Alinha os botões à esquerda */
    gap: 10px;
    /* Espaçamento entre os botões */
}

.filter-group label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.filters-grid {
    display: grid;
    /* Define a estrutura das colunas, por exemplo, 3 colunas iguais */
    grid-template-columns: repeat(3, auto);

    /* ALINHAMENTO PRINCIPAL */
    justify-items: start;
    /* Alinha os botões à esquerda dentro da célula */
    justify-content: start;
    /* Alinha todo o grid à esquerda do container */

    gap: 10px;
    /* Espaçamento entre os botões */
}

/* Responsividade */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        border-radius: 8px;
    }

    .header h1 {
        justify-content: center;
    }

    .user-info {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        justify-content: center;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-container {
        padding: 20px;
    }

    .resumo-cards {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        text-align: center;
    }

    .pagination {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.3rem;
    }

    .header h1 i {
        font-size: 1.5rem;
    }

    .periodo-info {
        flex-direction: column;
        text-align: center;
    }

    .record-info {
        flex-direction: column;
        text-align: center;
    }

    .dashboard-card .card-value {
        font-size: 1.5rem;
    }
}

/* Impressão */
@media print {

    .header,
    .btn-group,
    .pagination,
    .table-footer,
    .search-box,
    .tabs,
    .filter-bar {
        display: none !important;
    }

    .container {
        padding: 0;
    }

    table {
        border: 1px solid #ddd;
    }

    th {
        background: #f5f5f5 !important;
        color: black !important;
    }
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

::-webkit-scrollbar-thumb {
    background: #c41e1e;
    border-radius: 10px;
    border: 3px solid #f1f1f1;
}

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

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 15px;
    background: #333;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}