/**
 * Стили для калькулятора зубофрезерных работ
 * Версия: 1.0 (как у фрезерного/EDM калькулятора)
 * Цветовая схема: #3A566D
 */

/* ========== БАЗОВЫЕ СТИЛИ ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
    background: #fff;
    width: 100%;
    min-width: 320px;
    overflow-x: hidden;
}

/* ========== ОСНОВНОЙ КОНТЕЙНЕР ========== */
.gear-milling-calculator {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.gear-milling-calculator h2 {
    color: #3A566D;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

/* ========== ФОРМЫ ========== */
.gear-milling-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #3A566D;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-icon {
    font-size: 16px;
}

.form-hint {
    color: #666;
    display: block;
    margin-top: 5px;
    font-size: 13px;
}

.form-hint.warning {
    color: #f59e0b;
}

/* ========== ПОЛЯ ВВОДА ========== */
.gear-milling-form select,
.gear-milling-form input[type="number"],
.gear-milling-form input[type="text"],
.gear-milling-form input[type="tel"],
.gear-milling-form input[type="email"],
.gear-milling-form textarea,
.gear-milling-form input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #3A566D;
    border-radius: 6px;
    font-size: 16px;
    background: #FFFFFF;
    color: #333;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: all 0.3s ease;
}

.gear-milling-form select:focus,
.gear-milling-form input:focus,
.gear-milling-form textarea:focus {
    outline: none;
    border-color: #2d4455;
    box-shadow: 0 0 0 3px rgba(58, 86, 109, 0.1);
}

.gear-milling-form select:disabled,
.gear-milling-form input:disabled,
.gear-milling-form textarea:disabled {
    background: #f5f5f5;
    border-color: #ccc;
    cursor: not-allowed;
}

/* ========== СЕТКА РАЗМЕРОВ ========== */
.dimensions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* ========== РАДИО-КНОПКИ (КАРТОЧКИ) ========== */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border: 2px solid #3A566D;
    border-radius: 8px;
    cursor: pointer;
    background: #FFFFFF;
    transition: all 0.3s ease;
}

.radio-label:hover {
    background: #f0f4f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(58, 86, 109, 0.15);
}

.radio-label input[type="radio"] {
    margin: 3px 12px 0 0;
    accent-color: #3A566D;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.radio-label input[type="radio"]:checked + .radio-text strong {
    font-weight: 700;
}

.radio-text {
    flex: 1;
}

.radio-text strong {
    color: #3A566D;
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
}

.radio-text small {
    color: #666;
    font-size: 13px;
    display: block;
    line-height: 1.3;
}

