/* ================================================================
   FriendsByChance — components/shared.css
   Generic right-column icon buttons and side column used across
   multiple features (journeys, ETB, etc.).
   ================================================================ */

/* ── A section's title — THE one, wherever a section is named: a sheet,
   an action sheet's group, a form, a page's sections (one look per
   thing, 000 §1.13).  Where it sits (its margins) is its host's, under
   a class of the host's own.  --ruled: a form's, a rule under it. ───── */
.fbc-section-title {
    font-size:      0.78rem;
    font-weight:    600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color:          var(--color-text-secondary);
}
.fbc-section-title--ruled {
    margin:         28px 0 14px;
    padding-bottom: 6px;
    border-bottom:  1px solid var(--color-divider);
}
.fbc-section-title--ruled:first-of-type { margin-top: 0; }

/* ── A section folded to its title (FBC.ui.sectionFold) ───────────
   The chevron and the name: one button, finger-high.  The chevron points
   down while folded (it unfolds), up while open.  Folded, the section
   shows that button alone: not its body, not the buttons on its title's
   row (.fbc-section-head). */
.fbc-section-fold {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    min-width:     0;
    min-height:    30px;
    padding:       0 8px 0 4px;
    margin-left:   -4px;
    border:        none;
    border-radius: 6px;
    background:    none;
    color:         var(--color-text-secondary);
    cursor:        pointer;
    text-align:    left;
}
.fbc-section-fold:hover         { background: var(--color-hover); }
.fbc-section-fold:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.fbc-section-fold-mark          { display: flex; flex: none; color: var(--color-primary); }
.fbc-section-fold-mark svg      { transition: transform var(--transition); }
.fbc-section-fold[aria-expanded="true"] .fbc-section-fold-mark svg { transform: rotate(180deg); }
.fbc-section--folded > :not(.fbc-section-head),
.fbc-section--folded > .fbc-section-head > :not(.fbc-section-fold) { display: none !important; }

