* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

.input-section {
    flex: 1;
    min-width: 300px;
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.visualization-section {
    flex: 2;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.canvas-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-3d-container {
    background: #ffffff;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
}

.canvas-3d-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 49%, rgba(0,0,0,0.05) 50%, transparent 51%),
        linear-gradient(0deg, transparent 49%, rgba(0,0,0,0.05) 50%, transparent 51%);
    background-size: 30px 30px;
    pointer-events: none;
    opacity: 0.3;
}

.canvas-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

canvas {
    border: 1px solid #ddd;
    background-color: transparent;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: white;
    transition: border-color 0.3s;
    cursor: pointer;
}

select:focus {
    border-color: #3498db;
    outline: none;
}

input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    border-color: #3498db;
    outline: none;
}

.unit {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-left: 5px;
}

.calculated-values {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 25px;
    border-left: 4px solid #3498db;
}

.calculated-values h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.calculated-value {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.value-label {
    font-weight: 600;
}

.value-number {
    color: #e74c3c;
    font-weight: 600;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    flex: 1;
    min-width: 160px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(41, 128, 185, 0.3);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(192, 57, 43, 0.3);
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background-color: #9b59b6;
    color: white;
}

.btn-secondary:hover {
    background-color: #8e44ad;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(142, 68, 173, 0.3);
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(211, 84, 0, 0.3);
}

.btn-dark {
    background-color: #34495e;
    color: white;
}

.btn-dark:hover {
    background-color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(44, 62, 80, 0.3);
}

.btn-file {
    background-color: #7f8c8d;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-file:hover {
    background-color: #5d6d6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(95, 109, 110, 0.3);
}

.buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 25px;
}

.file-input {
    display: none;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    color: #7f8c8d;
    font-size: 0.9rem;
}

@media (max-width: 1100px) {
    .container {
        flex-direction: column;
    }

    .visualization-section {
        min-width: 100%;
    }

    .buttons-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .buttons-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        min-width: 100%;
    }
}

.emoji {
    font-size: 18px;
}

@media print {
    body * {
        visibility: hidden;
    }

    #print-section, #print-section * {
        visibility: visible;
    }

    #print-section {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
    }

    .no-print {
        display: none !important;
    }
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.diameter-type-select {
    margin-bottom: 20px;
}

.diameter-type-select option {
    padding: 10px;
}

.diameter-type-select option[value="internal"] {
    background-color: #e3f2fd;
}

.diameter-type-select option[value="external"] {
    background-color: #f1f8e9;
}

.diameter-type-select option[value="neutral"] {
    background-color: #fff3e0;
}
