/* ── Profile View ──
   Rendered as a standard in-app screen inside #app-content.
   No overlay, no card, no shadow — a flat, integrated view. */

.profile-view {
    position: absolute;
    inset: 0;
    background-color: var(--color-surface-primary);
    display: flex;
    flex-direction: column;
    visibility: hidden;
    z-index: 10;
}

.profile-view.show {
    visibility: visible;
}

/* Header */
.profile-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    gap: 16px;
    flex-shrink: 0;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--color-context-background);
    color: var(--color-context-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    user-select: none;
}

.profile-header-info {
    min-width: 0;
}

.profile-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 2px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Append colon to field labels */
.profile-view .form-label::after {
    content: ':';
}

/* Scrollable content area */
.profile-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Section titles */
.profile-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px;
}

.profile-section-title:not(:first-child) {
    margin-top: 4px;
}

/* Field grid */
.profile-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    max-width: 560px;
}

.profile-field--full {
    grid-column: 1 / -1;
}

/* Divider */
.profile-divider {
    border: none;
    border-bottom: 1px solid var(--color-border);
    margin: 16px 0;
    max-width: 560px;
}

/* View mode: inputs hidden, spans visible */
.profile-view .profile-field-input {
    display: none;
}

.profile-view .profile-field-value {
    display: block;
    font-size: var(--form-control-font-size);
    color: var(--color-text-primary);
    line-height: 1.5;
    min-height: 24px;
    word-break: break-word;
}

.profile-field-value--empty {
    color: var(--color-text-secondary);
}

/* Edit mode: inputs visible, spans hidden */
.profile-view--editing .profile-field-input {
    display: block;
}

.profile-view--editing .profile-field-value {
    display: none;
}

/* Compact spacing in view mode */
.profile-view .form-group {
    margin-bottom: 4px;
}

.profile-view--editing .form-group {
    margin-bottom: var(--form-control-spacing-vertical);
}

/* Tags */
.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.profile-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.10);
}

/* Error message */
.profile-error {
    color: var(--color-error, #dc2626);
    font-size: 14px;
    margin-bottom: 12px;
    max-width: 560px;
}

/* ── Narrow viewports ── */
@media (max-width: 640px) {
    .profile-header {
        padding: 16px 20px;
    }

    .profile-title {
        font-size: 18px;
    }

    .profile-content {
        padding: 20px;
    }

    .profile-fields {
        grid-template-columns: 1fr;
    }
}

/* ── Lock container scroll and hide FAB when profile is open ── */
body:has(#app-content .profile-view.show) #app-content {
    overflow-y: hidden;
}

body:has(#app-content .profile-view.show) .fab {
    display: none !important;
}

body:has(#app-content .profile-view.show) .datatable__footer {
    display: none;
}
