/* ── Share Modal — content styles ──────────────────────────────────────────────
 *
 * The overlay, container, header, footer, and animations come from modals.css
 * (via Modal.openPanel()).  This file only covers the body content: sections,
 * member rows, chips, role selects, link rows, and new-link form.
 *
 * All colours use CSS custom properties.  No raw hex/rgb/named values outside
 * of :root declarations.
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── Body wrapper ────────────────────────────────────────────────────────────── */

.smd-body {
    display: flex;
    flex-direction: column;
}

/* ── Sections ────────────────────────────────────────────────────────────────── */

.smd-section {
    border-top: 0.5px solid var(--color-border);
    padding: 16px 20px;
}

.smd-section:first-child {
    border-top: none;
}

.smd-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

/* ── Loading skeleton ────────────────────────────────────────────────────────── */

.smd-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.smd-skeleton-line {
    height: 14px;
    background: var(--color-bg-muted);
    border-radius: 6px;
    animation: smdSkeletonPulse 1.4s ease-in-out infinite;
}

.smd-skeleton-line--short {
    width: 40%;
}

.smd-skeleton-line--medium {
    width: 65%;
}

@keyframes smdSkeletonPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* ── Search row ──────────────────────────────────────────────────────────────── */

.smd-search-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.smd-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.smd-search-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-hover);
    color: var(--color-text-heading);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.smd-search-input:focus {
    border-color: var(--color-accent);
    background: var(--color-bg-surface);
    box-shadow: 0 0 0 3px var(--color-accent-ring);
}

/* Suggestion dropdown */
.smd-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-bg-surface);
    border: 0.5px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--color-shadow-xl);
    z-index: 100;
    overflow: hidden;
}

.smd-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.smd-suggestion-item:hover,
.smd-suggestion-item:focus {
    background: var(--color-bg-hover);
}

/* Vignette fills the row; name + email stack vertically inside .user-vignette__info. */
.smd-suggestion-item .user-vignette {
    flex: 1;
    min-width: 0;
}

/* Role picker beside the search box */
.smd-role-select {
    padding: 9px 10px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-hover);
    color: var(--color-text-heading);
    cursor: pointer;
    max-width: 120px;
}

/* Add button */
.smd-add-btn {
    min-height: 36px;
    min-width: 44px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
}

/* ── Staged chips ────────────────────────────────────────────────────────────── */

.smd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.smd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    border: 0.5px solid var(--color-border-medium);
    border-radius: 20px;
    background: var(--color-bg-hover);
    font-size: 13px;
    color: var(--color-text-heading);
}

.smd-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-faint);
    padding: 0;
    border-radius: 50%;
    transition:
        background 0.1s,
        color 0.1s;
}

.smd-chip-remove:hover {
    background: var(--color-bg-muted);
    color: var(--color-text-heading);
}

/* ── Member group headings ───────────────────────────────────────────────────── */

.smd-group {
    margin-top: 12px;
}

.smd-group:first-child {
    margin-top: 0;
}

.smd-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.smd-group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    background: var(--color-bg-muted);
    color: var(--color-text-subtle);
}

/* ── Member rows ─────────────────────────────────────────────────────────────── */

.smd-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
}

/* Vignette grows to fill the member row; role-select + action stay right-aligned. */
.smd-member-row .user-vignette {
    flex: 1;
    min-width: 0;
}

.smd-member-role-select {
    font-size: 13px;
    padding: 4px 8px;
    border: 0.5px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-hover);
    color: var(--color-text-heading);
    cursor: pointer;
    max-width: 33%;
}

.smd-row-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    min-width: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-faint);
    border-radius: 6px;
    padding: 0;
    transition:
        background 0.1s,
        color 0.1s;
}

.smd-row-action:hover {
    background: var(--color-bg-hover);
    color: var(--color-error-text);
}

/* ── Avatar colour palette ───────────────────────────────────────────────────── */
/* Colours are provided by .uv-color-0..4 in userVignette.css (shared palette). */

/* ── Fallback when user-directory is unavailable ────────────────────────────── */

.smd-directory-unavailable {
    font-size: 13px;
    color: var(--color-text-faint);
    font-style: italic;
    padding: 4px 0 8px;
}

/* ── Link rows ───────────────────────────────────────────────────────────────── */

.smd-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.smd-link-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    border: 0.5px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-subtle);
    flex-shrink: 0;
    font-size: 14px;
}

.smd-link-info {
    flex: 1;
    overflow: hidden;
}

.smd-link-name {
    font-size: 14px;
    color: var(--color-text-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smd-link-tags {
    display: flex;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.smd-link-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-bg-muted);
    color: var(--color-text-subtle);
    border: 0.5px solid var(--color-border);
    white-space: nowrap;
}

.smd-link-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

/* ── Inline edit sub-panel ───────────────────────────────────────────────────── */

.smd-edit-panel {
    margin: 4px 0 8px 42px;
    padding: 12px;
    background: var(--color-bg-hover);
    border: 0.5px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.smd-edit-panel label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 4px;
}

.smd-edit-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-surface);
    color: var(--color-text-heading);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.smd-edit-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-ring);
}

.smd-edit-panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── New-link creation button + form ─────────────────────────────────────────── */

.smd-new-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-text-subtle);
    background: none;
    border: 1.5px dashed var(--color-border-medium);
    border-radius: 8px;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}

.smd-new-link-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.smd-new-link-form {
    margin-top: 8px;
    padding: 14px;
    background: var(--color-bg-hover);
    border: 0.5px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.smd-new-link-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 3px;
}

.smd-new-link-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* ── Password toggle row ─────────────────────────────────────────────────────── */

.smd-pw-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

/* ── Apply spinner ────────────────────────────────────────────────────────────── */

.smd-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: smdSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

@keyframes smdSpin {
    to {
        transform: rotate(360deg);
    }
}
