/* ================================================================
   FriendsByChance — components/taglike-picker.css
   TagLikePicker overlay component (.tlp-* namespace).
   ================================================================ */

/* ── Overlay backdrop ─────────────────────────────────────────── */

.tlp-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(0, 0, 0, 0.42);
    z-index:         300;
    display:         flex;
    align-items:     center;
    justify-content: center;
}

/* ── Modal card ───────────────────────────────────────────────── */

.tlp-modal {
    background:     var(--color-bg, #fff);
    border-radius:  10px;
    width:          min(480px, 95vw);
    height:         560px;
    max-height:     85vh;
    display:        flex;
    flex-direction: column;
    box-shadow:     0 8px 36px rgba(0, 0, 0, 0.22);
    overflow:       hidden;
}

.tlp-modal--full {
    width:          100%;
    max-width:      100%;
    height:         100%;
    max-height:     100%;
    border-radius:  0;
}

/* ── Header ───────────────────────────────────────────────────── */

.tlp-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         14px 16px 12px;
    border-bottom:   1px solid var(--color-divider);
    flex-shrink:     0;
}

.tlp-title {
    font-weight: 600;
    font-size:   1rem;
    color:       var(--color-text);
}

.tlp-close {
    background:    none;
    border:        none;
    font-size:     1.3rem;
    line-height:   1;
    cursor:        pointer;
    color:         var(--color-text-secondary);
    padding:       2px 6px;
    border-radius: 4px;
}
.tlp-close:hover { color: var(--color-text); background: var(--color-hover, rgba(0,0,0,0.06)); }

/* ── Fixed controls section ───────────────────────────────────── */

.tlp-controls {
    flex-shrink: 0;
    display:     flex;
    flex-direction: column;
    gap:         0;
    border-bottom: 1px solid var(--color-divider);
}

/* Limit info line */
.tlp-limit-info {
    font-size:   0.78rem;
    color:       var(--color-text-secondary);
    padding:     6px 16px 0;
}

