/* <cs-tag-input> — multi-tag input with typeahead.
 * Light DOM, themeable from outside via these class names. */

cs-tag-input,
cs-tag-input:focus,
cs-tag-input:focus-within {
    display: block;
    position: relative;
    font-family: inherit;
    color: #1c1f24;
    outline: none;
}

cs-tag-input .cs-tag-input__chips {
    min-height: 44px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    cursor: text;
    transition: border-color 0.15s ease;
}

/* Focus state: change border colour only — no flat box-shadow band that
 * would visually read as a second rectangle around the first. */
cs-tag-input:focus-within .cs-tag-input__chips {
    border-color: var(--wa-color-primary-500, #0c6af5);
}

/* Chips */
cs-tag-input .cs-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 4px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    user-select: none;
}

cs-tag-input .cs-chip--linked {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    color: #1565c0;
}

cs-tag-input .cs-chip--custom {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #424242;
    padding-left: 10px;
}

cs-tag-input .cs-chip__avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

cs-tag-input .cs-chip__name {
    font-weight: 500;
    white-space: nowrap;
}

cs-tag-input .cs-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    border: 0;
    font-size: 14px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
}

cs-tag-input .cs-chip__remove:hover {
    background: rgba(0, 0, 0, 0.18);
}

/* The typing input */
cs-tag-input .cs-tag-input__entry {
    flex: 1;
    min-width: 120px;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: #1c1f24;
    padding: 6px 4px;
}

cs-tag-input .cs-tag-input__entry:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}

cs-tag-input .cs-tag-input__entry::placeholder {
    color: #999;
}

/* Suggestion menu */
cs-tag-input .cs-tag-input__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    max-height: 240px;
    overflow-y: auto;
}

cs-tag-input .cs-tag-input__menu li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    color: #1c1f24;
}

cs-tag-input .cs-tag-input__menu li.cs-tag-input__menu-item--active,
cs-tag-input .cs-tag-input__menu li:hover {
    background: #eef4ff;
}

cs-tag-input .cs-tag-input__menu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

cs-tag-input .cs-tag-input__menu-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

cs-tag-input .cs-tag-input__menu-name {
    font-weight: 600;
    font-size: 14px;
    color: #1c1f24;
}

cs-tag-input .cs-tag-input__menu-username {
    font-size: 12px;
    color: #666;
}
