/**
 * User Management Styles
 * Azure DevOps / Azure Portal inspired design system
 */

/* ─────────────────────────────────────────────────────────────────────────────
   User Avatar
   ───────────────────────────────────────────────────────────────────────────── */

.user-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-lg span {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Tab Navigation (Azure-style)
   ───────────────────────────────────────────────────────────────────────────── */

.nav-tabs-azure {
    border-bottom: 1px solid #e1e4e8;
    gap: 0;
}

.nav-tabs-azure .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    color: #586069;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.nav-tabs-azure .nav-link:hover {
    color: #0078d4;
    background-color: rgba(0, 120, 212, 0.04);
    border-bottom-color: rgba(0, 120, 212, 0.3);
}

.nav-tabs-azure .nav-link.active {
    color: #0078d4;
    background-color: transparent;
    border-bottom-color: #0078d4;
}

.nav-tabs-azure .nav-link i {
    font-size: 0.9rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Stat Cards
   ───────────────────────────────────────────────────────────────────────────── */

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 1.25rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────────────────────────────────────── */

.card {
    transition: box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.card-header {
    border-bottom: 1px solid #e9ecef;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Form Controls (Azure-style)
   ───────────────────────────────────────────────────────────────────────────── */

.form-control:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}

.form-control[readonly] {
    background-color: #f6f8fa;
    border-color: #e1e4e8;
    color: #24292e;
}

.form-control[readonly]:focus {
    box-shadow: none;
    border-color: #e1e4e8;
}

.form-check-input:checked {
    background-color: #0078d4;
    border-color: #0078d4;
}

.form-check-input:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────────────────────── */

.btn {
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: #0078d4;
    border-color: #0078d4;
}

.btn-primary:hover {
    background-color: #006cbe;
    border-color: #006cbe;
}

.btn-outline-primary {
    color: #0078d4;
    border-color: #0078d4;
}

.btn-outline-primary:hover {
    background-color: #0078d4;
    border-color: #0078d4;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Badges
   ───────────────────────────────────────────────────────────────────────────── */

.badge {
    font-weight: 500;
    letter-spacing: 0.01em;
}

.fs-7 {
    font-size: 0.75rem !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Tables
   ───────────────────────────────────────────────────────────────────────────── */

.table {
    font-size: 0.875rem;
}

.table > thead {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #586069;
}

.table > thead th {
    font-weight: 600;
    border-bottom-width: 1px;
}

.table > tbody > tr:hover {
    background-color: rgba(0, 120, 212, 0.03);
}

.table > tbody > tr > td {
    vertical-align: middle;
    padding: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Edit Mode Transitions
   ───────────────────────────────────────────────────────────────────────────── */

#rolesEditView,
#capabilitiesEditView {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Loading States
   ───────────────────────────────────────────────────────────────────────────── */

.btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
}

#activityLoading {
    z-index: 10;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────────────────────── */

.alert-info {
    background-color: #e6f3ff;
    border-color: #cce5ff;
    color: #004085;
}

.alert-warning {
    background-color: #fff8e6;
    border-color: #ffe6b3;
    color: #856404;
}

.alert-danger {
    background-color: #ffe6e6;
    border-color: #ffcccc;
    color: #721c24;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Status Backgrounds
   ───────────────────────────────────────────────────────────────────────────── */

.bg-success-subtle {
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.bg-info-subtle {
    background-color: rgba(23, 162, 184, 0.1) !important;
}

.bg-primary-subtle {
    background-color: rgba(0, 120, 212, 0.1) !important;
}

.bg-secondary-subtle {
    background-color: rgba(108, 117, 125, 0.1) !important;
}

/* Text color variants */
.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-primary {
    color: #0078d4 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Tooltip Customization
   ───────────────────────────────────────────────────────────────────────────── */

.tooltip {
    font-size: 0.8125rem;
}

.tooltip-inner {
    max-width: 250px;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Pagination
   ───────────────────────────────────────────────────────────────────────────── */

.pagination .page-link {
    color: #0078d4;
    border-color: #e1e4e8;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

.pagination .page-item.active .page-link {
    background-color: #0078d4;
    border-color: #0078d4;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #f6f8fa;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Code Blocks
   ───────────────────────────────────────────────────────────────────────────── */

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8125rem;
    background-color: #f6f8fa;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: #24292e;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive Adjustments
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .user-avatar-lg {
        width: 48px;
        height: 48px;
    }

    .user-avatar-lg span {
        font-size: 1.25rem;
    }

    .nav-tabs-azure .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .nav-tabs-azure .nav-link i {
        display: none;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon i {
        font-size: 1rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Focus States (Accessibility)
   ───────────────────────────────────────────────────────────────────────────── */

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Print Styles
   ───────────────────────────────────────────────────────────────────────────── */

@media print {
    .btn,
    .nav-tabs-azure,
    #activityFilterForm,
    .profile-edit-controls,
    .roles-edit-controls,
    .capabilities-edit-controls {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
