/* Estilos para os controles de backup */
#backupControls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

#backupControls button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#backupControls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#exportBtn {
    background: #4a6bff;
    color: white;
}

#exportBtn:hover {
    background: #3554e6;
}

#importBtn {
    background: #28a745;
    color: white;
}

#importBtn:hover {
    background: #218838;
}

#syncBtn {
    background: #ffc107;
    color: #212529;
}

#syncBtn:hover {
    background: #e0a800;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    #backupControls {
        bottom: 15px;
        right: 15px;
        left: 15px;
        flex-direction: row;
        justify-content: space-around;
        padding: 12px;
    }
    
    #backupControls button {
        flex: 1;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Animação do botão de sincronização quando ativo */
#syncBtn.syncing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Estilos para as notificações */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    color: white;
    border-radius: 6px;
    z-index: 10000;
    max-width: 350px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.notification.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
}

/* Indicador de status de sincronização */
.sync-indicator {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sync-indicator.show {
    opacity: 1;
}

/* Melhoria nos alertas do dashboard */
.alerta-item {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alerta-item:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Melhorias nos cards de estatísticas */
.stat-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card p {
    margin: 0;
    font-size: 2em;
    font-weight: bold;
    color: #495057;
}

/* Melhorias nos status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-ativo {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-inativo {
    background: linear-gradient(135deg, #f8d7da, #f1b0b7);
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.status-vencido {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Melhorias nos botões de ação */
.btn-acao {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 0 2px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    font-size: 12px;
}

.btn-acao:hover {
    background: #f8f9fa;
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-acao:active {
    transform: translateY(0);
}

/* Melhorias nas tabelas */
table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 12px;
    border-bottom: 2px solid #dee2e6;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    background: #fff;
    transition: background-color 0.2s ease;
}

table tbody tr:hover td {
    background: #f8f9fa;
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Melhorias nos modais */
.modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: none;
}

.modal-content h3 {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    margin: 0;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid #dee2e6;
    color: #495057;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a6bff;
    box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.1);
}

/* Melhorias no calendário */
.month-header h3 {
    text-align: center;
    margin: 0;
    padding: 15px;
    background: linear-gradient(135deg, #4a6bff, #6c5ce7);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.days-of-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.days-of-week span {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.day {
    padding: 12px;
    text-align: center;
    border-right: 1px solid #f1f3f4;
    border-bottom: 1px solid #f1f3f4;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day:hover {
    background: #f8f9fa;
}

.day.current-day {
    background: linear-gradient(135deg, #4a6bff, #6c5ce7);
    color: white;
    font-weight: bold;
}

.day.has-event {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    position: relative;
}

.day.has-event::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: #dc3545;
    border-radius: 50%;
}

.day.empty {
    background: #f8f9fa;
    cursor: default;
}

/* Indicador de conectividade */
.connectivity-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1000;
    transition: all 0.3s ease;
}

.connectivity-indicator.online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connectivity-indicator.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

/* Animações de carregamento */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(74, 107, 255, 0.2),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Melhorias responsivas */
@media (max-width: 768px) {
    .stat-card p {
        font-size: 1.5em;
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px 6px;
    }
    
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .days-grid .day {
        min-height: 35px;
        padding: 8px 4px;
        font-size: 12px;
    }
    
    #backupControls {
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: 10px;
        flex-direction: row;
        justify-content: space-around;
    }
    
    #backupControls button {
        flex: 1;
        margin: 0 2px;
        padding: 8px;
        font-size: 11px;
    }
}

:root {
    --primary-color: #4a6bff;
    --secondary-color: #f8f9fa;
    --danger-color: #ff4a6b;
    --warning-color: #ffb74a;
    --success-color: #4aff6b;
    --text-color: #333;
    --light-text: #777;
    --border-color: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

nav button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

nav button:hover {
    background-color: #3a5cda; /* Cor um pouco mais escura no hover */
}

main section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: none;
}

main section.active {
    display: block;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    color: var(--text-color);
    margin-bottom: 15px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    color: var(--light-text);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-card p {
    font-size: 28px; /* Aumentado para mais destaque */
    font-weight: bold;
    color: var(--primary-color);
}

.chart-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    height: 350px; /* Aumentado para melhor visualização */
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    max-width: 100%;
    max-height: 100%;
}

