/* Base styles for the Inter font and overall body appearance */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* A light grey background */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure it takes full viewport height */
}

/* Calculator container styling */
.calculator-container {
    background-color: #ffffff; /* White background for the calculator */
    padding: 2.5rem; /* Increased padding for a more spacious feel */
    border-radius: 1.25rem; /* More rounded corners */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); /* Stronger, softer shadow */
    max-width: 550px; /* Wider max-width for better form layout */
    width: 100%; /* Responsive width */
    margin: 2rem; /* Margin around the container */
    border: 1px solid #e2e8f0; /* Subtle border */
}

/* Title styling */
.calculator-title {
    font-size: 2.25rem; /* Larger, more prominent title */
    font-weight: 800; /* Extra bold font */
    color: #2c5282; /* Deep blue for the title */
    margin-bottom: 2rem; /* More space below the title */
    text-align: center;
}

/* Form group styling */
.form-group {
    margin-bottom: 1.5rem; /* Increased space between form elements */
}

/* Label styling */
.form-label {
    display: block;
    font-size: 1.125rem; /* Slightly larger label font */
    font-weight: 600; /* Semi-bold */
    color: #4a5568; /* Darker grey for labels */
    margin-bottom: 0.75rem; /* Space between label and input */
}

/* Input and Select field styling */
.form-input,
.form-select {
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    width: 100%;
    padding: 1rem 1.25rem; /* More padding */
    border: 2px solid #cbd5e0; /* Slightly thicker border */
    border-radius: 0.625rem; /* Nicely rounded */
    font-size: 1.125rem; /* Larger font size */
    color: #2d3748;
    background-color: #f7fafc; /* Very light background for inputs */
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.form-input:focus,
.form-select:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.4); /* More prominent glow */
    outline: none;
    background-color: #ffffff; /* White on focus */
}

/* Button styling */
.calculate-button {
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    width: 100%;
    padding: 1.25rem; /* Generous button padding */
    background-image: linear-gradient(to right, #4E5879, #4E5879); /* Gradient background */
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 0.75rem; /* More rounded button */
    cursor: pointer;
    font-size: 1.25rem; /* Larger button text */
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 15px rgba(66, 153, 225, 0.3); /* Colorful shadow */
    margin-top: 1.5rem; /* Space above button */
    position: relative; /* For bubble effect */
    overflow: hidden; /* For bubble effect */
}

.calculate-button:hover {
    background-image: linear-gradient(to right, #4E5879, #4E5879); /* Darker gradient on hover */
    transform: translateY(-2px); /* Lift effect */
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.4);
}

.calculate-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(66, 153, 225, 0.2);
}

/* Bubble effect for button */
.calculate-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: width 0.4s ease-out, height 0.4s ease-out, opacity 0.4s ease-out;
}

.calculate-button:active::before {
    width: 200%;
    height: 200%;
    opacity: 1;
    transition: 0s; /* Instant reset for active state */
}


/* Result display styling */
.result-display {
    margin-top: 2rem; /* More space above result */
    padding: 1.5rem; /* Generous padding */
    background-color: #e0f2fe; /* Lighter, softer blue */
    border: 2px solid #90cdf4; /* Complementary blue border */
    border-radius: 1rem; /* More rounded corners */
    font-size: 1.625rem; /* Even larger, prominent result font */
    font-weight: 800; /* Extra bold */
    color: #2b6cb0; /* Stronger blue for result text */
    text-align: center;
    opacity: 0; /* Hidden by default */
    transform: translateY(20px); /* Slide up effect */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.result-display.show {
    opacity: 1;
    transform: translateY(0);
}

/* Error Message Styling */
.error-message {
    color: #e53e3e; /* Brighter red for errors */
    font-size: 0.95rem; /* Slightly larger error font */
    margin-top: 0.5rem;
    margin-bottom: 0;
    display: none; /* Hidden by default */
}

/* General hidden class */
.hidden {
    display: none !important;
}

/* Custom Message Box Styling */
.message-box-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px); /* Frosted glass effect */
    -webkit-backdrop-filter: blur(5px); /* For Safari */
}

.message-box-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3); /* Even stronger shadow */
    text-align: center;
    max-width: 400px; /* Slightly wider message box */
    width: 90%;
    animation: fadeInScale 0.3s ease-out; /* New animation */
    border: 1px solid #e2e8f0;
}

.message-box-text {
    margin-bottom: 1.5rem;
    color: #374151;
    font-size: 1.125rem; /* Larger message text */
    line-height: 1.6;
}

.message-box-button {
    background-color: #4299e1;
    color: white;
    padding: 0.875rem 1.75rem; /* More padding */
    border: none;
    border-radius: 0.625rem;
    cursor: pointer;
    font-size: 1.05rem; /* Slightly larger button font */
    transition: background-color 0.2s ease-in-out;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.message-box-button:hover {
    background-color: #3182ce;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Media Queries for Responsiveness */
@media (max-width: 640px) {
    .calculator-container {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 1rem;
    }

    .calculator-title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .form-label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .form-input,
    .form-select {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .calculate-button {
        padding: 1rem;
        font-size: 1.1rem;
        margin-top: 1rem;
    }

    .result-display {
        font-size: 1.35rem;
        padding: 1rem;
        margin-top: 1.5rem;
    }

    .error-message {
        font-size: 0.85rem;
    }

    .message-box-content {
        padding: 1.5rem;
    }

    .message-box-text {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .message-box-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}