/* calculator.css */

/* ======================================== */
/* == 1. ОБЩИЙ СТИЛЬ СТРАНИЦЫ            == */
/* ======================================== */
body {
    background-color: #f4f8fb;
}

.calculator-wrapper {

    padding-bottom: 60px;
    transition: all 0.3s ease-in-out;
}

.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 40px 50px 40px;
    background-color: #ffffff;
    border-radius: 24px;
    box-shadow: 0 15px 45px rgba(62, 95, 133, 0.12);
    border: 1px solid #eaf0f6;
}

/* ======================================== */
/* == 2. ЗАГОЛОВОК И ПОИСК               == */
/* ======================================== */
.calculator-header h1 {
    font-size: 38px;
    font-weight: 700;
    color: #345E8D;
    margin-bottom: 8px;
    text-align: center;
}

.calculator-header p {
    font-size: 18px;
    color: #5A7B9A;
    text-align: center;
    margin-bottom: 40px;
}

.calculator-search-wrapper {
    margin-bottom: 40px;
    position: relative;
}

#calculatorSearchInput {
    width: 100%;
    padding: 16px 25px 16px 55px;
    font-size: 18px;
    color: #3E5F85;
    background-color: #f8fafc;
    border: 1px solid #eaf0f6;
    border-radius: 100px;
    box-shadow: 0 4px 15px rgba(62, 95, 133, 0.05);
    transition: all 0.3s ease;
}

#calculatorSearchInput::placeholder {
    color: #9FB3C8;
}

#calculatorSearchInput:focus {
    outline: none;
    border-color: #68A1D6;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(104, 161, 214, 0.2);
}

.calculator-search-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239FB3C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.8;
    pointer-events: none;
}

#search-results-container {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid #eaf0f6;
}

#search-results-container .result-item {
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
}
#search-results-container .result-item:hover {
    background-color: #e6eff8;
    border-color: #d0e0f0;
}
#search-results-container .result-item strong {
    font-size: 16px;
    font-weight: 600;
    color: #345E8D;
}
#search-results-container .result-item span {
    display: block;
    font-size: 13px;
    color: #5A7B9A;
    margin-top: 2px;
}

/* ======================================== */
/* == 3. СЕТКА ВЫБОРА КОМПОНЕНТОВ        == */
/* ======================================== */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.selection-column {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 25px;
    border: 1px solid #eaf0f6;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s, transform 0.3s;
}

.selection-column:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(62, 95, 133, 0.08);
}

.selection-column h3 {
    font-size: 20px;
    font-weight: 600;
    color: #4A6A8A;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0eaf3;
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-column .step-number {
    background-color: #68A1D6;
    color: white;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.selection-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    transition: max-height 0.5s ease-in-out;
}

/* --- ИЗМЕНЕНИЯ ЗДЕСЬ --- */
/* Убираем overflow у родительских списков, он не нужен */
#order-therapy-list, #order-category-list {
    overflow: visible;
}

/* Применяем ограничение высоты и стили ТОЛЬКО к списку молекул */
#order-molecule-list {
    /*
     * Расчет высоты для 7 элементов:
     * Высота одного <li> примерно 52-54px (padding + margin + font-size).
     * 7 * 54.4px = ~381px. Устанавливаем это значение.
     */
    max-height: 381px;
    overflow: hidden; /* Скрываем все, что не помещается */
    padding-right: 5px;
    position: relative; /* Нужно для градиента */
    -webkit-mask-image: linear-gradient(to bottom, black 95%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 95%, transparent 100%);
}

/* Когда кнопка "Показать все" нажата, класс .expanded снимает все ограничения */
#order-molecule-list.expanded {
    max-height: 2000px; /* Достаточно большое значение для всех элементов */
    -webkit-mask-image: none;
    mask-image: none;
}

/* Скрываем градиент и кнопку, если элементов 7 или меньше */
#order-molecule-list:not(.has-more) + .show-all-btn {
    display: none;
}
#order-molecule-list:not(.has-more) {
    -webkit-mask-image: none;
    mask-image: none;
    max-height: none; /* Убираем ограничение по высоте, если элементов мало */
}


.selection-column li {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #3E5F85;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    border: 1px solid #eaf0f6;
}



.selection-column li:hover {
    background-color: #e6eff8;
    border-color: #d0e0f0;
    transform: translateX(3px);
}

