/* synthesis.css */

.service-page { 
    max-width: 1240px; 
    margin: 0 auto; 
    padding: 2rem 1.5rem 6rem; 
    min-height: 85vh; 
}

.page-title { 
    text-align: center;
}

/* --- КРУПНЫЕ КАРТОЧКИ УСЛОВИЙ --- */
.benefits-grid { 
    display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; 
    margin-top: 2.5rem; /* Отступ от кнопки сверху */
    margin-bottom: 2rem; 
}
.info-card { 
    padding: 2.5rem 3rem; border-radius: 0.5rem 3rem 3rem 0.5rem; 
    display: flex; flex-direction: column; 
}
.info-card.dark-card { 
    background: var(--brand-dark); color: var(--white); 
}
.info-card.magenta-card { 
    background: var(--white); color: var(--brand-dark); 
    border: 2px solid var(--magenta); box-shadow: var(--shadow-md); 
}

.card-head h2 { 
    font-size: 1.4rem; margin-top: 0; margin-bottom: 1.5rem; 
    display: flex; align-items: center; justify-content: space-between; font-weight: 800;
}
.price-table { width: 100%; border-collapse: collapse; font-size: 1.05rem; margin-top: auto; }
.price-table td { padding: 0.8rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.magenta-card .price-table td { border-bottom-color: var(--white); }
.price-table td:last-child { text-align: right; font-weight: 700; }

/* --- ЯВНОЕ ПРЕДУПРЕЖДЕНИЕ --- */
.bsai-warning { 
    text-align: center; background: var(--white); color: var(--color-error); 
    padding: 1.2rem; border-radius: 8px; margin-bottom: 3rem; 
    border: 1px solid var(--magenta-light-border); font-size: 1.3rem; line-height: 1.5;
}

/* ИНФО-ОБЛАКА (TOOLTIPS) */
.info-trigger { position: relative; display: inline-flex; cursor: help; margin-left: 10px; }
.info-trigger { width: 22px; height: 22px; background: var(--magenta); color: var(--white); border-radius: 50%; font-size: 13px; font-weight: bold; align-items: center; justify-content: center; }
.info-cloud { visibility: hidden; opacity: 0; position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%); width: 280px; background: var(--white); color: var(--brand-dark); padding: 1.2rem; border-radius: 6px; box-shadow: var(--shadow-sm); border: 1px solid var(--white); z-index: 100; transition: 0.2s; font-size: 0.9rem; font-weight: 400; line-height: 1.5; text-transform: none; text-align: left; }
.info-trigger:hover .info-cloud { visibility: visible; opacity: 1; bottom: 130%; }

/* ГЛАВНЫЙ БОКС ЗАКАЗА */
.order-box { background: var(--white); padding: 3rem 3.5rem; border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--white); }
.mode-tabs { display: flex; gap: 1rem; margin-bottom: 2rem; justify-content: center; }
.tab-item { padding: 1rem 2.5rem; border: none; background: var(--white); color: var(--text-main); font-weight: 800; font-size: 0.9rem; cursor: pointer; border-radius: 3rem; transition: 0.3s; text-transform: uppercase; }
.tab-item.active { background: var(--brand-dark); color: var(--white); }

.mode-pane { display: none; animation: fadeIn 0.4s ease; }
.mode-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* НОВАЯ ШИРОКАЯ СЕТКА ВВОДА */
.manual-layout-wide { display: flex; flex-direction: column; gap: 1.5rem; }
.editor-section { width: 100%; }

.modern-input { width: 100%; padding: 1rem 0; border: 1px var(--brand-dark); border-bottom: 2px dashed var(--brand-dark); font-size: 1.2rem; outline: none; margin-bottom: 1.5rem; color: var(--brand-dark); font-weight: 600; background: transparent; }
.modern-input:focus { border-bottom-color: var(--magenta); }

