/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: #f0f2f3;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.calculator-container {
    display: flex;
    background-color: #fff;
    /* border-radius: 12px; */
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); */
    width: 100%;
    max-width: 1000px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Стили для формы калькулятора */
.calculator-form {
    flex: 3;
    padding: 40px;
    border-right: 1px solid #eee;
    position: relative;
}

.calculator-form h1 {
    font-size: 26px;
    margin-bottom: 30px;
    color: #333;
    font-weight: 600;
}

.calculator-form h1 i {
    margin-right: 10px;
    color: #01897d;
    font-size: 26px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #999;
    pointer-events: none;
}

select, input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    transition: all 0.3s ease;
}

select:focus, input:focus {
    outline: none;
    border-color: #01897d;
    box-shadow: 0 0 0 3px rgba(1, 137, 125, 0.1);
    transition: all 0.3s ease;
}

/* Стили для контейнера размеров и полей ввода ширины и высоты */
.dimensions-container {
    display: flex;
    gap: 15px;
}

.dimension-field {
    flex: 1;
}

.dimension-field label {
    font-size: 12px;
    margin-bottom: 5px;
}

/* Стили для объединенных полей вида и плотности материала */
.material-properties {
    display: flex;
    gap: 15px;
}

.material-kind-container {
    flex: 2;
}

.material-density-container {
    flex: 1;
}

/* Стили для состояния загрузки */
.calculator-form.loading {
    position: relative;
}

.calculator-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calculator-form.loading select,
.calculator-form.loading input,
.calculator-form.loading button {
    opacity: 0.7;
}

/* Стили для состояния ошибки */
.calculator-form.error select,
.calculator-form.error input,
.calculator-form.error button {
    opacity: 0.5;
    cursor: not-allowed;
}

.calculator-form.error .form-group label {
    color: #888;
}

/* Стили для элементов с текстом "Загрузка..." */
.loading-text {
    color: #888;
    font-style: italic;
}

/* Стили для элементов с текстом "Ошибка загрузки" */
.error-text {
    color: #d9534f;
    font-style: italic;
}

/* Стили для чекбоксов */
.checkbox-group {
    margin-bottom: 15px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: #01897d;
}

.checkbox-wrapper label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 400;
}

/* Стили для кнопок */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 35px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background-color: #01897d;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(1, 137, 125, 0.3);
    padding-left: 18px;
}

.btn-primary:hover {
    background-color: #00796f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(1, 137, 125, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(1, 137, 125, 0.3);
}

/* Стиль для иконки в кнопке */
.btn-primary i {
    padding-right: 6px;
}

/* Стиль для неактивной кнопки */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #e2e6ea;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}





/* Стили для блока результатов */
.calculator-result {
    flex: 2;
    padding: 35px;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

.specialist-info {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.specialist-avatar {
    width: 60px;
    height: 60px;
    border-radius: 20%;
    object-fit: cover;
    margin-right: 15px;
}

.specialist-details h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 5px;
    font-weight: 600;
}

.specialist-details p {
    font-size: 14px;
    color: #666;
}

.specialist-message {
    background-color: white;
    padding: 18px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid #e9ecef;
    position: relative;
}

.specialist-message:after {
    content: '';
    position: absolute;
    top: -10px;
    left: 30px;
    width: 20px;
    height: 20px;
    background-color: white;
    transform: rotate(45deg);
    border-left: 1px solid #e9ecef;
    border-top: 1px solid #e9ecef;
}

.specialist-message p {
    font-size: 14px;
    color: #495057;
    line-height: 1.6;
}

/* Скрыть старый блок с деталями расчета */
.calculation-details {
    display: none;
}

/* Стили для итоговой цены и деталей расчета */
.total-price-container {
    margin-top: auto;
    position: relative;
}

.total-price-container h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
    margin-top: 10px;
}

.total-price {
    font-size: 42px;
    font-weight: 700;
    color: #01897d;
    margin-bottom: 0px;
    transition: all 0.3s ease;
    line-height: 1;
}

.currency {
    font-size: 20px;
    font-weight: normal;
    margin-left: 5px;
}