.selection-column li.selected {
    background-color: #68A1D6;
    color: #fff;
    font-weight: 600;
    border-color: #68A1D6;
    box-shadow: 0 4px 12px rgba(104, 161, 214, 0.2);
    transform: translateX(3px) scale(1.02);
}

.show-all-btn {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #5A7B9A;
    background-color: #eaf0f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.show-all-btn:hover {
    background-color: #dce6f0;
}


/* ======================================== */
/* == 4. СЕКЦИЯ НАСТРОЙКИ И РАСЧЕТА      == */
/* ======================================== */
#configuration-section {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid #eaf0f6;
}

#configuration-section h2 {
    text-align: center;
    font-size: 28px;
    color: #345E8D;
    margin-bottom: 30px;
}

#config-placeholder {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed #d0e0f0;
    border-radius: 12px;
}

#config-placeholder p {
    font-size: 18px;
    color: #5A7B9A;
    margin: 0;
}

#orderDosageContainer .dosage-item {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #eaf0f6;
    box-shadow: 0 5px 15px rgba(62, 95, 133, 0.05);
}

#orderDosageContainer .dosage-title,
#orderDosageContainer .dosage-header strong,
#orderDosageContainer .dosage-header h4 {
    color: #3E5F85 !important;
}

#orderDosageContainer .remove-molecule {
    color: #A0AEC0;
}
#orderDosageContainer .remove-molecule:hover {
    color: #EF4444;
}

.dosage-range {
    --track-fill-color: #68A1D6;
    --track-bg-color: #e0eaf3;
    --thumb-color: #345E8D;
}

.dose-result {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: #345E8D;
    background-color: #e6eff8;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}
.dose-error {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #D32F2F;
    background-color: #FFEBEE;
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
}

.btn-add-to-cart {
    display: block;
    width: 100%;
    max-width: 450px;
    margin: 40px auto 0;
    padding: 15px;
    font-size: 18px;
    font-weight: 700;
    background: #4680B6;
    color: white;
    border-radius: 100px;

}

.btn-add-to-cart:hover {
    transform: translateY(-2px);

}
.btn-add-to-cart:disabled {
    background: #BDBDBD !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

/* ======================================== */
/* == 5. АДАПТИВНОСТЬ                      == */
/* ======================================== */
@media (max-width: 991px) {
    .calculator-container {
        padding: 20px;
    }
    .selection-grid {
        grid-template-columns: 1fr;
    }
    .selection-column {
        padding: 20px;
    }
}

@media (max-width: 767px) {

    .calculator-header h1 {
        font-size: 28px;
    }
    .calculator-header p {
        font-size: 16px;
    }
    .selection-column h3 {
        font-size: 18px;
    }
    #configuration-section h2 {
        font-size: 24px;
    }
    .dose-result {
        font-size: 18px;
    }
    .btn-add-to-cart {
        font-size: 16px;
        padding: 12px;
    }
}


/* calculator.css */

/* === НАЧАЛО: НОВЫЕ СТИЛИ ДЛЯ КНОПКИ "ДОБАВИТЬ МОЛЕКУЛЫ" === */

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Для мобильных устройств */
    gap: 15px;
}

.config-header h2 {
    margin: 0;
}

.add-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #e9f3fb;
    color: #4a7aa7;
    border: 1px solid #d0e0f0;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.add-more-btn svg {
    width: 16px;
    height: 16px;
}

.add-more-btn:hover {
    background-color: #d6e8f8;
    border-color: #b8cde0;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.07);
}

/* === КОНЕЦ: НОВЫЕ СТИЛИ === */


/* НАЧАЛО: Добавьте этот блок в конец файла */

/* === 4.1 ДЛИТЕЛЬНОСТЬ КУРСА (НОВЫЕ СТИЛИ) === */

#days-selection-container {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    margin-top: 15px;
    border: 1px solid #eaf0f6;
    box-shadow: 0 5px 15px rgba(62, 95, 133, 0.05);
}

#days-selection-container h4 {
    font-size: 18px;
    font-weight: 600;
    color: #4A6A8A;
    margin-bottom: 20px;
}

/* Сетка для кнопок выбора дней */
.days-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

/* Стили для самих кнопок */
.day-option-btn {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    background-color: #f0f4f8;
    color: #4A6A8A;
    border: 1px solid #dce6f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.day-option-btn:hover {
    background-color: #e6eff8;
    border-color: #d0e0f0;
    transform: translateY(-2px);
}

