:root {
    --primary-color: #510015;
    --secondary-color: #961537;
    --background-color: #f0f3f8;
    --text-color: #2d3436;
    --input-bg: #ffffff;
    --shadow-color: rgba(108, 92, 231, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Poppins", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.calculator {
    background-color: var(--input-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    padding: 2.5rem;
    width: 100%;
    max-width: 100%;
    transition: all 0.3s ease;
}

.calculator:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px var(--shadow-color);
}

h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.2rem;
    font-weight: 700;
}

form {
    display: flex;
    flex-direction: column;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
    width: 100%;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

label {
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    background-color: var(--input-bg);
    padding: 0 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s ease;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--input-bg);
    color: var(--text-color);
    margin: 0.5rem 0;
}

.flex-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.flex-group input {
    width: 70%;
}

.flex-group select {
    width: 30%;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow-color);
}

input[type="number"]:focus + label,
input[type="text"]:focus + label,
select:focus + label {
    color: var(--primary-color);
    font-weight: 700;
}

button {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

#result {
    margin-top: 2rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary-color);
    background-color: var(--background-color);
    padding: 0.25rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.responsive-image {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.responsive-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Container for better control over image sizing */
.image-container {
    width: 100%;
    max-width: 600px; /* Adjust this value as needed */
    margin: 0 auto;
}

/* Media query for smaller screens */
@media (max-width: 768px) {
    .image-container {
        max-width: 100%;
        padding: 0 15px;
    }
}

#resistorImageContainer {
    /* margin: 16px 0; */
    display: flex;
    justify-content: center;
}

#resistor-svg {
    max-width: 100%;
    height: auto;
}

.info-section {
    width: 100%;
}

/* Ensure math blocks are responsive */
.katex-display {
    display: block;
    width: 100%;
    overflow-x: auto;
    text-align: center;
    height: 65px;
    margin: 1rem 0;
}

/* Adjust inline math for responsiveness */
.katex {
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
}

/* Typography adjustments for mobile view */
@media (max-width: 600px) {
    .katex-display {
        font-size: 0.9rem; /* Slightly reduce font size */
    }
    .katex {
        font-size: 0.9rem; /* Match inline math font size */
    }
}

.flex-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.flex-section select {
    width: min-content
}
