/*
   Admin Users page — MudBlazor grid + popup styling
   ──────────────────────────────────────────────────
   Modeled on CJB demo patterns (CJBTasksPage.razor.css + MudBlazor.grid.css).
   Uses the same Tailwind Slate design tokens for visual consistency.

   Design tokens (Tailwind Slate palette):
     Container border : #e2e8f0  (slate-200)
     Header bg        : #f8fafc  (slate-50)
     Header text      : #64748b  (slate-500)
     Body text         : #334155  (slate-700)
     Body text hover   : #1e293b  (slate-800)
     Row divider       : #f1f5f9  (slate-100)
     Icon muted        : #94a3b8  (slate-400)
     Icon hover        : #475569  (slate-600)
     Icon hover bg     : #f1f5f9  (slate-100)
*/

/* ═══════════════════════════════════════════════════════
   Grid header (summary text + New User button)
   ═══════════════════════════════════════════════════════ */
.admin-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   MudDataGrid — Tailwind Slate theme (admin scope)
   ═══════════════════════════════════════════════════════ */

/* Container */
.admin-users-grid .mud-table {
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    overflow: hidden;
    background: #fff !important;
}

.admin-users-grid .mud-table .mud-table-container {
    border-radius: inherit;
}

.admin-users-grid .mud-paper.mud-table {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

/* Header */
.admin-users-grid .mud-table-head .mud-table-row .mud-table-cell {
    background: #f8fafc !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #64748b !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: none !important;
    border-left: none !important;
    white-space: nowrap;
}

.admin-users-grid .mud-table-head .mud-table-row .mud-table-cell:first-child {
    padding-left: 1.25rem !important;
}

.admin-users-grid .mud-table-head .mud-table-row .mud-table-cell:last-child {
    padding-right: 1.25rem !important;
}

/* Body cells */
.admin-users-grid .mud-table-body .mud-table-row .mud-table-cell {
    padding: 0.625rem 1rem !important;
    font-size: 0.875rem !important;
    color: #334155 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-right: none !important;
    border-left: none !important;
    vertical-align: middle;
}

.admin-users-grid .mud-table-body .mud-table-row .mud-table-cell:first-child {
    padding-left: 1.25rem !important;
}

.admin-users-grid .mud-table-body .mud-table-row .mud-table-cell:last-child {
    padding-right: 1.25rem !important;
}

.admin-users-grid .mud-table-body .mud-table-row:last-child .mud-table-cell {
    border-bottom: none !important;
}

/* Row hover */
.admin-users-grid .mud-table-body .mud-table-row:hover {
    background: #f8fafc !important;
}

.admin-users-grid .mud-table-body .mud-table-row:hover .mud-table-cell {
    color: #1e293b !important;
}

/* Row action icons */
.admin-users-grid .mud-table-body .mud-icon-button {
    color: #94a3b8 !important;
    transition: color 0.15s ease;
}

.admin-users-grid .mud-table-body .mud-icon-button:hover {
    color: #475569 !important;
    background-color: #f1f5f9 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-users-grid .mud-table-head .mud-table-row .mud-table-cell {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.625rem !important;
    }

    .admin-users-grid .mud-table-body .mud-table-row .mud-table-cell {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8125rem !important;
    }
}

/* ═══════════════════════════════════════════════════════
   Popup backdrop + panel (shared by edit & delete popups)
   ═══════════════════════════════════════════════════════ */
.admin-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.admin-popup-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.admin-popup-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: #334155;
}

.admin-popup-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.admin-popup-form {
    padding: 1.25rem;
}

.admin-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* Close button in popup header */
.admin-popup-close-btn {
    color: #64748b !important;
}

.admin-popup-close-btn:hover {
    color: #334155 !important;
    background: #f1f5f9 !important;
}

/* ═══════════════════════════════════════════════════════
   Form fields — label above, clean bordered input
   ═══════════════════════════════════════════════════════ */
.admin-field {
    margin-bottom: 1rem;
}

.admin-field:last-child {
    margin-bottom: 0;
}

.admin-field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}

.admin-field-req {
    color: #dc2626;
}

/* Hide MudBlazor's built-in floating label when we use our own */
.admin-field .mud-input-label {
    display: none !important;
}

/* Remove top legend gap since label is external */
.admin-field .mud-input-outlined-border legend {
    display: none !important;
}

/* Rounded corners and light gray border on outlined inputs */
.admin-field .mud-input-outlined-border {
    border-radius: 6px !important;
    border-color: #cbd5e1 !important;
}

.admin-field .mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #94a3b8 !important;
}

.admin-field .mud-input.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: #64748b !important;
}

/* Placeholder text */
.admin-field .mud-input input::placeholder,
.admin-field .mud-input textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

/* MudSelect selected-value text */
.admin-field .mud-select .mud-input-slot {
    color: #334155 !important;
}

/* ═══════════════════════════════════════════════════════
   Delete confirmation popup — smaller, centered text
   ═══════════════════════════════════════════════════════ */
.admin-delete-panel {
    max-width: 400px;
}

.admin-delete-body {
    padding: 1.25rem;
    font-size: 0.9375rem;
    color: #334155;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════
   MudSnackbar — opaque, soft-colored notification toasts
   ═══════════════════════════════════════════════════════ */

/* Shared base: opaque background, rounded, elevated, no bleed-through */
.mud-snackbar {
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06) !important;
    min-width: 320px !important;
}

/* Success — light green */
.mud-snackbar.mud-alert-filled-success {
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0 !important;
}

.mud-snackbar.mud-alert-filled-success .mud-snackbar-content-message {
    color: #065f46 !important;
}

.mud-snackbar.mud-alert-filled-success .mud-alert-icon {
    color: #059669 !important;
}

.mud-snackbar.mud-alert-filled-success .mud-icon-button {
    color: #065f46 !important;
}

/* Error — light red */
.mud-snackbar.mud-alert-filled-error {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

.mud-snackbar.mud-alert-filled-error .mud-snackbar-content-message {
    color: #991b1b !important;
}

.mud-snackbar.mud-alert-filled-error .mud-alert-icon {
    color: #dc2626 !important;
}

.mud-snackbar.mud-alert-filled-error .mud-icon-button {
    color: #991b1b !important;
}

/* Warning — light amber */
.mud-snackbar.mud-alert-filled-warning {
    background-color: #fffbeb !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
}

.mud-snackbar.mud-alert-filled-warning .mud-snackbar-content-message {
    color: #92400e !important;
}

.mud-snackbar.mud-alert-filled-warning .mud-alert-icon {
    color: #d97706 !important;
}

.mud-snackbar.mud-alert-filled-warning .mud-icon-button {
    color: #92400e !important;
}

/* Info — light blue */
.mud-snackbar.mud-alert-filled-info {
    background-color: #eff6ff !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}

.mud-snackbar.mud-alert-filled-info .mud-snackbar-content-message {
    color: #1e40af !important;
}

.mud-snackbar.mud-alert-filled-info .mud-alert-icon {
    color: #2563eb !important;
}

.mud-snackbar.mud-alert-filled-info .mud-icon-button {
    color: #1e40af !important;
}

/* Ensure snackbar container is above everything */
.mud-snackbar-location-bottom-right,
.mud-snackbar-location-bottom-left,
.mud-snackbar-location-top-right,
.mud-snackbar-location-top-left,
.mud-snackbar-location-bottom-center,
.mud-snackbar-location-top-center {
    z-index: 10000 !important;
}