/* Стиль для ВЫБРАННОЙ кнопки */
.day-option-btn.selected {
    background-color: #68A1D6;
    color: #fff;
    border-color: #68A1D6;
    box-shadow: 0 4px 10px rgba(104, 161, 214, 0.3);
    transform: translateY(-2px);
}

/* Отдельный стиль для кнопки "Другое кол-во" */
.day-option-btn.individual-btn {
    background-color: #eaf0f6;
}
.day-option-btn.individual-btn.selected {
    background-color: #5a8dbb; 
    color: #fff;
    border-color: #5a8dbb;
}


#custom-day-input-wrapper {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0eaf3;
}

#custom-day-input-wrapper .dosage-title {
    color: #4A6A8A;
    margin-bottom: 15px;
}

#therapyDays.dosage-number {
    width: 80px; 
    text-align: center;
    background-color: #f8fafc;
    border: 1px solid #eaf0f6;
    color: #3E5F85;
}

/* КОНЕЦ: Добавьте этот блок в конец файла */




/* ===================================================================== */
/* == ИСПРАВЛЕНИЕ: Возвращаем структуру полей дозировки              == */
/* ===================================================================== */

/* Заставляем заголовок ("Выберите...") и подсказку ("от 0 до 20 мг")
   занимать каждый свою отдельную строку. */
#orderDosageContainer .dosage-item .dosage-title,
#orderDosageContainer .dosage-item .dosage-range-hint {
    display: block;
}

/* Добавляем отступы, чтобы всё выглядело как на вашем оригинальном скриншоте. */
#orderDosageContainer .dosage-item .dosage-title {
    margin-bottom: 4px; /* Небольшой отступ под "Выберите суточную дозировку:" */
}

#orderDosageContainer .dosage-item .dosage-range-hint {
    margin-bottom: 15px; /* Отступ побольше под подсказкой (от 0 до 20 мг) */
    font-size: 18px;     /* Сделаем шрифт подсказки чуть меньше для иерархии */
    color: #5A7B9A;      /* Цвет как у других подписей */
    font-style: normal !important; /* Убираем курсив, если он был унаследован */
}

/* Выравниваем заголовок с названием молекулы и кнопку удаления по центру */
#orderDosageContainer .dosage-header {
    align-items: center;
}


/* ===================================================================== */
/* == ИСПРАВЛЕНИЕ v3: ТОЧНЫЕ РАЗМЕРЫ И СТИЛИ ШРИФТОВ ДЛЯ ДОЗИРОВОК == */
/* ===================================================================== */

/* 1. Название молекулы (самое крупное и жирное, как "L-глутатион") */
#orderDosageContainer .dosage-header h4.dosage-title {
    color: #345E8D ;
    font-size: 28px ;
    font-weight: 700 ;
}

/* 2. Инструкция "Выберите суточную дозировку:" (средний размер) */
#orderDosageContainer .dosage-item > label.dosage-title {
    display: block;
    color: #3E5F85 ;
    font-size: 22px ;
    font-weight: 500 ;
    margin-bottom: 4px;
}

/* 3. Подсказка "(от 0 до 20 мг)" (самая маленькая) */
#orderDosageContainer .dosage-range-hint {
    display: block;
    color: #5A7B9A ;
    font-size: 18px ;
    font-weight: 400 ; /* Обычная жирность */
    font-style: normal;
    margin-bottom: 15px;
}

/* 4. Заголовки в новом блоке выбора дней (для консистентности) */
#days-selection-container .dosage-title {
     color: #4A6A8A ;
     font-size: 20px ;
     font-weight: 600 ;
}



@media (max-width: 768px) {
    #orderDosageContainer .dosage-header h4.dosage-title {
        font-size: 22px;
     }
     #orderDosageContainer .dosage-item > label.dosage-title {
        font-size: 20px;
     }
     #orderDosageContainer .dosage-range-hint { {
        font-size: 16px;
     }
     #days-selection-container .dosage-title {
        font-size: 18px;
     }
}


@media (max-width: 360px) {
    #orderDosageContainer .dosage-header h4.dosage-title {
        font-size: 16px;
     }
     #orderDosageContainer .dosage-item > label.dosage-title {
        font-size: 17px;
     }
     #orderDosageContainer .dosage-range-hint { {
        font-size: 12px;
     }
     #days-selection-container .dosage-title {
        font-size: 15px;
     }
}