/* Global Styles */
body {
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Metric Cards */
.metric-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 20px;
    flex-shrink: 0;
}

.metric-card-primary .metric-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.metric-card-success .metric-icon {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #155724;
}

.metric-card-info .metric-icon {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: #004085;
}

.metric-card-warning .metric-icon {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: #856404;
}

.metric-card-secondary .metric-icon {
    background: linear-gradient(135deg, #868e96 0%, #6c757d 100%);
    color: white;
}

.metric-content {
    flex-grow: 1;
}

.metric-label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    color: #212529;
    line-height: 1;
    margin-bottom: 4px;
}

.metric-detail {
    font-size: 13px;
    color: #6c757d;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #e9ecef;
    padding: 1.25rem;
}

.card-header h5 {
    color: #333;
    font-weight: 600;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

.table td {
    vertical-align: middle;
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

/* Role Badges */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-administrator {
    background-color: #dc3545;
    color: white;
}

.role-extended {
    background-color: #fd7e14;
    color: white;
}

.role-standard {
    background-color: #0d6efd;
    color: white;
}

.role-employee {
    background-color: #198754;
    color: white;
}

.role-restricted {
    background-color: #6c757d;
    color: white;
}

.role-unknown {
    background-color: #adb5bd;
    color: white;
}

/* Status Badges */
.bg-success {
    background-color: #28a745 !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

/* Audit Timeline */
.day-header {
    background-color: #f8f9fa;
    padding: 12px 16px;
    margin-bottom: 16px;
    margin-top: 24px;
    border-radius: 6px;
    border-left: 4px solid #0d6efd;
}

.day-header:first-child {
    margin-top: 0;
}

.day-events {
    margin-bottom: 24px;
}

/* Event Cards */
.event-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.event-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

.event-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 16px;
    flex-shrink: 0;
}

.event-success {
    background-color: #d4edda;
    color: #155724;
}

.event-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.event-warning {
    background-color: #fff3cd;
    color: #856404;
}

.event-primary {
    background-color: #cfe2ff;
    color: #084298;
}

.event-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

.event-default {
    background-color: #f8f9fa;
    color: #495057;
}

.event-meta {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 4px;
}

.event-time {
    color: #6c757d;
    font-size: 0.875rem;
    white-space: nowrap;
}

.event-details {
    margin-top: 8px;
}

.event-details .badge {
    margin-right: 8px;
    margin-top: 4px;
    font-weight: normal;
}

.event-context {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
}

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

/* Form Controls */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: #0d6efd;
    color: #0d6efd;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    background-color: transparent;
    border-bottom-color: #0d6efd;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Pagination */
.d-flex.justify-content-between {
    margin-top: 1rem;
}

/* Table Responsive */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

/* Scrollbar Styling */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Alert */
.alert {
    border-radius: 6px;
}

/* Icons */
.bi {
    font-size: 1.1em;
    vertical-align: middle;
}

/* Utility Classes */
.text-muted {
    color: #6c757d !important;
}

/* Empty State */
.alert-info {
    background-color: #cfe2ff;
    border-color: #b6d4fe;
    color: #084298;
}

/* Responsive */
@media (max-width: 768px) {
    /* Container and padding */
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Navbar adjustments */
    .navbar .navbar-brand {
        font-size: 14px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    .navbar .dropdown .btn {
        font-size: 12px;
        padding: 4px 8px;
    }

    /* Metric cards - stack vertically on mobile */
    .metric-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .metric-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
        margin-right: 12px;
    }

    .metric-value {
        font-size: 24px;
    }

    .metric-label {
        font-size: 12px;
    }

    .metric-detail {
        font-size: 11px;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 15px;
    }

    .card-header {
        padding: 12px;
    }

    .card-header h5 {
        font-size: 16px;
    }

    .card-body {
        padding: 12px;
    }

    /* Tabs - make scrollable on mobile */
    .nav-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 13px;
    }

    /* Table adjustments */
    .table-responsive {
        font-size: 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px; /* Force horizontal scroll instead of wrapping */
    }

    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.5em;
    }

    /* Button groups - wrap on mobile */
    .btn-group {
        flex-wrap: wrap;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Event cards */
    .event-card {
        padding: 12px;
    }

    .event-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        margin-right: 12px;
    }

    .user-avatar,
    .avatar-circle {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .event-time {
        font-size: 0.7rem;
    }

    .day-header h6 {
        font-size: 0.85rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Form controls */
    .form-control,
    .form-select {
        font-size: 14px;
    }

    .form-label {
        font-size: 13px;
    }

    /* User actions buttons */
    .user-actions {
        flex-direction: column;
        gap: 4px;
    }

    .user-actions .btn {
        width: 100%;
        text-align: left;
    }

    /* Pagination */
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .pagination-info,
    .pagination-size {
        font-size: 12px;
        text-align: center;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 12px;
    }

    /* Hide some less critical columns on very small screens */
    .table .d-none-mobile {
        display: none !important;
    }

    /* Alert messages */
    .alert {
        font-size: 13px;
        padding: 10px;
    }

    /* Domain chart */
    .domain-chart {
        padding: 8px;
    }

    .domain-label {
        font-size: 12px;
    }

    /* Activity feed */
    .activity-message {
        font-size: 0.85rem;
    }

    .activity-meta {
        font-size: 0.75rem;
    }

    /* Spacing utilities for mobile */
    .mb-4,
    .my-4 {
        margin-bottom: 1.5rem !important;
    }

    .mt-4 {
        margin-top: 1.5rem !important;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 576px) {
    .navbar .navbar-brand {
        font-size: 12px !important;
        max-width: 150px;
    }

    .navbar .navbar-brand i {
        display: none; /* Hide icon on very small screens */
    }

    .metric-card {
        flex-direction: column;
        text-align: center;
    }

    .metric-icon {
        margin-right: 0;
        margin-bottom: 12px;
    }

    .card-header h5 {
        font-size: 14px;
    }

    .btn {
        font-size: 13px;
    }

    /* Stack action buttons vertically */
    .d-flex.gap-2 {
        flex-direction: column !important;
    }

    .d-flex.gap-2 .btn {
        width: 100%;
    }

    /* Make modals full screen on very small devices */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: fadeIn 0.3s ease;
}

/* Dashboard Pending Approvals Table */
#dashboardPendingApprovals td {
    vertical-align: middle;
}

/* Approval History Table */
#approvalHistoryBody td {
    vertical-align: middle;
}

/* Sticky table headers */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}

