/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #FFFFFF;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

html {
    overflow-x: hidden;
    width: 100%;
}

/* Variáveis CSS */
:root {
    --primary-color: #000000;
    --secondary-color: #000;
    --accent-color: #fff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #f0192e47;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Página de Login */
.login-page {
    background: var(--secondary-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    padding: 40px;
    text-align: center;
}

.login-header h1 {
    color: black;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: bold;
}

.login-header p {
    color: #666;
    margin-bottom: 30px;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Botões */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    background-color: #000;
    color: #fff;
    transition: transform 0.15s ease;
}

.btn:hover {
    transform: scale(1.05);
}

.btn-primary {
    background-color: #000;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #000;
    transform: scale(1.05);
}

.btn-secondary {
    background-color: #000;
    color: white;
}

.btn-secondary:hover {
    background-color: #000;
    transform: scale(1.05);
}

.btn-success {
    background-color: #000;
    color: white;
}

.btn-success:hover {
    background-color: #000;
    transform: scale(1.05);
}

.btn-warning {
    background-color: #000;
    color: white;
}

.btn-warning:hover {
    background-color: #000;
    transform: scale(1.05);
}

.btn-danger {
    background-color: #000;
    color: white;
}

.btn-danger:hover {
    background-color: #000;
    transform: scale(1.05);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--secondary-color);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text h2 {
    color: #ffffff;
    font-size: 1.5em;
    margin-bottom: 5px;
    margin: 0;
}

.logo-text p {
    color: #ffffff;
    font-size: 0.9em;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 25px 20px;
    color: #ccc;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.menu-item:hover,
.menu-item.active {
    background-color: #333;
    color: white;
    border-left-color: white;
}

.menu-item .icon {
    margin-right: 10px;
    font-size: 1.2em;
}

/* Ícones PNG do menu */
.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
    object-fit: contain;
    flex-shrink: 0;
}

.menu-text {
    white-space: nowrap;
}

.user-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 15px;
    background-color: #333;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    flex-shrink: 0;
}

.logout-btn:hover {
    background-color: var(--danger-color);
    border-left-color: var(--danger-color);
}

/* Conteúdo Principal */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    min-height: 100vh;
    padding-bottom: 20px; /* Espaço padrão */
    width: calc(100% - 250px);
    box-sizing: border-box;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.content-header h1 {
    color: black;
    font-size: 2em;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Páginas */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* Métricas - Novo Design */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: #000000;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    color: #FFFFFF;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.metric-icon {
    font-size: 2.5em;
    margin-right: 20px;
    opacity: 0.8;
    color: #FFFFFF;
}

.metric-info h3 {
    font-size: 0.9em;
    color: #B0B0B0;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.metric-value {
    font-size: 2.2em;
    font-weight: bold;
    color: #FFFFFF;
    margin: 0;
}

/* Gráfico - Novo Design */
.chart-container {
    background: #000000;
    border-radius: 16px;
    padding: 32px 24px 24px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    color: #FFFFFF;
    position: relative;
    height: 400px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-filters {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
    flex-shrink: 0;
    padding: 0;
}

.chart-filters h3 {
    color: #FFFFFF;
    font-size: 1.5em;
    font-weight: 600;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    letter-spacing: -0.02em;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 500;
    color: #000000;
}

.filter-group input {
    background: #FFFFFF;
    border: 2px solid #000000;
    color: #000000;
    border-radius: 8px;
    padding: 8px 12px;
}

.filter-group input:focus {
    outline: none;
    border-color: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* Wrapper do gráfico */
.chart-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
    width: 100%;
}

/* Canvas do gráfico */
#revenueChart {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

/* Filtros */
.filters-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

/* Tabelas */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-box input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 300px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-actions {
    display: flex;
    gap: 5px;
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--dark-color);
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

/* Formulários em Modal */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Mensagens */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    border: 1px solid #c3e6cb;
}

/* Responsividade */
/* ============================================
   RESPONSIVIDADE MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Layout Principal */
    .app-container {
        flex-direction: column;
        padding-bottom: 70px; /* Espaço para o rodapé fixo */
    }
    
    /* Sidebar transformado em rodapé fixo */
    .sidebar {
        width: 100%;
        height: 70px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        overflow-y: visible;
        overflow-x: auto;
        border-top: 1px solid #444;
        border-left: none;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        padding: 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }
    
    /* Ocultar header do sidebar no mobile */
    .sidebar-header {
        display: none;
    }
    
    /* Ocultar user-info no mobile */
    .user-info {
        display: none;
    }
    
    /* Menu horizontal no rodapé */
    .sidebar-menu {
        display: flex;
        flex-direction: row;
        width: 100%;
        padding: 0;
        margin: 0;
        justify-content: space-around;
        align-items: stretch;
        gap: 0;
        list-style: none;
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE e Edge */
    }
    
    .sidebar-menu::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .sidebar-menu li {
        flex: 1 1 auto;
        min-width: 60px;
        max-width: none;
        display: flex;
        justify-content: center;
        align-items: stretch;
    }
    
    /* Itens do menu no rodapé */
    .menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 4px;
        width: 100%;
        height: 100%;
        min-height: 70px;
        border-left: none;
        border-top: 3px solid transparent;
        border-radius: 0;
        text-align: center;
        position: relative;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        tap-highlight-color: rgba(255, 255, 255, 0.1);
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .menu-item:hover,
    .menu-item.active {
        background-color: #333;
        border-left: none;
        border-top-color: white;
    }
    
    .menu-item:active {
        background-color: #444;
        transform: scale(0.98);
    }
    
    /* Ícones no rodapé */
    .menu-icon {
        width: 24px;
        height: 24px;
        margin-right: 0;
        margin-bottom: 4px;
        flex-shrink: 0;
    }
    
    /* Texto do menu no rodapé */
    .menu-text {
        font-size: 0.7em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        line-height: 1.2;
        display: block;
        text-align: center;
    }
    
    /* Tooltip para mobile (via atributo title) */
    .menu-item[title]:hover::after,
    .menu-item[title]:active::after {
        content: attr(title);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.75em;
        white-space: nowrap;
        margin-bottom: 5px;
        z-index: 1001;
        pointer-events: none;
    }
    
    /* Conteúdo principal no mobile */
    .main-content {
        margin-left: 0;
        margin-bottom: 70px;
        padding: 15px;
        width: 100%;
        padding-bottom: 20px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Header do conteúdo */
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .content-header h1 {
        font-size: 1.5em;
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    /* Cards de métricas - 2 colunas em tablet */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .metric-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        min-height: auto;
    }
    
    .metric-icon {
        margin-right: 0;
        margin-bottom: 10px;
        font-size: 2em;
    }
    
    .metric-info h3 {
        font-size: 0.8em;
        margin-bottom: 6px;
    }
    
    .metric-value {
        font-size: 1.6em;
    }
    
    /* Container do gráfico */
    .chart-container {
        padding: 16px;
        margin-bottom: 20px;
        border-radius: 12px;
        height: 240px;
        min-height: 240px;
    }
    
    .chart-filters {
        margin-bottom: 12px;
        flex-shrink: 0;
    }
    
    .chart-filters h3 {
        font-size: 1.1em;
    }
    
    .chart-wrapper {
        height: calc(100% - 50px);
        min-height: 180px;
    }
    
    #revenueChart {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Filtros de serviços/despesas */
    .filters-section {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .filter-group label {
        margin-bottom: 8px;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
    }
    
    /* Tabelas */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.85em;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Formulários */
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group {
        width: 100%;
    }
    
    /* Modais */
    .modal {
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Botões */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* Fechamento Mensal */
    .closure-container {
        padding: 0;
    }
    
    .period-selection {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .period-inputs {
        flex-direction: column;
        gap: 15px;
    }
    
    .items-selection {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .distribution-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .closure-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .closure-actions .btn {
        width: 100%;
    }
}

/* Mobile pequeno (iPhone, etc.) */
@media (max-width: 480px) {
    .app-container {
        padding-bottom: 65px;
    }
    
    .sidebar {
        height: 65px;
    }
    
    .main-content {
        padding: 12px;
        margin-bottom: 65px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .content-header h1 {
        font-size: 1.3em;
    }
    
    /* Cards em 1 coluna em telas muito pequenas */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .metric-card {
        padding: 14px;
    }
    
    .metric-icon {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .metric-info h3 {
        font-size: 0.75em;
    }
    
    .metric-value {
        font-size: 1.4em;
    }
    
    /* Gráfico menor */
    .chart-container {
        padding: 12px;
        height: 220px;
        min-height: 220px;
    }
    
    .chart-filters h3 {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .chart-wrapper {
        height: calc(100% - 45px);
        min-height: 160px;
    }
    
    #revenueChart {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Menu items menores */
    .menu-item {
        min-height: 65px;
        padding: 6px 2px;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
    
    .menu-icon {
        width: 22px;
        height: 22px;
        margin-bottom: 3px;
    }
    
    .menu-text {
        font-size: 0.65em;
    }
    
    /* Melhorar área de toque */
    .menu-item:active {
        background-color: #444;
        transform: scale(0.98);
    }
    
    /* Ajustar tamanho mínimo dos itens do menu em telas muito pequenas */
    .sidebar-menu li {
        min-width: 55px;
    }
    
    /* Tabelas */
    .data-table {
        font-size: 0.8em;
        min-width: 500px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .table-actions {
        flex-direction: row;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .table-actions .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Botões */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Modais */
    .modal {
        max-width: 98%;
        margin: 5px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 12px;
    }
    
    .modal-header h3 {
        font-size: 1.1em;
    }
    
    .modal-body {
        padding: 12px;
    }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content.active {
    animation: fadeIn 0.3s ease;
}

.metric-card {
    animation: fadeIn 0.3s ease;
}

/* Status Colors */
.status-paid {
    color: var(--success-color);
    font-weight: bold;
}

.status-pending {
    color: var(--warning-color);
    font-weight: bold;
}

.status-progress {
    color: var(--primary-color);
    font-weight: bold;
}

/* Campos de Parcelamento */
.installment-fields {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.installment-fields .form-row {
    margin-bottom: 0;
}

/* Detalhes de Serviços e Despesas */
.detail-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.detail-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.detail-section p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.detail-section p strong {
    color: var(--dark-color);
    font-weight: 600;
}

/* Formulários em Modal */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-text {
    font-size: 0.875em;
    color: #6c757d;
    margin-top: 5px;
}

/* Notificações Toast */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: bold;
    z-index: 9999;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    max-width: 300px;
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--danger-color);
}

.notification.warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

/* Ações da Tabela */
.table-actions {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.table-actions .btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: left;
    padding: 0;
}

/* Status Colors */
.status-paid {
    color: var(--success-color);
    font-weight: bold;
    background-color: rgba(40, 167, 69, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875em;
}

.status-pending {
    color: var(--warning-color);
    font-weight: bold;
    background-color: rgba(255, 193, 7, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875em;
}

.status-progress,
.status-em-andamento {
    color: var(--primary-color);
    font-weight: bold;
    background-color: rgba(0, 123, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875em;
}

/* Melhorias na Tabela */
.data-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.data-table td {
    vertical-align: middle;
}

/* Melhorias nos Cards */
.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Loading States */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Melhorias de Acessibilidade */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.menu-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Melhorias no Modal */
.modal {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Melhorias no Sidebar */
.sidebar {
    transition: var(--transition);
}

.menu-item {
    transition: var(--transition);
}

/* Melhorias no Header */
.content-header {
    transition: var(--transition);
}

/* Melhorias nos Filtros */
.filters-section {
    transition: var(--transition);
}

.filter-group {
    transition: var(--transition);
}

/* Melhorias na Busca */
.search-box input {
    transition: var(--transition);
}

.search-box input:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Estilos do Módulo de Fechamento Mensal */
.closure-container {
    max-width: 1200px;
    margin: 0 auto;
}

.period-selection {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.period-selection h3 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 1.3em;
}

.period-inputs {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.period-inputs .form-group {
    flex: 1;
    min-width: 150px;
}

.items-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.selection-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.selection-section h3 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 1.2em;
}

.section-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-style: italic;
}

.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.item-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    transition: var(--transition);
    cursor: pointer;
}

.item-checkbox:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

.item-checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.item-details {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 2px;
}

.item-value {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1em;
}

.period-status {
    font-weight: bold !important;
    color: var(--success-color) !important;
    font-size: 0.9em !important;
    margin-bottom: 4px !important;
}

.financial-results {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.distribution-section {
    margin-top: 0;
    padding-top: 0;
}

.distribution-section h3 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 1.3em;
    margin-top: 0;
}

.distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.distribution-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.distribution-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.distribution-card h4 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.distribution-card .percentage {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.distribution-card .amount {
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.3em;
    margin: 0;
}

.closure-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.closure-history {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.closure-history h3 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 1.3em;
}

/* Responsividade para Fechamento Mensal */
@media (max-width: 768px) {
    .items-selection {
        grid-template-columns: 1fr;
    }
    
    .period-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-inputs .form-group {
        min-width: auto;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .distribution-grid {
        grid-template-columns: 1fr;
    }
    
    .closure-actions {
        flex-direction: column;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ícones de Ação nas Tabelas */
.action-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.7;
}

.action-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

.action-icon:active {
    transform: scale(0.95);
}

/* Alinhamento dos ícones na célula */
.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: left;
}

/* Campo readonly */
.form-control[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e9ecef;
}

/* Estilos para parcelas 50/50 */
.installment-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

.installment-section h5 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.form-row .form-group {
    margin-bottom: 0;
}

#installments5050Group h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

/* Responsividade para parcelas */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
