/* Create / Edit opportunity drawer (app/opportunities/_opportunity_form.html).
   Tokens only (ADR-125); its either/or switches are segmented.css variants. */

/* One role per row; the .global-drawer__rowbtn inside draws the surface. */
#opp-roles .opportunities-role-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}
#opp-roles .opportunities-role-card + .opportunities-role-card { margin-top: var(--spacing-sm); }
#opp-roles .opportunities-role-icon { font-size: var(--font-size-base); line-height: 1; }
/* A role row is a card in the Add Role tile's family: about its height, its corner,
   its type size, so the roster and the tile under it read as one stack. */
#opp-roles .opportunities-role-card > .global-drawer__rowbtn {
    min-height: calc(var(--control-h-touch) + var(--spacing-smd));
    padding: 0 var(--spacing-md);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-lg);
}
#opp-roles .opportunities-role-card > .global-drawer__rowbtn > .bi-chevron-right { color: var(--color-text-muted); }

/* The drawer is transformed, so this fixed panel measures from the drawer, which
   already sits under the app header. */
#opp-role-panel { top: 0; }

/* Band headings wear the small-caps legend, so they never read as a field label. */
#opp-form .opportunities-band-title { margin: 0; }

/* Hairlines split the role editor into the questions a coordinator answers in turn. */
#opp-role-panel .opportunities-panel-rule {
    margin: var(--spacing-md) 0;
    border: 0;
    border-top: 1px solid var(--color-border-hairline);
    opacity: 1;
}
/* Dates and pay may both be absent, so a rule of their own would double the next one. */
#opp-role-panel .opportunities-section { border-top: 0; padding-top: 0; }

/* The role editor lives in #opp-role-panel, a sibling of #opp-roles, so scope to it. */

/* Base, travel and total read as one unit. */
#opp-role-panel .opportunities-pay-block {
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border-hairline);
    border-radius: var(--radius-md);
    padding: var(--spacing-smd) var(--spacing-md);
}
#opp-role-panel .opportunities-pay-total {
    border-top: 1px dashed var(--color-border-hairline);
    padding-top: var(--spacing-sm);
}

#opp-role-panel .opportunities-skill-row,
#opp-role-panel .opportunities-choice-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-smd);
    border: 1px solid var(--color-border-hairline);
    border-radius: var(--radius-md);
    background: var(--color-grey-50);
}
#opp-role-panel .opportunities-skill-row + .opportunities-skill-row { margin-top: var(--spacing-sm); }
#opp-role-panel .opportunities-skill-name,
#opp-role-panel .opportunities-choice-row > .form-check-label {
    font-weight: var(--font-weight-body);
}
/* The skill name is the one thing in the row that can shrink and still be read. */
#opp-role-panel .opportunities-skill-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Fixed-size targets: shrinking either one breaks the row. */
#opp-role-panel .opportunities-skill-row > .global-icon-btn { flex: 0 0 auto; }
/* The skill rows carry their own borders; margin, not a rule, keeps them off
   the visibility toggle above. */
#opp-role-panel .opportunities-access-skills:not(:empty) { margin-top: var(--spacing-sm); }

/* A yes-or-no question as a row: the skill row's surface (set above), whole width tappable. */
#opp-role-panel .opportunities-choice-row { gap: var(--spacing-smd); }
#opp-role-panel .opportunities-choice-row > .form-check-label {
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
    margin: 0;
}
/* The tick sits at the right edge, where every other control in the panel ends. */
#opp-role-panel .opportunities-choice-row > .form-check-input {
    flex: 0 0 auto;
    order: 2;
    float: none;
    margin: 0;
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
}
#opp-role-panel .opportunities-choice-row + .opportunities-choice-row {
    margin-top: var(--spacing-sm);
}
/* The ticked question's follow-up hangs off a rule, so it reads as part of that row. */
#opp-role-panel .opportunities-choice-follow {
    margin: var(--spacing-sm) 0 0 var(--spacing-smd);
    padding-left: var(--spacing-smd);
    border-left: 2px solid var(--color-border-hairline);
}

/* Opt-in bands: one top line per open band and one closing line for the group, so
   two open bands never show a doubled line (x-if <template> nodes defeat a
   sibling rule). No closing line while every band is closed. */
