/* ==================== ОСНОВНЫЕ СТИЛИ КАЛЬКУЛЯТОРА ==================== */
.calc-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* ==================== ВЫБОР ДВИГАТЕЛЯ ==================== */
.engine-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.engine-card {
    background: rgba(255,255,255,0.3);
    border: 2px solid var(--dark-blue);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    font-weight: bold;
}
.engine-card:hover {
    background: var(--dark-blue);
    color: white;
}

/* ==================== ФОРМЫ (СВОЙ ДВИГАТЕЛЬ) ==================== */
.param-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.form-group {
    margin-bottom: 15px;
    flex: 1;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 13px;
}
.form-group label {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}
.form-group select, .form-group input {
    font-size: 18px !important;
    padding: 12px !important;
    height: 50px !important;
}
.form-group h3 {
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 18px;
}
.form-group input {
    margin-bottom: 5px;
}
.form-group input.has-value {
    border-color: #27ae60 !important;
    background-color: #e8f8f0 !important;
}
.form-group input.error-empty {
    border-color: #f39c12 !important;
    background-color: #fff3e0 !important;
}
.form-group input.error {
    border-color: #e74c3c !important;
    background-color: #ffe6e6 !important;
}
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}
.field-hint {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}
.global-hint {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #e67e22;
    margin: 15px 0 10px 0;
    padding: 8px;
    background: rgba(230, 126, 34, 0.1);
    border-radius: 8px;
}

/* ==================== ЭКРАН ЗАМЕРОВ ==================== */
.valve-card {
    background: rgba(255,255,255,0.4);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid;
}
.cyl-header {
    background: rgba(70, 130, 180, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0 10px 0;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tolerance-info {
    background: rgba(52,152,219,0.15);
    border-left: 4px solid #3498db;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
}
.shim-suggestion {
    margin-top: 12px;
    font-size: 14px;
    background: rgba(0,0,0,0.05);
    padding: 8px 10px;
    border-radius: 8px;
}
.shim-link {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    background: #2c3e50;
    color: white;
    font-weight: normal;
}
.shim-link.ideal { background: #2ecc71; }
.shim-link.near  { background: #27ae60; }
.shim-link.far   { background: #f1c40f; }
.shim-link.out-of-stock {
    background: #bdc3c7 !important;
    cursor: default;
    pointer-events: none;
}
.shim-link.in-cart {
    background: #95a5a6;
    cursor: pointer;
}

/* ==================== КНОПКИ НАВИГАЦИИ (ОБЩИЕ) ==================== */
.btn-back {
    background: #95a5a6;
    margin-top: 15px;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}
.btn-back-top {
    background: #95a5a6;
    margin-bottom: 15px;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    width: auto;
    display: inline-block;
}

/* ==================== ВЕРХНИЙ ТУЛБАР (sticky, центрирование по половинкам) ==================== */
.measure-toolbar {
    position: sticky;
    top: 10px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 48px;
    padding: 6px 0;
    margin: 0 0 15px 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.toolbar-left, .toolbar-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
    white-space: nowrap;
}
.toolbar-btn:hover {
    background: rgba(44, 62, 80, 0.1);
    transform: scale(1.02);
}
.toolbar-btn svg {
    width: 20px;
    height: 20px;
    stroke: #2c3e50;
    stroke-width: 1.8;
    fill: none;
}
.toolbar-btn svg:hover {
    stroke: #1a252f;
}

/* Скрываем старые фиксированные кнопки, если они ещё где-то есть */
.sticky-btn, .left-btn, .right-btn {
    display: none !important;
}

/* Отступ для заголовка калькулятора */
.calc-container h1 {
    margin-top: 20px;
}

/* ==================== МОДАЛЬНОЕ ОКНО ПЕЧАТИ ==================== */
.print-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.print-modal-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.print-modal h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}
.print-format-buttons {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}
.print-format-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #2c3e50;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.print-format-btn:hover {
    background: #2c3e50;
    color: white;
}
.print-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.print-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

/* ==================== АДАПТИВНОСТЬ (МОБИЛЬНЫЕ) ==================== */
@media (max-width: 768px) {
    .param-row {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 10px;
    }
    .param-row .form-group {
        flex: 1;
        min-width: 120px;
    }
    .param-row .form-group select,
    .param-row .form-group input {
        font-size: 16px !important;
        padding: 10px !important;
        height: 45px !important;
    }
    .form-group label {
        font-size: 14px !important;
    }
    .engine-selector {
        grid-template-columns: 1fr;
    }
    .measure-toolbar {
        top: 5px;
        padding: 4px 0;
    }
    .toolbar-btn {
        padding: 4px 10px;
        font-size: 13px;
    }
    .toolbar-btn svg {
        width: 18px;
        height: 18px;
    }
}
@media (max-width: 768px) {
    #engineModel {
        width: 100% !important;
        font-size: 14px !important;
        padding: 10px !important;
    }
}

/* ===================================================== */
/* ТОЛЬКО для экрана создания своего двигателя (десктоп)  */
/* ===================================================== */
@media (min-width: 769px) {
    /* Сужаем и центрируем всю форму */
    #customScreen {
        max-width: 33%;
        margin-left: auto;
        margin-right: auto;
    }
    /* Возвращаем горизонтальное расположение полей впуск/выпуск */
    #customScreen .param-row {
        flex-direction: row !important;
        gap: 20px;
    }
    #customScreen .param-row .form-group {
        flex: 1;
    }
    /* Обеспечиваем вертикальное расположение трёх полей внутри впуска/выпуска */
    #customScreen .input-group {
        flex-direction: column;
    }
}

/* На мобильных – без изменений (оставляем как есть) */
@media (max-width: 768px) {
    #customScreen {
        max-width: 75%;
        margin-left: auto;
        margin-right: auto;
    }
    #customScreen .param-row {
        flex-direction: column !important; /* или оставить row с переносом – как было по умолчанию */
    }
}
/* ==================== СТИЛИ КНОПОК КАЛЬКУЛЯТОРА ==================== */
.buy-btn {
    width: 100%;
    padding: 14px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 10px;
}
.buy-btn:hover {
    opacity: 0.9;
    transform: scale(0.98);
}
.btn-back {
    background: #95a5a6 !important;
}
.btn-back:hover {
    background: #7f8c8d !important;
}
/* На десктопе – ширина 50% от контейнера, но не более 800px, центрирование */
@media (min-width: 769px) {
    #engineScreen {
        max-width: 33%;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    .engine-selector {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    .engine-card {
        width: 100% !important;
    }
}
/* На мобильных: ширина 75% от контейнера, центрирование */
@media (max-width: 768px) {
    #engineScreen {
        max-width: 75%;
        margin-left: auto;
        margin-right: auto;
    }
}