/* ── Icon button (30 × 30, icon-only, used in side columns) ─────── */
.fbc-icon-btn {
    width:           30px;
    height:          30px;
    border-radius:   6px;
    border:          1px solid var(--color-divider);
    background:      var(--color-bg);
    color:           var(--color-text);
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         0;
    flex-shrink:     0;
    transition:      background 0.12s;
    line-height:     1;
}
.fbc-icon-btn:hover        { background: var(--color-hover, rgba(0,0,0,0.05)); }
.fbc-icon-btn:disabled     { opacity: 0.4; cursor: default; pointer-events: none; }
/* Pressed in, hovered or not (a pseudo-class outranks a modifier, 000 L58). */
.fbc-icon-btn--active,
.fbc-icon-btn--active:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.fbc-icon-btn.danger       { color: var(--color-danger, #c0392b); border-color: var(--color-danger, #c0392b); }
.fbc-icon-btn.danger:hover { background: rgba(192,57,43,0.06); }

/* ── Text button ────────────────────────────────────────────────────
   The one look for a small action that says what it does in words:
   "+ Add", "Select…", "Copy coordinates".  Outlined in the primary
   colour — an action, not the decision (that is a filled button).    */
.fbc-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    min-height:      34px;
    padding:         0 14px;
    border:          1px solid transparent;
    border-radius:   6px;
    font:            inherit;
    font-size:       0.86rem;
    font-weight:     500;
    line-height:     1.2;
    white-space:     nowrap;
    cursor:          pointer;
    transition:      background 0.12s, border-color 0.12s;
}
.fbc-btn:disabled { opacity: 0.5; cursor: default; }

.fbc-btn--secondary {
    background:   var(--color-surface);
    border-color: var(--color-primary);
    color:        var(--color-primary);
}
.fbc-btn--secondary:hover:not(:disabled) { background: var(--color-hover); }
/* A text button that is a TOGGLE (aria-pressed): pressed, filled. */
.fbc-btn--secondary[aria-pressed="true"],
.fbc-btn--secondary[aria-pressed="true"]:hover:not(:disabled) {
    background: var(--color-primary);
    color:      var(--color-text-on-primary);
}

/* Beside a section title rather than in a form. */
.fbc-btn--small {
    min-height: 30px;
    padding:    0 11px;
    font-size:  0.82rem;
}

/* ── A card to pick (THE PICK CARD) ──────────────────────────────
   One of a short list to choose from, each a small rounded card: the
   Chat page's recent chats (chat-page.js), the right pane's history
   (pane-layout.js).  An icon or face, a name, a line under it; selected
   (the one on show, the one chosen) outlined in green; disabled greyed. */
.fbc-pick-card {
    display:       flex;
    align-items:   center;
    gap:           8px;
    width:         100%;
    min-width:     0;
    padding:       6px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 10px;
    background:    var(--color-surface);
    color:         var(--color-text-primary);
    text-align:    left;
    cursor:        pointer;
}
.fbc-pick-card:hover:not(:disabled) { background: var(--color-hover); border-color: var(--color-primary-light); }
.fbc-pick-card--selected,
.fbc-pick-card--selected:hover:not(:disabled) {
    border-color: var(--color-primary);
    background:   var(--color-selected);
    box-shadow:   inset 0 0 0 1px var(--color-primary);
}
.fbc-pick-card:disabled { opacity: 0.55; cursor: default; }
.fbc-pick-card-icon { flex: none; display: inline-flex; color: var(--color-primary); }
.fbc-pick-card-icon:empty { display: none; }
.fbc-pick-card-text { display: flex; flex-direction: column; min-width: 0; }
.fbc-pick-card-name,
.fbc-pick-card-sub {
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
}
.fbc-pick-card-name { font-size: 0.82rem; font-weight: 600; }
.fbc-pick-card-sub  { font-size: 0.74rem; color: var(--color-text-secondary); }

/* ── A list's SEARCH (THE SEARCH FIELD) ─────────────────────────────
   One look for the search at the top of a page's left pane — Contacts,
   My Journeys (and The Map's journey trees: FBC.ui.JourneyTree), Chat's
   lists — the user, 2026-11-01: "we want DRY and consistency".  Its row
   holds the field and, at its end, the list's own buttons (Chat's "new
   group"); the field is type="search", so its × is FBC.ui.clearable's. */
.fbc-search-row {
    display:       flex;
    align-items:   center;
    gap:           8px;
    padding:       10px 12px 8px;
    border-bottom: 1px solid var(--color-divider);
    background:    var(--color-bg);
    flex-shrink:   0;
}
.fbc-search {
    flex:          1;
    min-width:     0;
    width:         100%;
    box-sizing:    border-box;
    padding:       7px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 6px;
    font-size:     0.9rem;
    background:    var(--color-input-bg);
    color:         var(--color-text);
}
.fbc-search:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.fbc-search-row > .fbc-icon-btn { flex: none; }

/* ── Where a tag-like is used, in its card (FBC.ui.uses.block) ──── */
.uses-block       { display: flex; flex-direction: column; gap: 3px; }
.uses-block-title { margin-bottom: 2px; }
.uses-block-line  { font-size: 0.82rem; color: var(--color-text-secondary); line-height: 1.35; }

/* ── Pressable as a whole (FBC.ui.pressable): every chip shown ─────
   One look for "this opens its card" — a tag-like's, a person's, a
   chat's, a journey's, an album's: the pointer, a touch darker under it,
   the focus ring. */
.fbc-pressable { cursor: pointer; transition: filter 0.1s; }
.fbc-pressable:hover { filter: brightness(0.94); }
.fbc-pressable:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ── Side column (vertical stack of icon buttons) ───────────────── */
.fbc-side-col {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    flex-shrink:    0;
    padding-top:    2px;
}

/* ── The grip a row is put in order by (FBC.ui.dragReorder's handle) ─
   One look wherever rows are dragged: the six dots, muted.  A finger on
   it drags, never scrolls; it is --fbc-grip-w wide (a finger's, on a
   touch screen).  Where it sits is its host's. ─────────────────────── */
.fbc-drag-handle {
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    width:           var(--fbc-grip-w);
    color:           var(--color-text-muted);
    cursor:          grab;
    touch-action:    none;
    user-select:     none;
    -webkit-user-select:   none;
    -webkit-touch-callout: none;
}
.fbc-drag-handle:active { cursor: grabbing; }
/* A list put in order in its edit mode (FBC.ui.editMode): its grips are
   there only then — the user, 2026-10-23. */
.fbc-edit-list:not(.fbc-edit-mode) .fbc-drag-handle { display: none; }

/* ── Confirm / edit-guard dialog (shared across all pages) ────────── */

.fbc-confirm-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(0, 0, 0, 0.45);
    z-index:         700;
    display:         flex;
    align-items:     center;
    justify-content: center;
}

.fbc-confirm-box {
    background:    var(--color-bg);
    border-radius: 10px;
    padding:       28px 28px 20px;
    max-width:     420px;
    width:         90%;
    box-shadow:    0 8px 32px rgba(0,0,0,0.18);
}

.fbc-confirm-box h3 {
    margin:    0 0 8px;
    font-size: 1.05rem;
}

.fbc-confirm-box p {
    margin:    0 0 12px;
    font-size: 0.88rem;
    color:     var(--color-text-secondary);
}