/* Search input */
.tlp-search {
    display:       block;
    width:         100%;
    box-sizing:    border-box;
    padding:       8px 14px;
    border:        none;
    border-bottom: 1px solid var(--color-divider);
    font-size:     0.93rem;
    color:         var(--color-text);
    background:    var(--color-bg, #fff);
    outline:       none;
}
.tlp-search:focus { background: #f9f9f9; }
.tlp-search-row { display: flex; align-items: center; border-bottom: 1px solid var(--color-divider); }
.tlp-search-row .tlp-search { flex: 1 1 auto; min-width: 0; border-bottom: none; }
.tlp-search-row .tlp-create { flex: 0 0 auto; margin-right: 8px; }

/* Filter tab bar */
.tlp-filter-bar {
    display:    flex;
    flex-wrap:  wrap;
    gap:        6px;
    padding:    8px 14px;
    border-bottom: 1px solid var(--color-divider);
}

.tlp-filter-btn {
    padding:       4px 12px;
    border-radius: 14px;
    font-size:     0.82rem;
    font-weight:   500;
    cursor:        pointer;
    border:        1px solid var(--color-divider);
    background:    var(--color-bg, #fff);
    color:         var(--color-text-secondary);
    transition:    background 0.1s, color 0.1s, border-color 0.1s;
    line-height:   1.4;
}

.tlp-filter-btn:hover { background: var(--color-hover, rgba(0,0,0,0.05)); color: var(--color-text); }
.tlp-filter-btn--active {
    background:   var(--color-primary, #4a7c59);
    border-color: var(--color-primary, #4a7c59);
    color:        #fff;
}
.tlp-filter-btn--active:hover { opacity: 0.88; background: var(--color-primary, #4a7c59); color: #fff; }

/* Tools bar (deselect-all etc) */
.tlp-tools {
    display:     flex;
    align-items: center;
    padding:     6px 14px;
    gap:         8px;
    border-bottom: 1px solid var(--color-divider);
}

.tlp-deselect-btn {
    background:    none;
    border:        none;
    font-size:     0.82rem;
    color:         var(--color-primary, #4a7c59);
    cursor:        pointer;
    padding:       2px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.tlp-deselect-btn:hover { opacity: 0.75; }

/* Limit error */
.tlp-limit-error {
    font-size:   0.82rem;
    color:       var(--color-danger, #c0392b);
    padding:     0 16px;
    max-height:  0;
    overflow:    hidden;
    transition:  max-height 0.15s, padding 0.15s;
}
.tlp-limit-error--visible {
    max-height: 60px;
    padding:    6px 16px;
}

/* ── Scrollable list ──────────────────────────────────────────── */

.tlp-list {
    flex:       1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding:    4px 0;
}

/* Group / pinned header */
.tlp-group-header { padding: 10px 16px 4px; }   /* its look: .fbc-section-title (components/shared.css) */
.tlp-group-header:first-child { padding-top: 6px; }

.tlp-pinned-header {
    color: var(--color-primary, #4a7c59);
}

/* Row */
.tlp-row {
    display:     flex;
    align-items: center;
    gap:         10px;
    padding:     7px 16px;
    cursor:      pointer;
    transition:  background 0.08s;
    min-height:  38px;
}
.tlp-row:hover        { background: var(--color-hover, rgba(0,0,0,0.04)); }
.tlp-row--selected    { background: color-mix(in srgb, var(--color-primary) 8%, transparent); }
.tlp-row--selected:hover { background: color-mix(in srgb, var(--color-primary) 13%, transparent); }

/* Checkmark column — none where nothing can be ticked (one to pick, none there). */
.tlp-overlay--single .tlp-check { display: none; }
.tlp-check {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           18px;
    height:          18px;
    flex-shrink:     0;
    border-radius:   4px;
    border:          2px solid var(--color-divider);
    transition:      background 0.1s, border-color 0.1s;
    background:      var(--color-bg, #fff);
}
.tlp-row--selected .tlp-check {
    background:   var(--color-primary, #4a7c59);
    border-color: var(--color-primary, #4a7c59);
}
.tlp-row--selected .tlp-check::after {
    content:    '';
    display:    block;
    width:      5px;
    height:     9px;
    border:     2px solid #fff;
    border-top:   none;
    border-left:  none;
    transform:  rotate(45deg) translate(-1px, -1px);
}

/* Fallback chip (when no makeChip provided) */
.tlp-chip {
    display:       inline-flex;
    align-items:   center;
    padding:       2px 10px;
    border-radius: 12px;
    font-size:     0.84rem;
    font-weight:   500;
    background:    #eee;
    color:         var(--color-text);
    flex-shrink:   0;
    max-width:     180px;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
}

/* Description */
.tlp-row-desc {
    font-size:     0.8rem;
    color:         var(--color-text-secondary);
    flex:          1;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
}

/* Remote search: its "searching…" / "nothing new" line, under its heading */
.tlp-remote-note {
    padding:    6px 16px 10px;
    font-size:  0.84rem;
    font-style: italic;
    color:      var(--color-text-secondary);
}

/* Empty / loading state */
.tlp-empty {
    padding:    28px 16px;
    text-align: center;
    font-size:  0.9rem;
    color:      var(--color-text-secondary);
}

/* ── Footer ───────────────────────────────────────────────────── */

.tlp-footer {
    border-top:  1px solid var(--color-divider);
    padding:     12px 16px;
    flex-shrink: 0;
}

.tlp-footer-row {
    display:         flex;
    justify-content: flex-end;
    gap:             8px;
}

/* ── Buttons ──────────────────────────────────────────────────── */

.tlp-btn {
    padding:       7px 18px;
    border-radius: 6px;
    font-size:     0.88rem;
    font-weight:   500;
    cursor:        pointer;
    border:        1px solid transparent;
    transition:    background 0.12s, opacity 0.12s;
    line-height:   1.2;
}

.tlp-btn--cancel {
    background:   var(--color-bg, #fff);
    border-color: var(--color-divider);
    color:        var(--color-text);
}
.tlp-btn--cancel:hover { background: var(--color-hover, rgba(0,0,0,0.05)); }

.tlp-btn--confirm {
    background:   var(--color-primary, #4a7c59);
    color:        #fff;
    border-color: var(--color-primary, #4a7c59);
}
.tlp-btn--confirm:hover    { opacity: 0.88; }
.tlp-btn--confirm:disabled { opacity: 0.6; cursor: default; }

/* ── Quick pick (see taglike-picker.js QUICK PICK) ────────────────── */
/* Already chosen: shown ticked, not a choice. */
.tlp-row--locked       { cursor: default; }
.tlp-row--locked:hover { background: color-mix(in srgb, var(--color-primary) 8%, transparent); }
.tlp-list--busy        { opacity: 0.6; pointer-events: none; }
.tlp-mode-btn          { margin-left: auto; }

/* The way out that is not an item ("a new one"). */
.tlp-row--lead {
    color:         var(--color-primary);
    font-weight:   600;
    border-bottom: 1px solid var(--color-divider);
}
.tlp-lead-mark {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           18px;
    height:          18px;
    flex-shrink:     0;
    font-size:       1.15rem;
    line-height:     1;
}