/* Navbar centered branding */
.navbar .container-fluid {
    display: flex;
    align-items: center;
}

/* Compact button groups in tables */
.table .btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Domain Activity Chart */
.domain-chart {
    padding: 10px;
}

.domain-bar-item {
    margin-bottom: 15px;
}

.domain-label {
    font-size: 14px;
    color: #333;
}

.domain-count {
    font-size: 12px;
}

.progress {
    background-color: #e9ecef;
}

/* Activity Feed Styles */
.activity-feed-list {
    background-color: #fff;
}

.activity-group-header {
    font-size: 0.875rem;
    color: #495057;
    background-color: #f8f9fa !important;
    position: sticky;
    top: 0;
    z-index: 5;
}

.activity-feed-item {
    transition: background-color 0.15s ease;
}

.activity-feed-item:hover {
    background-color: #f8f9fa;
}

.activity-icon-sm {
    font-size: 14px;
}

.activity-message {
    font-size: 0.9375rem;
    color: #212529;
}

.activity-meta {
    margin-top: 4px;
}

/* Health Score Circle */
.health-score-circle {
    display: inline-block;
}

.health-score-circle svg {
    transform: rotate(-90deg);
}

.health-score-circle .circle-bg {
    stroke: #eee;
}

.health-score-circle .circle {
    transition: stroke-dasharray 0.6s ease;
}

.health-score-circle .score-text {
    transform: rotate(90deg);
    transform-origin: center;
}

/* Data Health Cards */
#dataStatsContainer .border {
    transition: all 0.2s ease;
}

#dataStatsContainer .border:hover {
    border-color: #0d6efd !important;
    transform: translateY(-2px);
}

/* Leaderboard Styles */
#activityLeaderboard .list-group-item {
    border-left: none;
    border-right: none;
    transition: background-color 0.15s ease;
}

#activityLeaderboard .list-group-item:hover {
    background-color: #f8f9fa;
}

#activityLeaderboard .list-group-item:first-child {
    border-top: none;
}

/* Issues & Warnings Lists */
#issuesList .list-group-item,
#warningsList .list-group-item {
    border-left: none;
    border-right: none;
}

/* Recommendations Cards */
#recommendationsList .card {
    transition: all 0.2s ease;
}

#recommendationsList .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Activity Summary Stats */
#activitySummaryStats .border {
    transition: all 0.2s ease;
}

#activitySummaryStats .border:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Job Status Badges in Health Report */
#jobStatusBreakdown .badge {
    font-size: 0.8rem;
    padding: 0.4em 0.8em;
}

/* User Management Action Buttons */
.user-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.user-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-deactivate {
    background-color: #ffc107;
    color: #000;
    border: none;
}

.btn-deactivate:hover {
    background-color: #e0a800;
    color: #000;
}

.btn-activate {
    background-color: #28a745;
    color: #fff;
    border: none;
}

.btn-activate:hover {
    background-color: #218838;
    color: #fff;
}

.btn-reset-password {
    background-color: #17a2b8;
    color: #fff;
    border: none;
}

.btn-reset-password:hover {
    background-color: #138496;
    color: #fff;
}

/* Avatar Circle for Users Table */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

/* Pagination Styles */
.pagination-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.pagination .page-link {
    color: #0d6efd;
    border: 1px solid #dee2e6;
    padding: 0.375rem 0.75rem;
    margin: 0 2px;
    border-radius: 4px;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

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

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

.pagination-size select {
    margin: 0 8px;
}

/* Print Styles */
@media print {
    .navbar,
    .card-header button,
    .nav-tabs,
    .btn,
    .form-control,
    .form-select {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .event-card {
        page-break-inside: avoid;
    }
}
