/* ==========================================================================
   Detail pages (admin profile / firm)
   Calm, low-contrast surfaces with teal reserved for accents.

   Usage: wrap the page in <div class="nv-detail">. Rules are global (not
   scoped) so they also reach MudBlazor internals and the tab child
   components (_adminAddress, _adminApplications, ...).
   ========================================================================== */

.nv-detail {
    --nv-radius: 14px;
    --nv-border: var(--medium-gray, #E2E8F0);
    --nv-muted: var(--dark-gray, #64748B);
    --nv-ink: var(--primary-dark-navy, #1E293B);
    --nv-accent: var(--primary-teal, #0D9488);
    --nv-accent-soft: color-mix(in srgb, var(--primary-teal, #0D9488) 10%, transparent);
    --nv-surface-soft: var(--light-gray, #F8FAFC);
    padding-bottom: 48px;
    color: var(--nv-ink);
}

/* --- Back link ------------------------------------------------------------ */
.nv-detail .nv-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    padding: 6px 10px 6px 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--nv-muted);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nv-detail .nv-back:hover,
.nv-detail .nv-back:focus-visible {
    background: var(--nv-accent-soft);
    color: var(--nv-ink);
}

/* --- Cards ---------------------------------------------------------------- */
.nv-detail .nv-card {
    background: var(--mud-palette-surface, #fff);
    border: 1px solid var(--nv-border);
    border-radius: var(--nv-radius);
}

/* --- Header --------------------------------------------------------------- */
.nv-detail .nv-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 24px 28px;
    margin-bottom: 20px;
}

.nv-detail .nv-avatar {
    position: relative;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--nv-accent-soft);
    color: var(--nv-accent);
    font-size: 1.5rem;
    font-weight: 500;
}

.nv-detail .nv-avatar .mud-icon-root {
    font-size: 1.75rem;
}

.nv-detail .nv-avatar--photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: visible;
}

.nv-detail .nv-avatar--photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.nv-detail .nv-avatar-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--mud-palette-surface, #fff);
    color: var(--mud-palette-success, #16a34a);
    line-height: 0;
}

.nv-detail .nv-avatar-badge .mud-icon-root {
    font-size: 1.25rem;
}

.nv-detail .nv-header-text {
    flex: 1;
    min-width: 0;
}

.nv-detail .nv-title {
    margin: 0 0 6px;
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--nv-ink);
}

.nv-detail .nv-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 0.875rem;
    color: var(--nv-muted);
}

.nv-detail .nv-meta strong {
    font-weight: 500;
    color: var(--nv-ink);
}

.nv-detail .nv-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.nv-detail .nv-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* --- Tabs ----------------------------------------------------------------- */
.nv-detail .nv-tabs-card {
    overflow: hidden;
}

.nv-detail .nv-tabs-card .mud-tabs-tabbar {
    padding: 0 12px;
    background: transparent;
    border-bottom: 1px solid var(--nv-border);
}

/* Compact, content-width tabs. !important where app.css forces global tab styles. */
.nv-detail .nv-tabs-card .mud-tabs .mud-tabs-tabbar .mud-tab {
    min-width: 0;
    min-height: 0;
    width: auto;
    flex: 0 0 auto;
    margin-right: 0 !important;
    padding: 12px 14px;
    border-radius: 0 !important;
    background: transparent;
    text-transform: none;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.4;
    color: var(--nv-muted);
}

.nv-detail .nv-tabs-card .mud-tabs .mud-tabs-tabbar .mud-tab:hover {
    background: transparent !important;
    color: var(--nv-ink);
}

.nv-detail .nv-tabs-card .mud-tabs .mud-tabs-tabbar .mud-tab.mud-tab-active {
    background: transparent !important;
    color: var(--nv-accent) !important;
}

.nv-detail .nv-tabs-card .mud-tab-slider {
    height: 2px;
    border-radius: 2px 2px 0 0;
}

.nv-detail .nv-tabs-card .mud-tabs-panels.nv-panel {
    padding: 28px !important;
}

/* Tab child components wrap themselves in <MudPaper Class="pa-4">; the panel already pads. */
.nv-detail .nv-panel > .mud-tab-panel > .mud-paper:not(.mud-paper-outlined) {
    padding: 0 !important;
    background: transparent;
}

/* --- Sections ------------------------------------------------------------- */
.nv-detail .nv-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.nv-detail .nv-subcard {
    padding: 20px 22px;
    border: 1px solid var(--nv-border);
    border-radius: 12px;
    background: var(--nv-surface-soft);
}

.nv-detail .nv-section-title {
    margin: 0 0 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--nv-ink);
}

.nv-detail .nv-muted {
    margin: 0;
    font-size: 0.875rem;
    color: var(--nv-muted);
}

.nv-detail .nv-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--nv-border);
}

/* --- Label / value fields ------------------------------------------------- */
.nv-detail .nv-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
    margin: 0;
}

.nv-detail .nv-fields--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nv-detail .nv-field dt {
    margin-bottom: 2px;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--nv-muted);
}

.nv-detail .nv-field dd {
    margin: 0;
    font-size: 0.9rem;
    color: var(--nv-ink);
    overflow-wrap: anywhere;
}

/* --- Documents list ------------------------------------------------------- */
.nv-detail .nv-doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nv-detail .nv-doc {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--nv-border);
    border-radius: 12px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nv-detail .nv-doc:hover {
    border-color: color-mix(in srgb, var(--nv-accent) 35%, var(--nv-border));
    background: var(--nv-surface-soft);
}

.nv-detail .nv-doc-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--nv-accent-soft);
    color: var(--nv-accent);
}

