.ml-calc-wrapper {
    background: #ffffff;
    padding: 40px;
    margin: 30px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ml-calc-title {
    color: var(--ml-calc-primary, #4169E1);
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ml-calc-note {
    color: var(--ml-calc-primary, #4169E1);
    font-weight: bold;
}

.ml-calc-container {
    max-width: 1200px;
    margin: 0 auto;
}

.ml-calc-row {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.ml-calc-field {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.7);
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(65, 105, 225, 0.1);
}

.ml-calc-field:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: rgba(65, 105, 225, 0.2);
}

.ml-calc-field label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.ml-calc-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--ml-calc-primary, #4169E1);
    margin-bottom: 12px;
    text-align: center;
}

.ml-calc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 8px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

.ml-calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ml-calc-primary, #4169E1);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-top: -8px; /* center thumb on the track */
}

.ml-calc-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: #ddd;
    border-radius: 8px;
}

.ml-calc-slider::-moz-range-track {
    height: 8px;
    background: #ddd;
    border-radius: 8px;
}

.ml-calc-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ml-calc-primary, #4169E1);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.ml-calc-slider::-ms-track {
    height: 8px;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

.ml-calc-slider::-ms-fill-lower,
.ml-calc-slider::-ms-fill-upper {
    height: 8px;
    background: #ddd;
    border-radius: 8px;
}

.ml-calc-slider::-ms-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ml-calc-primary, #4169E1);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-top: 0;
}

@supports (-webkit-touch-callout: none) {
    .ml-calc-slider {
        height: 8px;
    }

    .ml-calc-slider::-webkit-slider-thumb {
        margin-top: -8px;
    }
}

.ml-calc-result {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-top: 30px;
    margin-bottom: 30px;
    border: 2px solid var(--ml-calc-primary, #4169E1);
    position: relative;
}

/* Индикатор загрузки */
.ml-calc-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 10;
}

.ml-calc-result--loading .ml-calc-loading-overlay {
    display: flex;
}

.ml-calc-spinner {
    width: 70px;
    height: 70px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid var(--ml-calc-primary, #4169E1);
    border-radius: 50%;
    animation: ml-calc-spin 0.8s linear infinite;
}

@keyframes ml-calc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ml-calc-result__layout {
    display: flex;
    gap: 40px;
    align-items: center;
}

.ml-calc-result__product {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

/* Компактный режим для страниц товаров */
.ml-calc-wrapper--product-page .ml-calc-result__layout {
    gap: 40px;
}

.ml-calc-wrapper--product-page .ml-calc-result__product {
    flex: 0 0 180px;
    gap: 18px;
}

.ml-calc-wrapper--product-page .ml-calc-result__image {
    width: 160px;
    height: 160px;
}

.ml-calc-wrapper--product-page .ml-calc-result__name {
    font-size: 16px;
}

.ml-calc-wrapper--product-page .ml-calc-result__price-regular,
.ml-calc-wrapper--product-page .ml-calc-result__price-current {
    font-size: 18px;
}

.ml-calc-wrapper--product-page .ml-calc-result__price-old {
    font-size: 14px;
}

.ml-calc-result__image {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.ml-calc-result__image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    object-position: center center;
    background: #fff;
}

.ml-calc-result__name {
    font-size: 20px;
    font-weight: 600;
    color: #1e1e1e;
    line-height: 1.4;
    text-align: center;
}

.ml-calc-result__price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.ml-calc-result__price-regular {
    font-size: 24px;
    font-weight: 700;
    color: #777;
    line-height: 1.3;
}

.ml-calc-result__price-old {
    font-size: 16px;
    color: #888;
    text-decoration: line-through;
    line-height: 1.3;
}

.ml-calc-result__price-current {
    font-size: 24px;
    font-weight: 700;
    color: #28a745;
    line-height: 1.3;
}

.ml-calc-result__name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ml-calc-result__name a:hover {
    color: var(--ml-calc-primary, #4169E1);
}

.ml-calc-result__content {
    flex: 1;
    min-width: 260px;
}

.ml-calc-warning {
    background: #fff5d3;
    color: #8a6d3b;
    border: 1px solid #ffe6a7;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.ml-calc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #ddd;
    flex-wrap: nowrap;
    gap: 10px;
}

.ml-calc-result-item:last-child {
    border-bottom: none;
}

.ml-calc-result-label {
    font-size: 18px;
    color: #333;
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
}

.ml-calc-result-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--ml-calc-primary, #4169E1);
    flex: 0 0 auto;
    white-space: nowrap;
}

.ml-calc-result-main {
    font-size: 22px;
}

.ml-calc-breakdown {
    margin-top: 20px;
    padding-top: 15px;
}

.ml-calc-breakdown-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.ml-calc-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    padding: 6px 0;
    border-bottom: 1px dashed #e4e6eb;
}

.ml-calc-breakdown-row:last-child {
    border-bottom: none;
}

.ml-calc-breakdown-label {
    color: #555;
}

.ml-calc-breakdown-value {
    font-weight: 600;
    color: var(--ml-calc-primary, #4169E1);
}

.ml-calc-breakdown-subrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0 4px 12px;
    color: #666;
}

.ml-calc-breakdown-subrow .ml-calc-breakdown-label,
.ml-calc-breakdown-subrow .ml-calc-breakdown-value {
    font-size: 13px;
}

.ml-calc-breakdown-subrow .ml-calc-breakdown-value {
    font-weight: 500;
}

.ml-calc-page__title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
}

