/* Endorsement dialogs (Create + View).
   Namespaced with .end- to avoid collisions; loaded globally via App.razor.

   Design intent mirrors the admin-statistics (.ps-) quality bar: calm hairline-bordered
   surfaces with a soft shadow, color reserved for meaning (the chosen type, the primary
   action), and a clear hierarchy that teaches the form as it is filled in. All colors come
   from --mud-palette-* so light and dark both work; no hardcoded palette values. */

/* ---- Dialog content wrapper ---- */
.end-dialog {
    /* MudNumericField (the "shows worked together" field) renders a fractional
       height, which tips this tall dialog just past MudBlazor's overflow-y:auto
       threshold and shows a phantom scrollbar even though the dialog has room to
       grow. Absorb that small overshoot here so the bar never appears; genuine
       scrolling still works if a short viewport ever needs it. */
    margin-bottom: -4px;
}

/* ---- Recipient identity strip (who you're endorsing) ---- */
.end-recipient {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

.end-recipient__eyebrow {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
}

.end-recipient__name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mud-palette-text-primary);
}

/* ---- Section header (labeled divider), mirrors .ps-section ---- */
.end-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
}

.end-section--first {
    margin-top: 2px;
}

.end-section__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--mud-palette-text-secondary);
    opacity: 0.45;
}

.end-section__title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.end-section__rule {
    height: 1px;
    flex: 1 1 auto;
    background: var(--mud-palette-lines-default);
}

/* ---- Type picker: 2x2 grid of selectable tiles ---- */
.end-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.end-type {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.end-type:hover {
    border-color: var(--mud-palette-lines-inputs);
    box-shadow: 0 3px 10px rgba(16, 24, 40, 0.07);
}

.end-type:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

.end-type--selected {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 7%, var(--mud-palette-surface));
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary);
}

.end-type__top {
    display: flex;
    align-items: center;
    gap: 9px;
}

.end-type__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-action-default-hover); /* fallback if color-mix unsupported */
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}

.end-type__name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--mud-palette-text-primary);
}

.end-type__desc {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--mud-palette-text-secondary);
    margin-top: 8px;
}

.end-type__example {
    font-size: 0.74rem;
    line-height: 1.3;
    color: var(--mud-palette-text-secondary);
    font-style: italic;
    margin-top: 4px;
}

.end-type__check {
    position: absolute;
    top: 9px;
    right: 9px;
    color: var(--mud-palette-primary);
    line-height: 0;
}

/* ---- "Checking for an existing endorsement" inline hint ---- */
.end-checking {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

/* ---- Update mode: locked category summary (type + target can't change) ---- */
.end-category {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-surface));
    border: 1px solid var(--mud-palette-lines-default);
}

.end-category__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-action-default-hover);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}

.end-category__label {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
}

.end-category__value {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mud-palette-text-primary);
}

/* ---- Sample/example callout (recommendation), mirrors CreateReportDialog .report-example ---- */
.end-example {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--mud-palette-text-secondary);
    font-style: italic;
    padding: 8px 12px;
    border-left: 3px solid var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, transparent);
    border-radius: 0 8px 8px 0;
    margin-top: 8px;
}

.end-example__label {
    font-style: normal;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    margin-right: 4px;
}

/* ---- View dialog: endorsement row card + quote ---- */
.end-row {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.end-row:hover {
    border-color: var(--mud-palette-lines-inputs);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

.end-quote {
    border-left: 3px solid var(--mud-palette-primary);
    background: var(--mud-palette-background-grey);
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, transparent);
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
}

/* ---- Responsive: tiles stack to one column on narrow screens ---- */
@media (max-width: 600px) {
    .end-types {
        grid-template-columns: 1fr;
    }

    .end-section {
        margin: 16px 0 10px;
    }
}
