
/* Audit Logs Page Styles */
.audit-logs-content {
    padding: 20px;
}

/* Filters Section */
.filters-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #374151;
    font-size: 14px;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Project Filter Styles */
.project-option {
    padding: 8px 0;
}

.project-option .project-name {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.project-option .project-details {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.project-option .project-type {
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.project-option .project-client {
    color: #059669;
    font-weight: 500;
}

.project-option .project-status {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

/* Select2 Customization for Project Filter */
.select2-container--default .select2-results__option--highlighted[aria-selected] .project-option {
    background: #3b82f6;
    color: white;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] .project-name {
    color: white;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] .project-details {
    color: #e0e7ff;
}

/* Project Record Display in Table */
.project-record {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-record .project-name {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.project-record .project-id {
    font-size: 12px;
    color: #6b7280;
    font-family: monospace;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

#auditLogsTable {
    width: 100%;
    border-collapse: collapse;
}

#auditLogsTable th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 14px;
}

#auditLogsTable td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

#auditLogsTable tbody tr:hover {
    background: #f9fafb;
}

/* Action Badges */
.action-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.action-badge.login_success {
    background: #dcfce7;
    color: #166534;
}

.action-badge.login_failed {
    background: #fef2f2;
    color: #dc2626;
}

.action-badge.logout {
    background: #fef3c7;
    color: #d97706;
}

.action-badge.user_created,
.action-badge.role_created,
.action-badge.permission_created {
    background: #dbeafe;
    color: #1d4ed8;
}

.action-badge.user_updated,
.action-badge.role_updated,
.action-badge.permission_updated {
    background: #fef3c7;
    color: #d97706;
}

.action-badge.user_deleted,
.action-badge.role_deleted,
.action-badge.permission_deleted {
    background: #fef2f2;
    color: #dc2626;
}

.action-badge.permission_denied,
.action-badge.unauthorized_access_attempt {
    background: #fef2f2;
    color: #dc2626;
}

/* Details Button */
.details-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.details-btn:hover {
    background: #2563eb;
}

/* Log Details Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.log-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-group label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.detail-group span {
    color: #6b7280;
    font-size: 14px;
    word-break: break-word;
}

.detail-group pre {
    background: #f9fafb;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        padding: 10px;
    }
    
    #auditLogsTable {
        font-size: 12px;
    }
    
    #auditLogsTable th,
    #auditLogsTable td {
        padding: 8px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #374151;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Page Actions */
.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
    z-index: 100;
}

/* Export Modal Styles */
.export-modal {
    max-width: 500px !important;
}

.export-options {
    text-align: center;
}

.export-description {
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 16px;
}

.export-format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.export-format-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
}

.export-format-btn:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.export-format-btn:active {
    transform: translateY(0);
}

.format-icon {
    margin-bottom: 12px;
}

.format-icon i {
    font-size: 32px;
    color: #3b82f6;
}

.export-format-btn[data-format="excel"] .format-icon i {
    color: #16a34a;
}

.export-format-btn[data-format="json"] .format-icon i {
    color: #ea580c;
}

.export-format-btn[data-format="pdf"] .format-icon i {
    color: #dc2626;
}

.format-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.format-info p {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.export-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Loading state for export buttons */
.export-format-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.export-format-btn.loading .format-icon i {
    animation: spin 1s linear infinite;
}

/* Responsive design for export modal */
@media (max-width: 480px) {
    .export-format-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .export-format-btn {
        min-height: 100px;
        padding: 16px 12px;
    }
    
    .format-icon i {
        font-size: 28px;
    }
    
    .format-info h4 {
        font-size: 14px;
    }
    
    .format-info p {
        font-size: 11px;
    }
}

/* Select2 Customization */
.select2-container--default .select2-selection--single {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    height: 38px;
    line-height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    padding-left: 12px;
    color: #374151;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--default .select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e5e7eb;
}

.select2-container--default .select2-selection--single:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select2-container--default.select2-container--open .select2-dropdown {
    border-color: #3b82f6;
}

.select2-container--default .select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 20px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .current-page {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.pagination-info {
    color: #6b7280;
    font-size: 14px;
}