.ml-calc-page__selector {
    max-width: 420px;
    margin-bottom: 25px;
}

#ml-calc-module-wrapper.ml-calc-loading {
    position: relative;
}

.ml-calc-shortcode__placeholder {
    min-height: 100px;
    position: relative;
}

.ml-calc-shortcode__loading {
    opacity: 0.6;
}

/* Стилі для шорткоду */
.ml-calc-shortcode {
    margin: 30px 0;
}

.ml-calc-shortcode__title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.ml-calc-shortcode__selector {
    max-width: 450px;
    margin-bottom: 25px;
}

.ml-calc-shortcode__selector label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.ml-calc-shortcode__selector select {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.4;
    height: auto;
    min-height: 42px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}

.ml-calc-shortcode__selector select:focus {
    outline: none;
    border-color: var(--ml-calc-primary, #4169E1);
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
}

.ml-calc-shortcode__selector select option {
    padding: 8px;
    line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 768px) {
    .ml-calc-wrapper {
        padding: 15px;
    }

    .ml-calc-result__layout {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
    }

    .ml-calc-result__product {
        max-width: 100%;
    }

    .ml-calc-result__price {
        justify-content: flex-start;
    }

    .ml-calc-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .ml-calc-subtitle {
        font-size: 14px;
    }

    .ml-calc-row {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }

    .ml-calc-field {
        min-width: 100%;
        padding: 10px 12px;
        margin-bottom: 0;
    }

    .ml-calc-field:hover {
        transform: none;
    }

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

    .ml-calc-value {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .ml-calc-result-label {
        font-size: 11px;
        flex: 1 1 auto;
        min-width: 0;
    }

    .ml-calc-result-value {
        font-size: 15px;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .ml-calc-result-main {
        font-size: 14px;
    }

    .ml-calc-result-item {
        padding: 8px 0;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .ml-calc-result {
        padding: 12px;
    }

    .ml-calc-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }

    .ml-calc-shortcode__selector {
        max-width: 100%;
    }

    .ml-calc-shortcode__title {
        font-size: 20px;
    }

    .ml-calc-shortcode__selector select {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Увеличенные ползунки для мобильных */
    .ml-calc-slider {
        height: 10px;
    }

    .ml-calc-slider::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
        margin-top: -11px;
    }

    .ml-calc-slider::-moz-range-thumb {
        width: 32px;
        height: 32px;
    }

    .ml-calc-slider::-ms-thumb {
        width: 32px;
        height: 32px;
    }

    .ml-calc-slider::-webkit-slider-runnable-track {
        height: 10px;
    }

    .ml-calc-slider::-moz-range-track {
        height: 10px;
    }

    .ml-calc-slider::-ms-track {
        height: 10px;
    }

    .ml-calc-slider::-ms-fill-lower,
    .ml-calc-slider::-ms-fill-upper {
        height: 10px;
    }
}

/* Стили для выделения вкладки калькулятора */
.ml-calc-tab-red a {
    color: #dc3545 !important;
    font-weight: bold;
}

.ml-calc-tab-yellow {
    background-color: #ffc107 !important;
    border-radius: 4px 4px 0 0;
}

.ml-calc-tab-yellow a {
    color: #000 !important;
    font-weight: bold;
}

.ml-calc-tab-new-badge a::after {
    content: 'new';
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background-color: #ffc107;
    color: #000;
    font-size: 0.65em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 3px;
    vertical-align: super;
    line-height: 1;
}

/* Стили для кнопки открытия калькулятора */
.ml-calc-open-button {
    transition: all 0.3s ease;
}

.ml-calc-open-button:hover,
.ml-calc-open-button:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    opacity: 0.9;
}

.ml-calc-open-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ml-calc-open-button i {
    margin-right: 8px;
}

@media (max-width: 991px) {
    #ml-calc-consultation-modal-input,
    #ml-calc-consultation-input,
    #ml-calc-consultation-modal-comment,
    #ml-calc-consultation-comment {
        font-size: 16px !important;
    }
}