#opp-form .opportunities-optins.is-bands-open { border-bottom: 1px solid var(--color-border-hairline); }
#opp-form .opportunities-section {
    border-top: 1px solid var(--color-border-hairline);
    padding: var(--spacing-md) 0;
}
/* Collapsed tiles breathe; expanded bands butt flush so a band's top divider
   doubles as the divider below the band above it. */
#opp-form .opportunities-optins .global-add-tile { margin: var(--spacing-smd) 0; }
/* The properties' own line would double the group's closing line; hidden (not
   removed) so the gap stays the same open or closed. */
#opp-form .opportunities-optins.is-bands-open + .opportunities-props > hr { visibility: hidden; }

/* "[− 7 +] days [before|after] the event": the −/+ buttons are the stepper, so the
   native spinners are hidden; corners match the switch beside it. */
#opp-form .opportunities-rel-due {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm) var(--spacing-smd);
}
#opp-form .opportunities-rel-due__stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--color-grey-300);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-card-bg);
}
#opp-form .opportunities-rel-due__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    border: 0;
    background: var(--color-surface-subtle);
    color: var(--color-text-cool);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
#opp-form .opportunities-rel-due__step:hover { background: var(--color-surface-hover); color: var(--color-text); }
#opp-form .opportunities-rel-due__step:active { background: var(--color-grey-200); }
#opp-form .opportunities-rel-due__num {
    width: 3.25rem;
    border: 0;
    border-left: 1px solid var(--color-grey-200);
    border-right: 1px solid var(--color-grey-200);
    text-align: center;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    color: var(--color-text-cool);
    background: var(--color-card-bg);
    -moz-appearance: textfield;
}
#opp-form .opportunities-rel-due__num:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: -2px;
}
#opp-form .opportunities-rel-due__num::-webkit-outer-spin-button,
#opp-form .opportunities-rel-due__num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#opp-form .opportunities-rel-due__unit,
#opp-form .opportunities-rel-due__suffix {
    font-size: var(--font-size-md);
    color: var(--color-grey-700);
}
#opp-form .opportunities-rel-due__unit { min-width: 2.25rem; }
#opp-form .opportunities-rel-due__dir { flex: 0 0 auto; }

/* Sticky footer: negative margins cancel the drawer body's padding so the bar sits
   edge to edge and flush with the bottom. */
#opp-form .opportunities-drawer-footer {
    position: sticky;
    bottom: calc(0px - var(--spacing-mdlg));
    z-index: var(--z-raised);
    margin: var(--spacing-lg) calc(0px - var(--spacing-mdlg)) calc(0px - var(--spacing-mdlg));
    padding: var(--spacing-md) var(--spacing-mdlg);
    background: var(--color-card-bg);
    border-top: 1px solid var(--color-border-hairline);
}

/* The due-date tooltip carries a sentence, so it wraps. */
#opp-form .opportunities-due-info {
    color: var(--color-text-muted);
    cursor: help;
    font-size: var(--font-size-sm);
    margin-left: var(--spacing-2xs);
    vertical-align: baseline;
}
#opp-form .opportunities-due-info[data-tooltip]::after {
    white-space: normal;
    width: max-content;
    max-width: 15rem;
    text-align: left;
    font-weight: var(--font-weight-body);
}

/* A fixed level-picker width keeps the skill rows lined up. */
#opp-form .opportunities-skill-level { flex: 0 0 9rem; }

/* Locked mid-save buttons use aria-disabled (so a tap can explain), which Bootstrap never dims. */
#opp-form .btn[aria-disabled="true"] { opacity: .65; cursor: default; }

/* Phone: a full-width footer at touch height that keeps the base sticky offsets
   (bottom: 0 lands 20px short) and clears the home indicator. Last in the file:
   base rules never follow a media block. */
@media (max-width: 767.98px) {
    #opp-form .opportunities-drawer-footer {
        padding: var(--spacing-sm) var(--spacing-md);
        padding-bottom: calc(var(--safe-bottom) + var(--spacing-sm));
        background: var(--color-card-bg);
        border-top: 1px solid var(--color-grey-200);
    }
    #opp-form .opportunities-drawer-footer .btn {
        flex: 1 1 0;
        min-height: var(--control-h-touch);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