.alertas {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.alerta-item {
    padding: 12px;
    border-left: 4px solid var(--warning-color);
    margin-bottom: 10px;
    background-color: #fff9e6; /* Cor de fundo mais clara para alerta */
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.alerta-item:hover {
    background-color: #ffecc6;
}


.filtros {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filtros input, .filtros select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    flex: 1; /* Permite que os campos cresçam */
    min-width: 150px; /* Garante um tamanho mínimo */
}

.filtros button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s ease;
}

.filtros button:hover {
    background-color: #3a5cda;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: #f1f1f1;
    font-weight: 600;
    color: var(--primary-color);
}

table tr:last-child td {
    border-bottom: none; /* Remove a borda da última linha */
}

table tbody tr:hover {
    background-color: #f9f9f9; /* Leve destaque ao passar o mouse */
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize; /* Capitaliza a primeira letra */
}

.status-ativo {
    background-color: #e6f7ee;
    color: #00a854;
}

.status-inativo {
    background-color: #fff2f0;
    color: #f5222d;
}

.status-vencido {
    background-color: #fff7e6;
    color: #fa8c16;
}

.btn-acao {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    margin: 0 5px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.btn-acao:hover {
    color: #3a5cda;
}

/* Estilos para modais */
.modal {
    display: none;
    position: fixed;
    z-index: 1000; /* Garante que o modal esteja acima de tudo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Fundo semi-transparente */
    justify-content: center; /* Centraliza verticalmente e horizontalmente */
    align-items: center;
}

.modal-content {
    background-color: white;
    margin: auto; /* Remove margin-top fixo */
    padding: 30px; /* Aumentado padding */
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2); /* Sombra mais pronunciada */
    width: 90%;
    max-width: 600px;
    position: relative; /* Para posicionamento do botão fechar */
}

.close {
    color: #aaa;
    position: absolute; /* Posicionamento absoluto no canto */
    top: 10px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover,
.close:focus {
    color: #777;
    text-decoration: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 107, 255, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px; /* Aumentado padding */
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

button[type="submit"]:hover {
    background-color: #3a5cda;
}

/* Estilos para Vencimentos */
.calendario-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#calendario {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

#calendario .month-header {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    color: var(--primary-color);
}

#calendario .days-of-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--light-text);
}

#calendario .days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

#calendario .day {
    padding: 8px;
    text-align: center;
    border: 1px solid #eee;
    border-radius: 4px;
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#calendario .day.empty {
    background-color: #f5f5f5;
    border: 1px dashed #eee;
}

#calendario .day.current-day {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    border-color: var(--primary-color);
}

#calendario .day.has-event {
    background-color: var(--warning-color);
    color: white;
    font-weight: bold;
    cursor: help;
    border-color: var(--warning-color);
}
#calendario .day.has-event:hover {
    opacity: 0.9;
}


#listaVencimentos {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

#listaVencimentos h3 {
    margin-top: 0;
}

#listaVencimentos ul {
    list-style: none;
    padding: 0;
}

#listaVencimentos li {
    padding: 10px;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#listaVencimentos li:last-child {
    border-bottom: none;
}

.filtros-vencimento {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filtros-vencimento button {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filtros-vencimento button:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Media Queries para Responsividade */
@media (max-width: 768px) {
    .calendario-container {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    nav {
        width: 100%;
        justify-content: space-around; /* Distribui os botões uniformemente */
    }
    
    nav button {
        flex: 1;
        text-align: center;
        padding: 10px 8px; /* Ajuste o padding para telas menores */
    }

    .filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .filtros input, .filtros select, .filtros button {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr; /* Uma coluna em telas muito pequenas */
    }

    nav {
        flex-direction: column;
    }
}
/* Estilos para a página de login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    padding: 20px;
}

.login-box {
    background: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background-color: #0056b3;
}

.error-message {
    color: #d9534f;
    margin-top: 15px;
    font-size: 14px;
    display: block;
}