/* What the answer acts on, one per line (FBC.ui.confirm `items`). */
.fbc-confirm-list {
    margin:     0 0 14px;
    padding:    8px 12px 8px 28px;
    max-height: 40vh;
    overflow-y: auto;
    border:     1px solid var(--color-divider);
    border-radius: 8px;
    font-size:  0.88rem;
    color:      var(--color-text);
}
.fbc-confirm-list li + li { margin-top: 3px; }

.fbc-confirm-input {
    width:         100%;
    box-sizing:    border-box;
    padding:       7px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 6px;
    font-size:     0.9rem;
    color:         var(--color-text);
    background:    var(--color-bg, #fff);
    margin-bottom: 8px;
    outline:       none;
    display:       block;
}
.fbc-confirm-input:focus { border-color: var(--color-primary, #4a7c59); }

.fbc-confirm-error {
    font-size:     0.82rem;
    color:         var(--color-danger, #c0392b);
    margin-bottom: 12px;
    min-height:    1.2em;
}

.fbc-confirm-box .row-btns { justify-content: flex-end; }

.fbc-confirm-box button {
    padding:       7px 16px;
    font-size:     0.88rem;
    border-radius: 6px;
    border:        1px solid var(--color-divider);
    cursor:        pointer;
    background:    transparent;
    color:         var(--color-text);
}
.fbc-confirm-box button.primary {
    background:   var(--color-primary, #4a7c59);
    border-color: var(--color-primary, #4a7c59);
    color:        #fff;
}
.fbc-confirm-box button.danger {
    background:   var(--color-danger, #c0392b);
    border-color: var(--color-danger, #c0392b);
    color:        #fff;
}
.fbc-confirm-box button:hover { opacity: 0.85; }
.fbc-confirm-box button:disabled { opacity: 0.5; cursor: default; }

/* ── Type-delete dialog (FBC.ui.TypeDeleteDialog) ──────────────────
   The confirm shell above, with a body: three fates for what is in the
   drawer, and the panel each one needs. */

.tdd-box { max-width: 520px; }

.tdd-choices {
    display:        flex;
    flex-direction: column;
    gap:            2px;
    margin-bottom:  12px;
}

.tdd-choice {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding:     7px 8px;
    border-radius: 6px;
    font-size:   0.88rem;
    color:       var(--color-text);
    cursor:      pointer;
}
.tdd-choice:hover                { background: var(--color-hover, rgba(0,0,0,0.04)); }
.tdd-choice--danger              { color: var(--color-danger, #c0392b); }
.tdd-choice input[type="radio"]  { flex-shrink: 0; margin: 0; }

/* A fate's panel is indented under its radio, so it reads as belonging
   to the choice above it rather than to the dialog. */
.tdd-move,
.tdd-delete {
    margin:      2px 0 8px 26px;
    padding-left: 10px;
    border-left: 2px solid var(--color-divider);
}

.tdd-target-row {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-wrap:   wrap;
    margin-bottom: 8px;
}
.tdd-target-label { font-size: 0.84rem; color: var(--color-text-secondary); }
.tdd-target       { flex: 1; min-width: 140px; }

.tdd-tools {
    display:     flex;
    align-items: center;
    gap:         10px;
    margin-bottom: 6px;
}

.tdd-all-btn {
    padding:       3px 10px !important;
    font-size:     0.8rem !important;
    color:         var(--color-primary, #4a7c59) !important;
}

.tdd-count { font-size: 0.8rem; color: var(--color-text-secondary); }

/* Scrolls rather than growing: a drawer can hold a couple of hundred
   places, and the dialog still has to fit on a phone. */
.tdd-list {
    display:     flex;
    flex-direction: column;
    gap:         2px;
    max-height:  34vh;
    overflow-y:  auto;
    padding:     2px;
}

.tdd-item {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding:     3px 4px;
    border-radius: 6px;
    cursor:      pointer;
    min-width:   0;
}
.tdd-item:hover                  { background: var(--color-hover, rgba(0,0,0,0.04)); }
.tdd-item input[type="checkbox"]  { flex-shrink: 0; margin: 0; }

.tdd-note,
.tdd-warn {
    margin:    6px 0 0;
    font-size: 0.8rem;
    color:     var(--color-text-secondary);
    min-height: 1.1em;
}
.tdd-warn { color: var(--color-danger, #c0392b); }

/* A CHIP's words on its colour — every coloured chip (a tag-like's, a
   journey's): dark on a light colour, white on a dark one, each with a faint
   halo of the opposite tone round the letters ("bold text with
   border/shadow … without being too obvious", the user, 2026-11-01).
   Which: FBC.ui.ColorPicker.chipInk. */
.fbc-ink-light { color: #fff; text-shadow: 0 0 1px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.25); }
.fbc-ink-dark  { color: rgba(0, 0, 0, 0.82); text-shadow: 0 0 1px rgba(255, 255, 255, 0.6); }
