/* Layout Fix CSS - Sistema de Gestão Financeira */

/* Reset e base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

/* Container principal */
.layout-container {
    display: flex;
    height: 100vh;
    background-color: #f3f4f6;
}

/* Sidebar */
.sidebar {
    width: 16rem; /* 64 * 0.25rem */
    background-color: #111827; /* gray-900 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    position: fixed;
    height: 100vh;
    z-index: 50;
}

@media (min-width: 1024px) {
    .sidebar {
        position: relative;
        transform: translateX(0);
        flex-shrink: 0;
    }
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Top navigation */
.top-nav {
    height: 4rem; /* 16 * 0.25rem */
    background-color: #1f2937; /* gray-800 */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #374151; /* gray-700 */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    z-index: 10;
    position: relative;
}

/* Page content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.content-wrapper {
    max-width: 80rem; /* 1280px */
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .content-wrapper {
        padding: 0 1.5rem;
    }
}

@media (min-width: 768px) {
    .content-wrapper {
        padding: 0 2rem;
    }
}

/* Sidebar toggle para mobile */
.sidebar-open .sidebar {
    transform: translateX(0);
}

/* Overlay para mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: none;
}

.sidebar-open .sidebar-overlay {
    display: block;
}

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* Gráficos - prevenir redimensionamento */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

.chart-container canvas {
    max-height: 200px !important;
}

/* Cards responsivos */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Tabelas responsivas */
.table-container {
    overflow-x: auto;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

/* Animações */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Correções específicas do DataTables */
.dataTables_wrapper {
    width: 100%;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alertas */
.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border-width: 1px;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Formulários */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
