/* ================================================================
   Автокомплит для полей формы дела
   ================================================================ */

.ac-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Инлайн-режим: теги и поле ввода в одной строке, как в почтовом клиенте */
.ac-wrap--multi {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--gray-light, #e0e0e0);
    border-radius: 8px;
    background: white;
    font-size: 14px;
    min-height: 42px;
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ac-wrap--multi:focus-within {
    border-color: var(--primary-color, #00c2f1);
    box-shadow: 0 0 0 3px rgba(0, 194, 241, 0.15);
}
body.dark-theme .ac-wrap--multi {
    background: #2d3238;
    border-color: var(--gray, #555);
    color: white;
}

/* Теги выбранных значений (только для одиночного wrap, не используется в --multi) */
.ac-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 0;
}

.ac-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    background: rgba(0, 194, 241, 0.12);
    border: 1px solid rgba(0, 194, 241, 0.35);
    border-radius: 20px;
    font-size: 12px;
    color: var(--dark-color, #333);
    line-height: 1.4;
    max-width: 100%;
    word-break: break-word;
}

.ac-tag-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--primary-color, #00c2f1);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.ac-tag-remove:hover { opacity: 1; }

/* Поле поиска */
.ac-search {
    width: 100%;
    box-sizing: border-box;
}
/* В инлайн-режиме поиск течёт после тегов, без своей рамки */
.ac-wrap--multi .ac-search {
    flex: 1;
    min-width: 100px;
    width: auto;
    border: none;
    background: transparent;
    outline: none;
    box-shadow: none !important;
    padding: 2px 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}
body.dark-theme .ac-wrap--multi .ac-search {
    color: white;
}

/* Выпадающий список */
.ac-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 4000;
    background: white;
    border: 1px solid var(--gray-light, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.ac-dropdown[hidden] { display: none; }

.ac-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--dark-color, #333);
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    line-height: 1.4;
    transition: background 0.1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover,
.ac-item.ac-item--active {
    background: rgba(0, 194, 241, 0.08);
    color: var(--primary-color, #00c2f1);
}

.ac-item-sub {
    font-size: 11px;
    color: #999;
    margin-left: 4px;
}

.ac-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #aaa;
    text-align: center;
}
