/* Estilos específicos para Auditoria de Logs */

/* Header padronizado */
.app-bar {
    background: #1976d2 !important;
    color: white;
    padding: 15px 20px !important;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.app-bar h1 {
    margin: 0;
    font-size: 1.3rem !important;
    font-weight: 500;
    flex: 1;
}

.app-bar .menu-btn {
    background: rgba(255,255,255,0.2) !important;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

.app-bar .menu-btn:hover {
    background: rgba(255,255,255,0.3) !important;
}

.app-bar .menu-btn .material-icons {
    font-size: 24px;
}

/* Corrigir sobreposição do header no desktop */
.content {
    margin-top: 64px !important;
    padding-top: 20px;
}

@media (min-width: 769px) {
    .content {
        margin-top: 64px !important;
        padding-top: 24px;
    }
    
    .stats-container {
        margin-top: 0;
        padding-top: 0;
    }
}

.refresh-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.refresh-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Estatísticas */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 48px;
}

.stat-icon.success {
    color: #2e7d32;
}

.stat-icon.error {
    color: #c62828;
}

.stat-icon.warning {
    color: #f57c00;
}

.stat-icon.info {
    color: #1976d2;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

/* Filtros */
.filters-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.filter-select,
.filter-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 180px;
    transition: border-color 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #1976d2;
}

/* Tabela de Logs */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    margin-bottom: 20px;
}

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

.logs-table thead {
    background: #f5f5f5;
}

.logs-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.logs-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

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

.logs-table td {
    padding: 16px;
    color: #666;
}

.log-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-login-sucesso {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-login-falha {
    background: #ffebee;
    color: #c62828;
}

.badge-logout {
    background: #fff3e0;
    color: #f57c00;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-email {
    color: #888;
    font-size: 13px;
}

.ip-address {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #555;
}

.user-agent {
    font-size: 12px;
    color: #999;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.btn-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-pagination:hover:not(:disabled) {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading.hidden {
    display: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .material-icons {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 16px;
    }
    
    .page-title h2 {
        font-size: 24px;
        text-align: center;
    }
    
    .page-title p {
        text-align: center;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin: 0 -16px;
        padding: 16px;
    }
    
    .filters-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .filter-group,
    .filter-select,
    .filter-input {
        width: 100%;
        min-width: auto;
    }
    
    .table-card {
        margin: 0 -16px;
        border-radius: 0;
    }
    
    .table-header {
        padding: 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .table-container {
        font-size: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .logs-table {
        min-width: 600px;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 12px 8px;
        white-space: nowrap;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .btn-pagination {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 12px;
    }
    
    .page-title h2 {
        font-size: 20px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
        margin: 0 -12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .filters-container {
        padding: 12px;
    }
    
    .table-header {
        padding: 12px;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    /* Esconder apenas colunas menos importantes em telas pequenas */
    .logs-table th:nth-child(1),
    .logs-table td:nth-child(1),
    .logs-table th:nth-child(6),
    .logs-table td:nth-child(6) {
        display: none;
    }
    
    .logs-table {
        min-width: 500px;
    }
    
    /* Ajustar larguras das colunas visíveis */
    .logs-table th:nth-child(2), /* Data/Hora */
    .logs-table td:nth-child(2) {
        width: 120px;
        min-width: 120px;
    }
    
    .logs-table th:nth-child(3), /* Usuário */
    .logs-table td:nth-child(3) {
        width: 100px;
        min-width: 100px;
    }
    
    .logs-table th:nth-child(4), /* Ação */
    .logs-table td:nth-child(4) {
        width: 120px;
        min-width: 120px;
    }
    
    .logs-table th:nth-child(5), /* IP */
    .logs-table td:nth-child(5) {
        width: 100px;
        min-width: 100px;
    }
    
    /* Ajustar badges para mobile */
    .status-badge,
    .action-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    /* Ajustar botões para mobile */
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-pagination {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 32px;
    }
}

/* Telas muito pequenas (smartphones antigos) */
@media (max-width: 375px) {
    .page-header {
        padding: 8px;
    }
    
    .page-title h2 {
        font-size: 18px;
    }
    
    .filters-container {
        padding: 8px;
    }
    
    .table-header {
        padding: 8px;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 6px 2px;
        font-size: 10px;
    }
    
    /* Esconder apenas colunas menos importantes em telas muito pequenas */
    .logs-table th:nth-child(1),
    .logs-table td:nth-child(1),
    .logs-table th:nth-child(6),
    .logs-table td:nth-child(6) {
        display: none;
    }
    
    .logs-table {
        min-width: 450px;
    }
    
    /* Ajustar larguras das colunas para telas muito pequenas */
    .logs-table th:nth-child(2), /* Data/Hora */
    .logs-table td:nth-child(2) {
        width: 100px;
        min-width: 100px;
        font-size: 9px;
    }
    
    .logs-table th:nth-child(3), /* Usuário */
    .logs-table td:nth-child(3) {
        width: 80px;
        min-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .logs-table th:nth-child(4), /* Ação */
    .logs-table td:nth-child(4) {
        width: 100px;
        min-width: 100px;
    }
    
    .logs-table th:nth-child(5), /* IP */
    .logs-table td:nth-child(5) {
        width: 80px;
        min-width: 80px;
        font-size: 9px;
    }
    
    /* Badges ainda menores */
    .status-badge,
    .action-badge {
        font-size: 8px;
        padding: 1px 3px;
        min-width: 50px;
    }
    
    .action-badge .material-icons {
        font-size: 10px;
    }
}

/* Melhorias para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .page-header {
        padding: 20px;
    }
    
    .stats-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .filters-container {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .filter-group {
        min-width: 200px;
        flex: 1;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 14px 10px;
    }
}