/* Стили для текстового блока с деталями расчета */
.calculation-summary {
    margin-bottom: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.summary-row {
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row span {
    font-weight: 500;
    color: #333;
    margin-left: 5px;
}

.price-disclaimer {
    font-size: 12px;
    color: #999;
    font-style: italic;
    margin-top: 10px;
}

/* Стили для уведомления о минимальной стоимости заказа */
.price-notification {
    font-size: 14px;
    color: #9e3741;
    font-weight: 500;
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
    animation: fadeIn 0.5s ease;
    border: 1px solid #9e3741;
}

.price-notification.hidden {
    display: none;
}

.price-notification.visible {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Стили для примечания к опции */
.option-note {
    display: block;
    color: #777;
    font-size: 0.8em;
    margin-top: 2px;
    margin-left: 24px;
}

/* Стили для переключателя режима загрузки данных */
.data-source-selector {
    display: none;
}

#reload-data {
    display: none;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .calculator-form {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    /* Поле плотности материала на отдельной строке */
    .material-properties {
        flex-direction: column;
        gap: 15px;
    }
    
    .material-kind-container,
    .material-density-container {
        flex: 1;
        width: 100%;
    }
    
    /* Поля ширины и высоты в одной строке, поле количества на отдельной строке */
    .dimensions-container {
        flex-wrap: wrap;
    }
    
    .dimensions-container .dimension-field:nth-child(1),
    .dimensions-container .dimension-field:nth-child(2) {
        flex: 1;
        min-width: 45%;
    }
    
    .dimensions-container .dimension-field:nth-child(3) {
        flex: 1;
        width: 100%;
        margin-top: 0px;
    }
}

/* Стили для iframe-версии */
body.in-iframe {
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
    overflow: visible !important;
}

body.in-iframe .calculator-container {
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: hidden;
    margin: 0 !important;
    flex-direction: row !important; /* Всегда горизонтальное расположение */
}

body.in-iframe .calculator-form {
    flex: 3;
    border-right: 1px solid #eee;
    border-bottom: none;
}

body.in-iframe .calculator-result {
    flex: 2;
    display: flex !important;
    flex-direction: column;
}

/* Проверка на iframe */
@media screen and (max-width: 1000px) {
    body {
        padding: 10px;
    }
    
    .calculator-container {
        flex-direction: column;
    }
    
    .calculator-form {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
}

/* Адаптация для очень узких экранов */
@media screen and (max-width: 767px) {
    body.in-iframe .calculator-container {
        flex-direction: column !important;
    }
    
    body.in-iframe .calculator-form {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .calculator-form {
        padding: 30px;
    }
    
    .specialist-info, 
    .specialist-message {
        display: none;
    }
}

/* Стили для всплывающей подсказки */
.checkbox-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.tooltip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #495057;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tooltip-icon:hover {
    background-color: #01897d;
}

.tooltip-text {
    visibility: hidden;
    width: 300px;
    background-color: #555;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Стили для многопозиционного заказа */
.order-items-container {
    padding: 30px 40px;
    /* background-color: #f8f9fa; */
    /* border-radius: 12px; */
    /* margin-top: 10px; */
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); */
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.order-items-container h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-items-empty {
    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.order-items-empty p {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
}

.order-item {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.order-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.order-item-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.order-item-price {
    font-size: 22px;
    font-weight: 700;
    color: #01897d;
    padding-right: 40px;
}

.order-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.order-item-detail {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.order-item-remove {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    background-color: #f0f0f0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.order-item-remove:hover {
    background-color: #000;
    color: white;
}

.order-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.order-total-price h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.total-order-price {
    font-size: 32px;
    font-weight: 700;
    color: #01897d;
}

@media (max-width: 768px) {
    /* Изменяем структуру заголовка карточки заказа для мобильной версии */
    .order-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Цена под названием */
    .order-item-title {
        margin-bottom: 8px;
    }
    
    .order-item-price {
        padding-right: 0;
        font-size: 20px;
    }
    
    /* Детали в 2 колонки */
    .order-item-details {
        grid-template-columns: 1fr 1fr;
        gap: 12px 8px;
    }
    
    /* Для опций и других длинных значений - на всю ширину */
    .order-item-detail.full-width {
        grid-column: 1 / -1;
    }
    
    .order-summary {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .order-summary .btn {
        width: 100%;
    }
}
