/* =========================================================================
   Booking notification overrides — the "Notifications" block inside the
   opportunity detail-page gear drawer (shared .global-drawer-panel, ~380px wide).

   Reuses the SAME settings-hub tokens as notifications.css (--color-action,
   --surface-raised, --bs-border-color, --text-muted, color-mix ink tints,
   --radius-pill) so the drawer block rhymes with the hub's own alert rows.
   Everything is namespaced under .opportunities-notif-* so nothing here can cancel — or
   be cancelled by — the app's global styles. The layout is a single column:
   the drawer is narrow, so each alert stacks its channels rather than sitting
   in a wide row that would scroll sideways.
   ========================================================================= */

/* Whole block — sits inside the drawer body, under the top-bar toggles, with a
   hairline to set it apart from them. */
.opportunities-notif {
    border-top: 1px solid var(--bs-border-color);
    margin-top: var(--spacing-mdlg);
    padding-top: var(--spacing-md);
}

.opportunities-notif-title {
    margin: 0 0 var(--spacing-xsm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-grey-600);
}

.opportunities-notif-hint {
    margin: 0 0 var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-grey-600);
}

/* Sits at the top of the block: the channel column below depends on it. Soft
   ink-tinted card, in the same wash language the hub uses for a block that
   needs an integration linked before it can do anything. */
.opportunities-notif-chan {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-smd) var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: color-mix(in srgb, var(--color-action) 6%, var(--color-card-bg));
    border: 1px solid color-mix(in srgb, var(--color-action) 20%, transparent);
    border-radius: var(--radius-card);
}

.opportunities-notif-chan__name {
    margin: 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--bs-body-color);
    word-break: break-word;
}

.opportunities-notif-chan__note {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--color-grey-600);
}

.opportunities-notif-chan__link,
.opportunities-notif-chan__btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xsm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-button);
    line-height: 1;
    padding: var(--spacing-xsm) var(--spacing-smd);
    border-radius: var(--radius-pill);
    cursor: pointer;
    text-decoration: none;
}

.opportunities-notif-chan__link {
    color: var(--color-action);
    border: 1px solid color-mix(in srgb, var(--color-action) 35%, transparent);
    background: var(--color-card-bg);
}

.opportunities-notif-chan__link:hover {
    background: color-mix(in srgb, var(--color-action) 8%, var(--color-card-bg));
}

.opportunities-notif-chan__btn {
    color: #fff;
    background: var(--color-action);
    border: 1px solid var(--color-action);
}

.opportunities-notif-chan__btn:hover {
    background: color-mix(in srgb, var(--color-action) 88%, #000);
}

/* HTMX spinner: hidden until the request is in flight (htmx-request class). */
.opportunities-notif-chan__spin {
    display: none;
    margin-left: var(--spacing-xsm);
}

.opportunities-notif-chan__btn.htmx-request .opportunities-notif-chan__spin {
    display: inline-block;
}

.opportunities-notif-chan__btn.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}

/* A category band between families — the label in ink on a faint tint, so it
   reads as a divider, the way the hub's taxonomy group headers do. */
.opportunities-notif-fam {
    margin-top: var(--spacing-sm);
}

.opportunities-notif-fam__label {
    margin: 0 0 var(--spacing-xsm);
    padding: var(--spacing-xsm) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-action);
    background: color-mix(in srgb, var(--color-action) 6%, transparent);
    border-radius: 0.4rem 0.4rem 0 0;
}

.opportunities-notif-alert {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.opportunities-notif-alert:last-child {
    border-bottom: none;
}

.opportunities-notif-alert__name {
    margin: 0 0 var(--spacing-xsm);
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--bs-body-color);
}

.opportunities-notif-alert__channels {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xsm);
}

/* Channel name on the left, the segmented control on the right, on one row.
   At very narrow widths (~320px) the longest label plus a reconnect chip and
   the 3-segment pill can't share one row, so the row wraps the pill under the
   label instead of crowding or clipping it. */
.opportunities-notif-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xsm) var(--spacing-sm);
}

.opportunities-notif-cell__ch {
    font-size: var(--font-size-sm);
    color: var(--color-grey-600);
    min-width: 0;
}

.opportunities-notif-need {
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-error);
    margin-left: var(--spacing-xsm);
}

/* The centerpiece: an Inherit / On / Off segmented control. Every state is
   visible at once, one click sets any state, and the active one is colour-coded
   — ink for On, red-tint for Off, neutral for Inherit. */
.opportunities-notif-seg {
    display: inline-flex;
    flex: 0 0 auto;
    padding: var(--spacing-2xs);
    background: var(--color-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.opportunities-notif-seg button {
    appearance: none;
    border: none;
    background: transparent;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-button);
    line-height: 1;
    color: var(--color-grey-600);
    padding: var(--spacing-2xs) var(--spacing-sm);
    border-radius: var(--radius-pill);
    cursor: pointer;
}

.opportunities-notif-seg button.is-active--inherit {
    background: var(--color-surface-hover);
    color: var(--bs-body-color);
}

.opportunities-notif-seg button.is-active--on {
    background: var(--color-action);
    color: #fff;
}

.opportunities-notif-seg button.is-active--off {
    background: color-mix(in srgb, var(--color-error) 12%, transparent);
    color: var(--color-error);
}

.opportunities-notif-seg button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-focus-ring-alpha);
}

.opportunities-notif-seg button:disabled,
.opportunities-notif-seg.is-disabled button {
    opacity: 0.5;
    cursor: not-allowed;
}

.opportunities-notif-seg__hint {
    font-weight: 400;
    opacity: 0.7;
    margin-left: var(--spacing-xs);
}
