:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --text-color: #333;
    --light-bg: #f9f9f9;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --modal-shadow: 0 4px 20px rgba(0,0,0,0.2);
    --transition: all 0.3s ease;
}
h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}
.calculator {
    background-color: white;
    border-radius: 12px;
    padding: 25px 0px;
    max-width: 800px;
    margin: 0 auto;
}
.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
label {
    font-weight: 600;
    width: 200px;
    margin-right: 15px;
    flex-shrink: 0;
}
input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    transition: var(--transition);
    flex: 1;
    min-width: 150px;
}
input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    width: 100%;
    margin-top: 15px;
    transition: var(--transition);
}
button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}
.formula {
    font-style: italic;
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 0px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}
/* Spring types styling */
.spring-types {
    display: flex;
    justify-content: flext-start;
    gap: 10px;
    margin-bottom: 25px;
    padding: 0px 25px;
    flex-wrap: wrap;
}
.type {
    text-align: center;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 8px;
    transition: var(--transition);
    background: #333;
    max-width: 150px;
}
.type:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.type-img {
    display: block;
    margin: 0 auto 8px;
    height: 50px;
    object-fit: contain;
}
.type span {
    font-size: 14px;
    color: #fff;
    font-weight: 400;
}
/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal.show {
    opacity: 1;
}
.modal-content {
    background-color: #fefefe;
    margin: 10vh auto;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--modal-shadow);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
    position: relative;
}
.modal.show .modal-content {
    transform: translateY(0);
}
.close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}
.close:hover {
    color: var(--text-color);
    transform: rotate(90deg);
}
.modal-img {
    max-width: 100%;
    max-height: 200px;
    height: auto;
    display: block;
    margin: 0 auto 20px;
    border-radius: 6px;
}
.modal-title {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
}
.result-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
        align-items: flex-start;
    }
    label {
        width: 100%;
        margin-bottom: 5px;
        margin-right: 0;
    }
    input {
        width: 100%;
    }
    .calculator {
        padding: 15px;
    }
    .spring-types {
        gap: 8px;
    }
    .type {
        padding: 8px;
        flex: 1 1 100px;
    }
    .modal-content {
        padding: 20px 15px;
    }
}
/* Animation for button click */
@keyframes buttonClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
.button-click {
    animation: buttonClick 0.3s ease;
}