:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}*/

.container {
    /*max-width: 1600px;*/
    margin: 0 auto;
}

/* Заголовок */
/*.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}*/

.header h1 {
    color: var(--primary-color);
   /* font-size: 2.5rem;*/
    margin-bottom: 10px;
}

.header .subtitle {
    color: #666;
    /*font-size: 1.1rem;*/
}

/* Выбор типа металла */
.metal-type-selector {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.metal-type-selector h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.type-btn {
    background: var(--light-color);
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    padding: 15px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    /* display: flex; */
    align-items: baseline;
    justify-content: center;
    /* min-height: 23px; */
    border: none;
    font-family: inherit;
    align-content: flex-end;
    flex-wrap: nowrap;
}

.type-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--secondary-color);
}

.type-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.type-btn i {
    /*font-size: 2rem;*/
    margin-bottom: 10px;
}

.type-btn span {
    font-weight: 600;
    /*font-size: 0.95rem;*/
}

/* Основной контент */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Секции */
.parameters-section,
.drawing-section,
.results-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
}

.section-header h3 {
    /* font-size: 1.2rem; */
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    margin-bottom: 0;
    color: #fff;
}

/* Параметры */
.params-container {
    padding: 20px;
}

.dynamic-fields {
    margin-bottom: 25px;
}

.param-group {
    margin-bottom: 20px;
}

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.param-group input,
.param-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    /*font-size: 1rem;*/
    transition: var(--transition);
    font-family: inherit;
    box-sizing: border-box;
}

.param-group input:focus,
.param-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Переключатель цены */
.price-toggle {
    display: flex;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 2px solid var(--secondary-color);
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    background: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-family: inherit;
   /* font-size: 0.95rem;*/
}

.toggle-btn.active {
    background: var(--secondary-color);
    color: white;
}

.toggle-btn:not(.active):hover {
    background: #f8f9fa;
}

/* Кнопка расчета */
.calculate-btn {
    width: 100%;
    padding: 15px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
   /* font-size: 1.1rem;*/
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    font-family: inherit;
}

.calculate-btn:hover {
    background: #219653;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Чертеж */
.drawing-container {
    padding: 20px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#drawing {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.drawing-svg {
    width: 100%;
    height: 100%;
    max-width: 300px;
    max-height: 250px;
}

.drawing-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    width: 100%;
}

.dimension {
    margin: 5px 0;
    /*font-size: 0.9rem;*/
    color: #666;
}

/* Результаты */
.results-container {
    padding: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.result-item:hover {
    transform: translateX(5px);
    background: #e9ecef;
}

.result-item.highlight {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
}

.result-label {
    font-weight: 600;
    color: var(--primary-color);
}

.result-value {
    font-weight: 700;
    color: var(--secondary-color);
    /*font-size: 1.1rem;*/
}

.additional-results {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #ddd;
}

/* Справочная информация */
.reference-info {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.reference-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.reference-item h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    /*font-size: 1.1rem;*/
}

.reference-item ul {
    list-style: none;
    padding-left: 0;
}

.reference-item li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.reference-item li:last-child {
    border-bottom: none;
}

/* Подвал */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    /*font-size: 0.9rem;*/
}

/* Утилиты */
.hidden {
    display: none !important;
}

/* Модальное окно ГОСТ */
.gost-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.gost-modal-backdrop.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.gost-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.gost-modal-header {
    background: var(--primary-color, #2c3e50);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1a252f;
}

.gost-modal-title {
    /*font-size: 1.4rem;*/
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gost-modal-btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
    font-family: inherit;
}

.gost-modal-btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.gost-modal-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    max-height: 65vh;
}

.gost-modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.gost-table-modal {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.gost-table-modal thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.gost-table-modal th {
    background: #3498db;
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    /*font-size: 0.95rem;*/
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.gost-table-modal td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    /*font-size: 0.9rem;*/
}

.gost-table-modal tr:hover td {
    background: #f8f9fa;
}

.gost-table-modal .select-btn {
    padding: 6px 15px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    /*font-size: 0.85rem;*/
    transition: background 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.gost-table-modal .select-btn:hover {
    background: #27ae60;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .type-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .reference-content {
        grid-template-columns: 1fr;
    }
    
    .gost-modal-content {
        width: 98%;
        max-height: 90vh;
    }
    
    .gost-modal-header {
        padding: 15px;
    }
    
    .gost-modal-title {
        font-size: 1.2rem;
    }
    
    .gost-table-modal th,
    .gost-table-modal td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    
    .gost-table-modal .select-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .gost-modal-body {
        max-height: 75vh;
        overflow-x: auto;
    }
    
    .gost-table-modal {
        min-width: 700px;
    }
}

/* Кнопка ГОСТ */
.show-gost-btn {
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
    font-family: inherit;
}

.show-gost-btn:hover {
    background: #1a252f;
}

.show-gost-btn i {
    font-size: 0.9rem;
}

/* Уведомления */
.gost-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: gostSlideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
    font-size: 0.9rem;
}

@keyframes gostSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes gostSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}