/* НАДЕЖНОЕ ПОЛЕ ВВОДА */
.modern-textarea { 
    width: 100%; min-height: 220px; padding: 1.5rem; 
    border: 2px solid var(--white); border-radius: 8px; 
    font-size: 1.1rem; line-height: 1.6; 
    background: var(--bg-light); color: #111; outline: none; resize: vertical; 
}
.modern-textarea:focus { border-color: var(--brand-dark); background: var(--white); }

/* БЛОК ПРЕДПРОСМОТРА ОШИБОК */
.error-preview-box {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 1.5rem;
    display: none; /* Покажется через JS */
}
/* Универсальный стиль блока сообщения (как для ошибок, так и для варнингов) */
.synthesis-status-msg {
    padding: 1.2rem 1.5rem;
    border-radius: 4px 8px 8px 4px;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.synthesis-status-msg:last-child { margin-bottom: 0; }

/* Блок ОШИБКИ (Красный) */
.synthesis-status-msg.is-error {
    background: var(--bg-error);
    border-left: 4px solid var(--color-error);
}

/* Блок ПРЕДУПРЕЖДЕНИЯ (Янтарный/Оранжевый) */
.synthesis-status-msg.is-warning {
    background: #fff9f0; /* Светлый теплый фон */
    border-left: 4px solid #f59e0b; /* Цвет Amber 500 */
}

.msg-header {
    display: block;
    margin-bottom: 10px;
    font-weight: 800;
    font-size: 1.05rem;
}

.is-error .msg-header { color: var(--color-error); }
.is-warning .msg-header { color: #b45309; }

/* Настройка списков внутри варнингов */
.is-warning .error-list { color: #92400e; }
.is-warning .error-item::before { color: #f59e0b; }

.error-preview-content {
    font-size: 1rem; 
    line-height: 1.6; 
    color: var(--brand-dark);
}

.error-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.error-item::before {
    content: "•";
    color: var(--color-error);
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
}

/* Стили для кнопки (показать) */
.show-error-btn {
    color: var(--magenta);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.show-error-btn:hover {
    color: var(--brand-dark);
}

/* ПАРАМЕТРЫ СИНТЕЗА ПОД РЕДАКТОРОМ */
.options-section-row { display: flex; flex-direction: column; gap: 1.5rem; background: var(--bg-light); padding: 1.5rem 2rem; border-radius: 8px; border: 1px solid var(--white); margin-top: 1rem; }
.options-label { font-weight: 800; color: var(--brand-dark); font-size: 1rem; margin-right: 1.5rem; }
.radio-group-horizontal { display: flex; align-items: center; flex-wrap: wrap; }
.custom-radio { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 1rem; font-weight: 600; color: var(--text-main); margin-right: 2rem; }

.vector-picker-horizontal { display: flex; align-items: center; padding-top: 1.5rem; border-top: 1px dashed #ddd; animation: fadeIn 0.3s ease; flex-wrap: wrap;}
.v-grid-horizontal { display: flex; gap: 1rem; flex-wrap: wrap; }
.vector-item { padding: 0.6rem 1.2rem; border: 1px solid var(--border-dark); border-radius: 6px; cursor: pointer; font-size: 0.9rem; background: var(--white); transition: 0.2s; }
.vector-item:hover { border-color: var(--magenta); }
.vector-item.selected { background: var(--brand-dark); color: var(--white); border-color: var(--brand-dark); }
.vector-item strong { margin-right: 5px; font-size: 0.95rem; }

/* ВАЛИДАЦИЯ И КНОПКА */
.validation-row { display: flex; justify-content: space-between; align-items: center; margin-top: 2.5rem; flex-wrap: wrap; gap: 1rem; }
.pill-group { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.action-group { display: flex; gap: 1.5rem; align-items: center; margin-left: auto; }

.v-pill { padding: 0.6rem 1.2rem; background: #f0f0f0; border-radius: 2rem; font-size: 0.85rem; font-weight: 800; color: var(--white); transition: 0.3s; border: 1px solid transparent; }
.v-pill.valid { background: var(--bg-success); color: var(--color-success); border-color: var(--color-success); }
.v-pill.invalid { background: var(--bg-error); color: var(--color-error); border-color: var(--color-error); }

.price-display { font-size: 1.6rem; font-weight: 900; color: var(--brand-dark); }

/* --- КНОПКИ И ПЛАШКА ВЫБРАННОГО ВЕКТОРА --- */
.action-btn.btn-outline { background: var(--white); border: 2px solid var(--brand-dark); color: var(--brand-dark); padding: 0.8rem 1.5rem; border-radius: 8px; font-weight: 800; cursor: pointer; transition: 0.2s; }
.action-btn.btn-outline:hover { background: var(--brand-dark); color: var(--white); }

.selected-vector-card { display: flex; align-items: center; justify-content: space-between; background: #fef5ff; border: 2px solid var(--magenta); padding: 1rem 1.5rem; border-radius: 8px; width: 100%; max-width: 400px; animation: fadeIn 0.3s ease; }
.svd-info strong { display: block; font-size: 1.1rem; color: var(--brand-dark); margin-bottom: 4px; }
.svd-info span { font-size: 0.85rem; color: var(--text-main); font-weight: 600; }
.action-btn.btn-text { background: transparent; border: none; color: var(--magenta); font-weight: 800; cursor: pointer; text-decoration: underline; }

/* --- МОДАЛЬНОЕ ОКНО (COMMAND PALETTE) --- */
.cf-modal-overlay { position: fixed; inset: 0; background: var(--shadow-lg); background-color: var(--overlay-bg); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: 0.3s; }
.cf-modal-overlay.active { opacity: 1; visibility: visible; }
.cf-modal-content { background: var(--white); width: 100%; max-width: 600px; border-radius: 16px; box-shadow: var(--shadow-lg); transform: translateY(20px); transition: 0.3s; overflow: hidden; display: flex; flex-direction: column; max-height: 85vh; }
.cf-modal-overlay.active .cf-modal-content { transform: translateY(0); }

.cf-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; border-bottom: 1px solid var(--white); background: #f9fbfd; }
.cf-modal-header h3 { margin: 0; font-size: 1.3rem; }
.close-modal-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); transition: 0.2s; }
.close-modal-btn:hover { color: var(--color-error); transform: scale(1.1); }

.cf-modal-body { padding: 2rem; overflow-y: auto; }
.cf-modal-body .modern-input { margin-bottom: 1.5rem; padding: 1rem 1.5rem; border: 2px solid var(--bg-light); border-radius: 8px; }
.cf-modal-body .modern-input:focus { border-color: var(--magenta); }

/* --- ФИЛЬТРЫ --- */
.filter-groups { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.f-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.f-label { font-size: 0.85rem; font-weight: 800; color: var(--white); text-transform: uppercase; width: 130px; }
.f-pill { padding: 0.4rem 1rem; background: var(--white); color: var(--text-main); font-size: 0.85rem; font-weight: 700; border-radius: 2rem; cursor: pointer; transition: 0.2s; border: 2px solid transparent; }
.f-pill:hover { background: var(--light-blue-bg); }
.f-pill.active { background: var(--platinum); color: var(--magenta); border-color: var(--magenta); }

/* --- СПИСОК ВЕКТОРОВ --- */

.empty-cmd { text-align: center; padding: 2rem; color: var(--text-muted); font-style: italic; }

/* --- IN-SILICO ВИЗУАЛИЗАТОР ПЛАЗМИДЫ (ИСПРАВЛЕННЫЙ) --- */
.plasmid-viewer-box {
    margin: 2rem auto; /* Центрируем блок */
    max-width: 600px; /* Ограничиваем максимальную ширину всей плашки */
    background: var(--white); border: 2px solid var(--white); border-radius: 12px;
    padding: 2rem; box-shadow: var(--shadow-sm); 
    animation: fadeIn 0.4s ease;
}

.pv-body { 
    display: flex; gap: 2rem; align-items: center; justify-content: flex-start; 
}

/* ЖЕСТКО ФИКСИРУЕМ РАЗМЕР SVG */
.pv-svg-container { 
    width: 150px !important; 
    height: 150px !important; 
    flex-shrink: 0; /* Запрещаем сжиматься или растягиваться */
}

/* --- МОБИЛЬНАЯ АДАПТИВНОСТЬ (Добавь в конец файла) --- */
@media (max-width: 768px) {
    .benefits-grid { grid-template-columns: 1fr; }
    .order-box { padding: 1.5rem; }
    .mode-tabs { flex-direction: column; gap: 0.5rem; }
    .tab-item { width: 100%; text-align: center; }
    
    .radio-group-horizontal { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .custom-radio { margin-right: 0; }
    
    .validation-row { flex-direction: column; align-items: stretch; gap: 1.5rem; }
    .action-group { flex-direction: column; width: 100%; }
    .add-gene-btn { width: 100%; }
    
    /* Перестраиваем плазмиду на мобилках друг под друга */
    .pv-body { flex-direction: column; align-items: center; text-align: center; }
    .pv-stats { align-items: center; }
    /* Более тонкие и аккуратные кнопки на мобилках */
    .cta-order-btn,
    .add-gene-btn {
        padding: 0.8rem 1.5rem !important; /* Уменьшили толщину с 1.2rem до 0.8rem */
        font-size: 1rem !important; /* Немного уменьшили шрифт */
        line-height: 1.4 !important;
        width: 100%; /* Оставляем на всю ширину */
        box-sizing: border-box;
    }
    #pv-open-map-btn {display: none !important;}
}
/* === МОДАЛКА ВЕКТОРОВ (КРАСИВЫЕ КАРТОЧКИ) === */
.cmd-list {
    padding-top: 1.5rem; 
    display: flex;
    flex-direction: column;
    gap: 12px; /* Воздух между карточками */
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px; /* Отступ для скроллбара */
}

/* Кастомный скроллбар для списка */
.cmd-list::-webkit-scrollbar { width: 6px; }
.cmd-list::-webkit-scrollbar-track { background: var(--bg-light); border-radius: 10px; }
.cmd-list::-webkit-scrollbar-thumb { background: var(--white); border-radius: 10px; }
.cmd-list::-webkit-scrollbar-thumb:hover { background: var(--white); }

/* Сама карточка вектора */
.v-list-item {
    background: var(--white);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.v-list-item:hover {
    border-color: var(--magenta);
    box-shadow: var(--shadow-magenta-glow);
    transform: translateY(-2px);
}

/* Внутренности карточки */
.v-list-info {
    flex: 1;
    padding-right: 15px;
}
.v-list-name {
    font-weight: 800;
    color: var(--brand-dark);
    font-size: 1.1rem;
    word-break: break-word; /* Защита от горизонтального скролла */
}
.v-list-meta {
    font-size: 0.85rem;
    color: var(--text-main);
    margin-top: 6px;
}
.v-list-tag {
    flex-shrink: 0;
    background: var(--magenta-light-bg);
    border: 1px solid var(--magenta-light-border);
    color: var(--magenta);
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    text-align: center;
    min-width: 70px;
}

/* --- Стили выбора вектора --- */
.tabs-container {
    display: flex;
    /* justify-content: flex-start гарантирует, что все таблетки прижаты влево */
    justify-content: flex-start; 
    /* Фиксированное одинаковое расстояние между всеми элементами */
    gap: 10px; 
    padding: 8px 0;
    border-bottom: 1px solid var(--light-blue-bg);
    overflow-x: auto;
    scrollbar-width: none;
}

/* Находим кнопку "Другие" и убираем автоматический отступ, если он там был */
#toggle-tabs-dropdown {
    margin-left: 0 !important; 
}
.tabs-container::-webkit-scrollbar {
    display: none; /* Скрывает скроллбар в Chrome/Safari */
}

.v-tab {
    flex: 0 0 auto;
    padding: 5px 12px; /* Уменьшили внутренние отступы */
    border-radius: 16px;
    border: 1px solid var(--border-light-blue);
    background: var(--bg-light);
    color: var(--text-main);
    font-size: 0.78rem; /* Уменьшили шрифт для эстетики */
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}

.v-tab.active {
    background: var(--magenta);
    color: var(--white);
    border-color: var(--magenta);
}
/* 3. ФИКСИРОВАННЫЙ СПИСОК ВЕКТОРОВ */
#cmd-vector-list {
    height: 380px; /* Жесткая высота под ~4 вектора */
    overflow-y: auto;
    padding: 10px 5px 10px 0;
    display: flex;
    flex-direction: column;
    /* Убираем прыжки при появлении скролла */
    scrollbar-gutter: stable; 
}
/* Стильный скроллбар для списка, чтобы не был дефолтно-серым */
#cmd-vector-list::-webkit-scrollbar {
    width: 6px;
}
#cmd-vector-list::-webkit-scrollbar-thumb {
    background: var(--light-blue-bg);
    border-radius: 10px;
}
#cmd-vector-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-light-blue);
}
/* --- Стили модалки карты --- */
.map-footer-label {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 50%; /* Центровка под круговой плазмидой */
    text-align: center;
    pointer-events: none;
    z-index: 999;
}

.map-footer-title {
    font-weight: 700;
    color: var(--brand-dark);
    font-size: 1.1rem;
    line-height: 1.2;
    margin-bottom: 2px;
}

.map-footer-meta {
    font-size: 0.85rem;
    color: #64748b;
}

/* css/synthesis.css */

/* Обертка для позиционирования выпадающего списка */
.vector-tabs-wrapper {
    position: relative;
    width: 100%;
}

/* Контейнер выпадающего списка */
.tabs-dropdown {
    display: none; /* Скрыт по умолчанию */
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--light-blue-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 240px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

/* Класс-триггер для показа списка */
.tabs-dropdown.active {
    display: block;
}

/* Кнопки внутри выпадающего списка */
.dropdown-tab-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    color: var(--brand-dark);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-tab-btn:hover {
    background: var(--bg-light);
}

.dropdown-tab-btn.active {
    color: var(--magenta);
    font-weight: 700;
    background: var(--magenta-light-bg);
}

.dropdown-tab-btn span {
    opacity: 0.5;
    font-size: 0.8em;
}

/* --- МОБИЛЬНАЯ ОПТИМИЗАЦИЯ (до 768px) --- */
@media (max-width: 768px) {
    /* Модалка на весь экран */
    .cf-modal-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        border-radius: 0 !important;
    }

    /* На мобильных SeqViz часто перестраивается, подпись лучше поднять выше */
    .map-footer-label {
        width: 100%; /* На мобилках карта часто занимает всю ширину */
        bottom: 80px; /* Выше, чтобы не перекрывать системные кнопки */
    }

    .v-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    /* Увеличиваем область нажатия для ферментов */
    .fav-enzyme-pill {
        padding: 10px 18px !important;
        font-size: 1rem !important;
    }

    .cf-modal-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
}
/* Стили для кнопок-фильтров (таблеток) */
.f-pill:hover { background: var(--light-blue-bg) !important; }
.f-pill.active { background: var(--magenta) !important; color: var(--white) !important; }
/* === TOAST NOTIFICATIONS === */
.cf-toast {
    background: var(--white);
    border-left: 5px solid var(--magenta);
    box-shadow: var(--shadow-lg);
    padding: 15px 20px;
    border-radius: 8px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cf-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.cf-toast-title {
    font-weight: 800;
    color: var(--brand-dark);
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cf-toast-body {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
}

.cf-toast-close {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
}
.cf-toast-close:hover { color: var(--text-main); }

.cf-toast.success { border-color: var(--color-success); }
.cf-toast.success .cf-toast-title { color: var(--color-success); }