/* Audit Page Styles - Consistent Design System */

/* Page Header Styling */
.page-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.page-header h1 {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-xs);
}

.page-header p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Card Styling */
.card {
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.card-header {
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color-light);
    padding: var(--spacing-md) var(--spacing-lg);
}

.card-title {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.card-title i {
    color: var(--brand-primary);
    opacity: 0.8;
}

.card-body {
    padding: var(--spacing-lg);
}

/* Filter Layout */
.form-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-control,
.form-select {
    height: 38px; /* Increased from 31px to prevent cutoff */
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-primary-rgb), 0.15);
    background: var(--bg-primary);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--brand-primary);
}

/* Category Filter Optimization */
#auditLogsTypeFilter {
    font-size: var(--font-size-sm);
    padding: var(--spacing-xs);
}

/* Filter Buttons */
#refreshLogsBtn,
#clearFiltersBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

#refreshLogsBtn:hover,
#clearFiltersBtn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

#clearFiltersBtn {
    color: var(--text-secondary);
    border-color: var(--border-color-light);
}

#clearFiltersBtn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color-light);
    color: var(--text-primary);
}

/* Responsive Filter Layout */
@media (max-width: 768px) {
    .col-md-3,
    .col-md-2,
    .col-md-1 {
        margin-bottom: var(--spacing-sm);
    }
    
    /* Filter buttons responsive layout */
    .d-flex.gap-2 {
        gap: var(--spacing-xs) !important;
    }
    
    #refreshLogsBtn,
    #clearFiltersBtn {
        font-size: var(--font-size-xs);
        padding: var(--spacing-xs);
    }
}

/* Table Styling */
.table-responsive {
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color-light);
}

.compact-table {
    margin-bottom: 0;
}

.compact-table thead th {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color-light);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Column Widths */
.compact-table th:nth-child(1), /* Timestamp */
.compact-table td:nth-child(1) {
    width: 15%;
}

.compact-table th:nth-child(2), /* Level */
.compact-table td:nth-child(2) {
    width: 8%;
}

.compact-table th:nth-child(3), /* Category */
.compact-table td:nth-child(3) {
    width: 12%;
}

.compact-table th:nth-child(4), /* User */
.compact-table td:nth-child(4) {
    width: 10%;
}

.compact-table th:nth-child(5), /* Action */
.compact-table td:nth-child(5) {
    width: 15%;
}

.compact-table th:nth-child(6), /* Message */
.compact-table td:nth-child(6) {
    width: 40%; /* Increased from default to give more space */
}

.compact-table tbody td {
    border-top: 1px solid var(--border-color-light);
    vertical-align: middle;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.compact-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Remove colored borders from log rows */
.compact-table tbody tr[data-category="security"],
.compact-table tbody tr[data-category="system"],
.compact-table tbody tr[data-category="audit"],
.compact-table tbody tr[data-category="demo"],
.compact-table tbody tr[data-category="api_health"] {
    border-left: none; /* Remove colored borders */
}

/* Log Message Styling */
.log-message {
    max-width: 500px; /* Increased from 300px to show more text */
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.log-message:hover {
    white-space: normal;
    word-wrap: break-word;
    max-width: none;
    color: var(--brand-primary);
}

/* Badge Styling */
.badge {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

/* Beautiful Solid Badge Colors */
.bg-primary {
    background: var(--brand-primary);
    color: white !important;
}

.bg-success {
    background: #10b981 !important;
    color: white !important;
}

.bg-info {
    background: #06b6d4 !important;
    color: white !important;
}

.bg-warning {
    background: #f59e0b !important;
    color: white !important;
}

.bg-secondary {
    background: #8b5cf6 !important;
    color: white !important;
}

.bg-danger {
    background: #ef4444 !important;
    color: white !important;
}

.bg-dark {
    background: #374151 !important;
    color: white !important;
}

.bg-purple {
    background: #8b5cf6 !important;
    color: white !important;
}

.bg-teal {
    background: #14b8a6 !important;
    color: white !important;
}

/* Button Styling */
.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--text-white);
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--text-white);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color-light);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color-light);
    color: var(--text-primary);
}

.btn-outline-secondary:disabled {
    color: var(--text-light);
    border-color: var(--border-color-light);
    background: transparent;
    opacity: 0.6;
}

/* Loading State */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Pagination Styling */
.btn-group-sm .btn {
    font-size: var(--font-size-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
}

/* Export Button Section */
.d-flex.justify-content-end.mb-3 {
    margin-top: 0;
}

/* Export Button Styling */
#exportLogsBtn {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-md);
    transition: all 0.2s ease;
    padding: var(--spacing-sm) var(--spacing-md);
}

#exportLogsBtn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        padding: var(--spacing-md);
    }
    
    .card-body {
        padding: var(--spacing-md);
    }
    

    
    .compact-table thead th,
    .compact-table tbody td {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-xs);
    }
    
    .log-message {
        max-width: 300px; /* Adjusted for tablet */
    }
    
    /* Adjust column widths for tablet */
    .compact-table th:nth-child(1), /* Timestamp */
    .compact-table td:nth-child(1) {
        width: 20%;
    }
    
    .compact-table th:nth-child(2), /* Level */
    .compact-table td:nth-child(2) {
        width: 10%;
    }
    
    .compact-table th:nth-child(3), /* Category */
    .compact-table td:nth-child(3) {
        width: 15%;
    }
    
    .compact-table th:nth-child(4), /* User */
    .compact-table td:nth-child(4) {
        width: 12%;
    }
    
    .compact-table th:nth-child(5), /* Action */
    .compact-table td:nth-child(5) {
        width: 18%;
    }
    
    .compact-table th:nth-child(6), /* Message */
    .compact-table td:nth-child(6) {
        width: 25%; /* Adjusted for tablet */
    }
    
    /* Search input adjustments for tablet */
    .col-md-4 {
        margin-bottom: var(--spacing-sm);
    }
    
    .col-md-2 {
        margin-bottom: var(--spacing-sm);
    }
    
    .col-md-1 {
        margin-bottom: var(--spacing-sm);
    }
}

@media (max-width: 576px) {
    .page-header {
        padding: var(--spacing-sm);
    }
    
    .card-body {
        padding: var(--spacing-sm);
    }
    
    .compact-table thead th,
    .compact-table tbody td {
        padding: var(--spacing-xs);
        font-size: var(--font-size-xs);
    }
    
    .log-message {
        max-width: 200px; /* Adjusted for mobile */
    }
    
    /* Adjust column widths for mobile */
    .compact-table th:nth-child(1), /* Timestamp */
    .compact-table td:nth-child(1) {
        width: 25%;
    }
    
    .compact-table th:nth-child(2), /* Level */
    .compact-table td:nth-child(2) {
        width: 12%;
    }
    
    .compact-table th:nth-child(3), /* Category */
    .compact-table td:nth-child(3) {
        width: 18%;
    }
    
    .compact-table th:nth-child(4), /* User */
    .compact-table td:nth-child(4) {
        width: 15%;
    }
    
    .compact-table th:nth-child(5), /* Action */
    .compact-table td:nth-child(5) {
        width: 20%;
    }
    
    .compact-table th:nth-child(6), /* Message */
    .compact-table td:nth-child(6) {
        width: 10%; /* Minimal width for mobile, will expand on hover */
    }
    
    /* Search input adjustments for mobile */
    .col-md-4 {
        margin-bottom: var(--spacing-sm);
    }
    
    .col-md-2 {
        margin-bottom: var(--spacing-sm);
    }
    
    .col-md-1 {
        margin-bottom: var(--spacing-sm);
    }
}