/* ========== ЧЕКБОКСЫ ========== */
.checkbox-label {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid #3A566D;
    border-radius: 6px;
    cursor: pointer;
    background: #FFFFFF;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: #f0f4f8;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    accent-color: #3A566D;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.checkbox-label span {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* ========== КНОПКИ ========== */
.calculate-btn,
.order-btn,
.submit-btn {
    width: 100%;
    padding: 15px 20px;
    background: #3A566D;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.calculate-btn:hover,
.order-btn:hover,
.submit-btn:hover {
    background: #2d4455;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 86, 109, 0.3);
}

.calculate-btn:active,
.order-btn:active,
.submit-btn:active {
    transform: translateY(0);
}

.calculate-btn:disabled,
.order-btn:disabled,
.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.order-btn.secondary {
    background: #6b7280;
}

.order-btn.secondary:hover {
    background: #5a6778;
}

/* ========== РЕЗУЛЬТАТ ========== */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: #f0f4f8;
    border: 2px solid #3A566D;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-box h3 {
    color: #3A566D;
    margin: 0 0 15px 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-display,
.lead-time-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    padding: 15px;
    background: #FFFFFF;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.price-label,
.lead-time-label {
    font-size: 14px;
    color: #6b7280;
}

.price-value {
    font-size: 24px;
    font-weight: bold;
    color: #3A566D;
}

.lead-time-value {
    font-size: 16px;
    font-weight: 600;
    color: #3A566D;
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-actions .order-btn {
    flex: 1;
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal[style*="display: flex"] {
    display: flex !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #FFFFFF;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin: 20px auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #3A566D;
    transition: color 0.3s;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: #2d4455;
    background: #f0f4f8;
}

.modal-content h3 {
    margin: 0 0 25px 0;
    color: #3A566D;
    font-size: 22px;
    padding-right: 40px;
}

.modal-content .form-group {
    margin-bottom: 18px;
    display: block;
}

.modal-content label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #3A566D;
    font-size: 14px;
}

.modal-content input[type="text"],
.modal-content input[type="tel"],
.modal-content input[type="email"],
.modal-content textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #3A566D;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    display: block;
    transition: all 0.3s;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #2d4455;
    box-shadow: 0 0 0 3px rgba(58, 86, 109, 0.1);
}

.modal-content textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-content .checkbox-label {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid #3A566D;
    border-radius: 6px;
    cursor: pointer;
    background: #FFFFFF;
    margin-top: 15px;
    transition: all 0.3s;
}

.modal-content .checkbox-label:hover {
    background: #f0f4f8;
}

.modal-content .checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    accent-color: #3A566D;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.modal-content .checkbox-label span {
    font-size: 14px;
    color: #333;
}

.modal-content .submit-btn {
    width: 100%;
    padding: 15px;
    background: #3A566D;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-content .submit-btn:hover {
    background: #2d4455;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 86, 109, 0.3);
}

/* ========== ПОДВАЛ ========== */
.calc-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.calc-footer p {
    margin: 5px 0;
}

.calc-footer a {
    color: #3A566D;
    text-decoration: none;
    font-weight: 600;
}

.calc-footer a:hover {
    text-decoration: underline;
}

/* ========== МОБИЛЬНАЯ ВЕРСИЯ ========== */
@media (max-width: 600px) {
    .gear-milling-calculator {
        max-width: 100%;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }
    
    .gear-milling-calculator h2 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .gear-milling-form select,
    .gear-milling-form input[type="number"],
    .gear-milling-form input[type="text"],
    .gear-milling-form input[type="tel"],
    .gear-milling-form input[type="email"],
    .gear-milling-form textarea {
        width: 100%;
        font-size: 16px;
        padding: 14px;
    }
    
    .dimensions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .radio-group {
        gap: 10px;
    }
    
    .radio-label {
        padding: 12px;
    }
    
    .radio-text strong {
        font-size: 15px;
    }
    
    .radio-text small {
        font-size: 13px;
    }
    
    .checkbox-label {
        padding: 12px;
    }
    
    .calculate-btn,
    .order-btn,
    .submit-btn {
        padding: 15px;
        font-size: 16px;
        margin: 10px 0;
    }
    
    .result-box {
        padding: 15px;
        margin-top: 20px;
    }
    
    .price-display,
    .lead-time-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }
    
    .price-value {
        font-size: 22px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions .order-btn {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
        margin: 10px auto;
    }
    
    .modal-content h3 {
        font-size: 18px;
        margin-bottom: 15px;
        padding-right: 30px;
    }
    
    .close-modal {
        top: 10px;
        right: 10px;
        font-size: 24px;
    }
    
    .calc-footer {
        margin-top: 20px;
        padding-top: 15px;
        font-size: 13px;
    }
}

/* ========== iOS SAFARI FIXES ========== */
@supports (-webkit-touch-callout: none) {
    .gear-milling-form input[type="number"],
    .gear-milling-form input[type="text"],
    .gear-milling-form input[type="tel"],
    .gear-milling-form input[type="email"],
    .modal-content input[type="text"],
    .modal-content input[type="tel"],
    .modal-content input[type="email"] {
        font-size: 16px !important;
    }
}

/* ========== ANDROID SELECT FIX ========== */
.gear-milling-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233A566D' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* ========== ПЛАВНЫЙ СКРОЛЛ ========== */
html {
    scroll-behavior: smooth;
}

/* ========== БЛОКИРОВКА ПРОКРУТКИ ФОНА ========== */
body.modal-open {
    overflow: hidden;
}

/* ========== ПЕЧАТЬ ========== */
@media print {
    .gear-milling-calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .calculate-btn,
    .order-btn,
    .submit-btn,
    .modal {
        display: none !important;
    }
    
    .result-box {
        border: 1px solid #333;
        page-break-inside: avoid;
    }
}