/* ================================================================
   FriendsByChance — components/taglike-editor.css
   TagLikeEditor overlay component (.tle-* namespace).
   ================================================================ */

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

.tle-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 ───────────────────────────────────────────────── */

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

/* Full-screen variant for narrow viewports */
.tle-modal--full {
    width:          100%;
    max-width:      100%;
    height:         100%;
    max-height:     100%;
    border-radius:  0;
}

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

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

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

.tle-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;
}
.tle-close:hover { color: var(--color-text); background: var(--color-hover, rgba(0,0,0,0.06)); }

/* ── Scrollable body ──────────────────────────────────────────── */

.tle-body {
    flex:       1;
    overflow-y: auto;
    padding:    16px;
    display:    flex;
    flex-direction: column;
    gap:        14px;
    scrollbar-gutter: stable;
}

/* ── Form field ───────────────────────────────────────────────── */

.tle-field {
    display:        flex;
    flex-direction: column;
    gap:            5px;
}

.tle-label {
    font-size:   0.8rem;
    font-weight: 600;
    color:       var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tle-label-optional {
    font-weight:    400;
    text-transform: none;
    letter-spacing: 0;
    color:          var(--color-text-secondary);
    opacity:        0.7;
}

/* Name + colour on one line: the input takes the space, the swatch sits
   right-aligned at its natural size. */
.tle-name-row {
    display:     flex;
    align-items: center;
    gap:         8px;
}
.tle-name-row .tle-input { flex: 1; min-width: 0; }

.tle-input,
.tle-textarea {
    width:         100%;
    box-sizing:    border-box;
    padding:       8px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 6px;
    font-size:     0.93rem;
    color:         var(--color-text);
    background:    var(--color-bg, #fff);
    transition:    border-color 0.12s;
}
.tle-input:focus,
.tle-textarea:focus {
    outline:       none;
    border-color:  var(--color-primary, #4a7c59);
    box-shadow:    0 0 0 2px rgba(74,124,89,0.12);
}
.tle-input--locked,
.tle-textarea.tle-input--locked {
    background:  #f6f6f6;
    color:       var(--color-text-secondary);
    cursor:      not-allowed;
}

.tle-textarea {
    resize:        vertical;
    min-height:    70px;
    line-height:   1.45;
}

/* Character hint — appears only near the limit */
.tle-char-hint {
    font-size:   0.74rem;
    color:       var(--color-text-secondary);
    text-align:  right;
    opacity:     0;
    transition:  opacity 0.15s;
    height:      0;
    overflow:    hidden;
}
.tle-char-hint--visible {
    opacity:  1;
    height:   auto;
}

/* Color field */
/* .tle-color-field removed: the colour swatch now shares the name row
   (.tle-name-row above) rather than occupying a field of its own. */

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

.tle-footer {
    border-top:  1px solid var(--color-divider);
    padding:     12px 16px;
    flex-shrink: 0;
    display:     flex;
    flex-direction: column;
    gap:         8px;
}

.tle-footer-row {
    display:     flex;
    align-items: center;
    gap:         8px;
}

/* Spacer pushes cancel/save to the right when a delete button is present */
.tle-footer-spacer { flex: 1; }

/* ── Inline error ─────────────────────────────────────────────── */

.tle-error {
    font-size:   0.82rem;
    color:       var(--color-danger, #c0392b);
    display:     none;
    min-height:  0;
}
.tle-error--visible { display: block; }

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

.tle-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;
}

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

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

/* The editor's secondary actions ("Select…") use the shared .fbc-btn
   (components/shared.css). */

/* Secondary field — very discreet, placed first (e.g. tag type selector) */
.tle-field--secondary {
    flex-direction: row;
    align-items:    center;
    gap:            8px;
    padding:        6px 0 2px;
    border-bottom:  1px solid var(--color-divider);
    margin-bottom:  2px;
}
.tle-field--secondary .tle-label {
    font-size:      0.75rem;
    letter-spacing: 0.02em;
    opacity:        0.6;
    flex-shrink:    0;
    margin-bottom:  0;
}

/* Combo member chips strip */
.tle-combo-chips {
    display:   flex;
    flex-wrap: wrap;
    gap:       5px;
    min-height: 28px;
}

.tle-combo-empty {
    font-size:  0.84rem;
    color:      var(--color-text-secondary);
    font-style: italic;
}

/* ── Group + type, the row above the name ─────────────────────────
   Two questions that belong together: which drawer, and what kind of
   thing.  They share a row when it fits and stack when it does not —
   the type buttons keep their 44px targets either way, so squeezing
   them onto one line would be the wrong saving. */

.tle-identity-row {
    display:     flex;
    flex-wrap:   wrap;
    align-items: flex-end;
    gap:         10px 14px;
    margin-bottom: 14px;
}

/* The group takes the slack; the type sits at the right end of the row.
   Its basis is deliberately small: the type field grew a third option when
   areas arrived, and a group that insisted on 190px pushed the two apart
   onto separate lines at every width.  The group is one button showing one
   name, and a name that does not fit ellipsises. */
.tle-identity-row .tle-field--group {
    flex:      1 1 120px;
    min-width: 0;
    margin-bottom: 0;
}
.tle-identity-row .tle-field--group .fbc-segchoice-btn { min-width: 0; }
.tle-identity-row .tle-field--kind {
    flex:        0 1 auto;
    margin-left: auto;
    margin-bottom: 0;
}
.tle-identity-row .tle-field--kind .fbc-segchoice { justify-content: flex-end; }

/* The current kind's own fields.  A wrapper rather than loose children so
   changing the kind can replace exactly this much. */
.tle-extras { display: block; }

/* In a nameless group, where the name would be (TagLikeEditor). */
.tle-nameless {
    flex:        1;
    min-width:   0;
    align-self:  center;
    font-size:   0.85rem;
    font-style:  italic;
    color:       var(--color-text-muted);
}