.nv-detail .nv-doc-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.nv-detail .nv-doc-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--nv-ink);
}

.nv-detail .nv-doc-meta {
    font-size: 0.78rem;
    color: var(--nv-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nv-detail .nv-doc-actions {
    display: flex;
    gap: 2px;
    color: var(--nv-muted);
}

.nv-detail .nv-doc--missing .nv-doc-icon {
    background: var(--nv-surface-soft);
    color: var(--nv-muted);
}

.nv-detail .nv-doc--missing .nv-doc-label {
    color: var(--nv-muted);
}

/* --- Empty states --------------------------------------------------------- */
.nv-detail .nv-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border: 1px dashed var(--nv-border);
    border-radius: 12px;
    font-size: 0.875rem;
    color: var(--nv-muted);
}

/* ==========================================================================
   Softening of existing MudBlazor markup inside detail pages
   (applies to the profile tab child components without editing each one)
   ========================================================================== */

/* Cards — Outlined="true" papers, and Bordered="true" (passed through as a plain attribute) */
.nv-detail .mud-paper-outlined,
.nv-detail .mud-paper[bordered] {
    border: 1px solid var(--nv-border);
    border-radius: 12px;
    background: var(--nv-surface-soft);
    box-shadow: none;
}

.nv-detail .mud-paper-outlined .mud-paper-outlined,
.nv-detail .mud-paper[bordered] .mud-paper[bordered] {
    background: var(--mud-palette-surface, #fff);
}

/* Member tab section headers (app.css .detail-section-header) */
.nv-detail .detail-section-header {
    border-bottom-color: var(--nv-border);
}

/* Empty states — member tabs set heavy inline styles, so these need !important */
.nv-detail .empty-state-container {
    padding: 32px 20px !important;
    border: 1px dashed var(--nv-border) !important;
    border-radius: 12px !important;
    background: transparent !important;
}

.nv-detail .empty-state-container:hover {
    border-color: color-mix(in srgb, var(--nv-accent) 35%, var(--nv-border)) !important;
}

.nv-detail .empty-state-container > .mud-icon-root {
    font-size: 40px !important;
    margin-bottom: 12px !important;
    color: var(--nv-muted) !important;
    opacity: 0.5;
}

.nv-detail .empty-state-container .mud-typography-h6 {
    color: var(--nv-ink) !important;
    margin-bottom: 4px !important;
}

.nv-detail .empty-state-container .mud-typography-body2 {
    color: var(--nv-muted) !important;
}

.nv-detail .mud-divider {
    border-color: var(--nv-border);
    opacity: 1;
}

/* Typography */
.nv-detail .mud-typography-h6 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--nv-ink);
}

.nv-detail .mud-typography-h6 .mud-icon-root {
    font-size: 1.1rem;
    color: var(--nv-muted) !important;
}

.nv-detail .mud-typography-subtitle1,
.nv-detail .mud-typography-subtitle2 {
    font-weight: 600;
    color: var(--nv-ink);
}

.nv-detail .mud-typography-body2 {
    color: var(--nv-ink);
}

/* "Label:" patterns — <strong>Label:</strong> value, and .font-weight-medium labels */
.nv-detail .mud-typography-body2 > strong,
.nv-detail .mud-typography-body2.font-weight-medium,
.nv-detail .mud-typography-body2.font-weight-bold {
    font-weight: 400 !important;
    color: var(--nv-muted);
}

.nv-detail .mud-typography-caption {
    color: var(--nv-muted);
}

/* Empty states inside tab components */
.nv-detail .text-center > .mud-icon-root.mud-icon-size-large {
    color: var(--nv-muted) !important;
    opacity: 0.5;
}

/* Buttons: quieter, sentence case, no shadows */
.nv-detail .mud-button-root.mud-button {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: none;
}

.nv-detail .mud-button-filled {
    box-shadow: none !important;
}

.nv-detail .mud-button-filled.mud-button-filled-success {
    background-color: color-mix(in srgb, var(--mud-palette-success) 12%, transparent);
    color: color-mix(in srgb, var(--mud-palette-success) 80%, #000);
}

.nv-detail .mud-button-filled.mud-button-filled-success:hover {
    background-color: color-mix(in srgb, var(--mud-palette-success) 20%, transparent);
}

.nv-detail .mud-button-filled.mud-button-filled-error {
    background-color: color-mix(in srgb, var(--mud-palette-error) 10%, transparent);
    color: color-mix(in srgb, var(--mud-palette-error) 85%, #000);
}

.nv-detail .mud-button-filled.mud-button-filled-error:hover {
    background-color: color-mix(in srgb, var(--mud-palette-error) 18%, transparent);
}

.nv-detail .mud-button-outlined {
    border-color: var(--nv-border);
}

/* Tables */
.nv-detail .mud-table-head .mud-table-cell {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nv-muted);
    border-bottom-color: var(--nv-border);
}

.nv-detail .mud-table-body .mud-table-cell {
    font-size: 0.875rem;
    color: var(--nv-ink);
    border-bottom-color: var(--nv-border);
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 960px) {
    .nv-detail .nv-fields--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .nv-detail .nv-header {
        padding: 20px;
        gap: 16px;
    }

    .nv-detail .nv-tabs-card .mud-tabs-tabbar {
        padding: 0 4px;
    }

    .nv-detail .nv-tabs-card .mud-tabs-panels.nv-panel {
        padding: 20px 16px !important;
    }

    .nv-detail .nv-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nv-detail .nv-fields,
    .nv-detail .nv-fields--4 {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nv-detail .nv-back,
    .nv-detail .nv-doc {
        transition: none;
    }
}
