/* ============================================== */
/* === СТИЛИ ДЛЯ ВЫПАДАЮЩИХ СПИСКОВ (В СТИЛЕ САЙТА) === */
/* ============================================== */

.custom-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
}

/* Кнопка (заголовок списка) */
.dropdown-header {
    background-color: rgba(26, 26, 26, 0.6); /* Фирменный темный фон */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; /* Возвращаем скругление 12px */
    padding: 14px 16px;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-header:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(40, 40, 40, 0.8);
}

/* Состояние "Открыто" */
.custom-dropdown.open .dropdown-header {
    border-color: #FABF3C; /* Фирменный желтый/оранжевый */
    box-shadow: 0 0 0 4px rgba(250, 191, 60, 0.15);
}

.dropdown-arrow {
    transition: transform 0.2s ease;
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
    color: #FABF3C; /* Стрелка перекрашивается в акцентный цвет */
    opacity: 1;
}

/* --- ВЫПАДАЮЩИЙ СПИСОК --- */
.dropdown-list {
    position: absolute;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    
    background-color: #141414; /* Плотный темный фон сайта */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    z-index: 9999;
    
    /* Анимация */
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ОТКРЫТИЕ ВВЕРХ (Для Соотношения сторон) */
#aspect-ratio-group .dropdown-list {
    top: auto;
    bottom: calc(100% + 8px); /* Отступ над кнопкой */
    transform: translateY(10px);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}
#aspect-ratio-group .custom-dropdown.open .dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ОТКРЫТИЕ ВНИЗ (Для Выбора нейросети) */
.custom-dropdown:not(#dd-ratio) .dropdown-list {
    top: calc(100% + 8px); /* Отступ под кнопкой */
    transform: translateY(-10px);
}
.custom-dropdown:not(#dd-ratio).open .dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- ЭЛЕМЕНТЫ СПИСКА --- */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    color: #aaa; /* Стандартный серый текст */
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
}

.dropdown-item:last-child { 
    border-bottom: none; 
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dropdown-item.active {
    background-color: rgba(250, 191, 60, 0.1); /* Легкая подсветка фона */
    color: #FABF3C; /* Фирменный акцентный цвет */
    font-weight: bold;
}

/* Описание справа (Exclusive, Square и тд) */
.dropdown-item-desc {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: normal;
}
.dropdown-item:hover .dropdown-item-desc {
    color: rgba(255, 255, 255, 0.6);
}
.dropdown-item.active .dropdown-item-desc {
    color: rgba(250, 191, 60, 0.8);
}

/* --- CSS ИКОНКИ ФОРМАТОВ --- */
.ratio-icon {
    border: 1.5px solid currentColor;
    border-radius: 2px;
    margin-right: 12px;
    opacity: 0.6;
    display: inline-block;
    transition: opacity 0.2s;
}
.dropdown-item:hover .ratio-icon { opacity: 0.8; }
.dropdown-item.active .ratio-icon { opacity: 1; }

.r-16-9 { width: 18px; height: 10px; }
.r-9-16 { width: 10px; height: 18px; }
.r-1-1  { width: 14px; height: 14px; }
.r-4-3  { width: 16px; height: 12px; }
.r-3-4  { width: 12px; height: 16px; }
.r-21-9 { width: 22px; height: 9px; }
.r-3-2  { width: 17px; height: 11px; }
.r-2-3  { width: 11px; height: 17px; }

/* ДОБАВЛЕНО ДЛЯ 5:4 и 4:5 */
.r-5-4  { width: 15px; height: 12px; }
.r-4-5  { width: 12px; height: 15px; }

.r-auto { width: 14px; height: 14px; border-style: dashed; }

/* Кастомизация скроллбара внутри списка */
.dropdown-list::-webkit-scrollbar { width: 6px; }
.dropdown-list::-webkit-scrollbar-track { background: transparent; }
.dropdown-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
.dropdown-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* ========================================================================= */
/* ===  СТИЛИ ДЛЯ КНОПКИ МЕТОК (Чтобы была темной как остальные)         === */
/* ========================================================================= */

#prompt-helper-popover-btn {
    background-color: rgba(26, 26, 26, 0.6); /* Темный фон как у dropdown-header */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff; /* Белый текст */
    padding: 14px 16px;
    text-align: left;
    background-image: none; /* Убираем стандартную стрелку form-select */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

/* Добавляем свою стрелочку через CSS (или можно SVG в HTML, как в других списках) */
#prompt-helper-popover-btn::after {
    content: '';
    width: 0.8em;
    height: 0.8em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.7;
    transition: transform 0.2s;
}

/* Эффект при наведении */
#prompt-helper-popover-btn:hover {
    background-color: rgba(40, 40, 40, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Убираем синюю обводку при фокусе */
#prompt-helper-popover-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(250, 191, 60, 0.15); /* Оранжевое свечение вместо синего */
    border-color: #FABF3C;
}

/* Если Popover открыт (Bootstrap добавляет aria-expanded="true") */
#prompt-helper-popover-btn[aria-expanded="true"] {
    border-color: #FABF3C;
}
#prompt-helper-popover-btn[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* ========================================================================= */
/* ===  ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ МЕТОК                                     === */
/* ========================================================================= */

#prompt-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    width: 100%;
    
    /* Эти свойства гарантируют видимость */
    min-height: auto; 
    flex-shrink: 0;       /* Запрещаем контейнеру сжиматься */
    opacity: 1 !important;
    visibility: visible !important;
}

.prompt-tag {
    /* Цвета */
    background-color: rgba(250, 191, 60, 0.15);
    border: 1px solid rgba(250, 191, 60, 0.3);
    color: #e0e0e0;
    
    /* Размеры */
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    
    /* Позиционирование */
    display: inline-flex; /* Используем inline-flex, чтобы размер зависел от текста */
    align-items: center;
    gap: 8px;
    
    /* Убираем анимацию, чтобы исключить глюки */
    animation: none !important;
    opacity: 1 !important;
}

.prompt-tag span {
    pointer-events: none;
    white-space: nowrap; /* Текст не переносится внутри метки */
}

.prompt-tag-remove {
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.prompt-tag-remove:hover {
    color: #fff;
    background-color: rgba(220, 53, 69, 0.6);
}