/* --------------------------------------------------------------
# Root Variables
-------------------------------------------------------------- */
:root {
    --default-font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --heading-font: "Raleway", sans-serif;

    --background-color: #EFE1CE;
    --default-color: #2C2C2C;
    --heading-color: #2C2C2C;
    --accent-color: #E27D60;
    --reset-color: #C0C0C0;
    --surface-color: #F0F0F0;
    --contrast-color: #3E4C59;
    --highlight-color: #FFF8DC; /* Soft yellow for results */
    --link-color: #004080; /* Dark blue for links */
    --error-color: #D9534F;
}

/* --------------------------------------------------------------
# General Styling
-------------------------------------------------------------- */
body {
    font-family: var(--default-font);
    background-color: var(--background-color);
    color: var(--default-color);
    margin: 0;
    padding: 0;
}

h1, h2 {
    font-family: var(--heading-font);
    color: var(--heading-color);
    text-align: center;
    margin-bottom: 20px;
}

p {
    text-align: center;
    font-size: 16px;
    color: var(--default-color);
}




/* --------------------------------------------------------------
# Header Styling
-------------------------------------------------------------- */
.header {
    background-color: var(--background-color);
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* --------------------------------------------------------------
# Footer Styling
-------------------------------------------------------------- */
.footer {
    background-color: var(--contrast-color);
    color: #FFFFFF;
    padding: 20px 0;
    text-align: center;
}

/* --------------------------------------------------------------
# Form and Calculator Styling
-------------------------------------------------------------- */
.calculator-section {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    margin: 20px auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

label {
    display: block;
    margin: 10px 0 5px;
    font-weight: bold;
    color: var(--heading-color);
}

input, select, button {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

button {
    cursor: pointer;
    transition: background-color 0.3s;
}

button.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
}

button.btn:hover {
    background-color: color-mix(in srgb, var(--accent-color), transparent 20%);
}

button.reset-btn {
    background-color: var(--reset-color);
    color: #000;
}

button.reset-btn:hover {
    background-color: #A9A9A9;
}

/* --------------------------------------------------------------
# Output and Error Section
-------------------------------------------------------------- */



/* --------------------------------------------------------------
# Input Form Styling
-------------------------------------------------------------- */
.input-fields label {
    text-align: left;
    margin-bottom: 5px;
    display: block;
    font-weight: 600;
    color: var(--heading-color);
}

.input-fields input {
    width: 90%; /* Limit the input width */
    max-width: 350px; /* Ensure inputs don't stretch too far */
    margin: 0 auto 15px; /* Center the inputs and add spacing */
    display: block; /* Ensure it appears as a block */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}


/* Wrapper for Buttons */
.button-container {
    display: flex;
    justify-content: center; /* Center the buttons horizontally */
    gap: 10px; /* Add space between the buttons */
    margin-top: 10px; /* Add some space above the button container */
}

/* Button Styling */
button {
    cursor: pointer;
    transition: background-color 0.3s;
}

button.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    width: auto;
}

button.btn:hover {
    background-color: color-mix(in srgb, var(--accent-color), transparent 20%);
}

button.reset-btn {
    background-color: var(--reset-color);
    color: #000;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    width: auto;
}

button.reset-btn:hover {
    background-color: #A9A9A9;
}

/* --------------------------------------------------------------
# Responsive Design for Phones (Max Width: 480px)
-------------------------------------------------------------- */
@media (max-width: 480px) {
    /* General Body Typography */
    body {
        font-size: 13px; /* Adjust base font size for smaller screens */
    }

    /* Headers */
    h1, h2 {
        font-size: 18px; /* Adjust header font sizes */
        text-align: center; /* Center the text */
        margin-bottom: 15px; /* Adjust spacing below headers */
    }

    /* Paragraphs */
    p {
        font-size: 12px; /* Adjust paragraph font size */
        line-height: 1.5; /* Improve readability */
        padding: 0 10px; /* Add side padding */
    }

    /* Calculator Section */
    .calculator-section {
        padding: 15px; /* Reduce padding for smaller screens */
        max-width: 95%; /* Use more screen width */
        margin: 15px auto; /* Center the section */
        border-radius: 8px; /* Slightly smaller border radius */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    }

    /* Labels Above Input Fields */
    label {
        display: block; /* Ensure labels occupy their own line */
        text-align: center; /* Center-align the label text */
        font-size: 14px; /* Ensure the font size is readable */
        font-weight: bold; /* Emphasize labels */
        margin: 0 auto 10px; /* Add spacing below labels */
    }

    /* Input Fields */
    .input-fields input {
        width: auto; /* Let inputs size dynamically */
        max-width: 150px; /* Cap input width */
        padding: 8px; /* Comfortable touch targets */
        font-size: 14px; /* Keep font readable */
        text-align: center; /* Center text alignment */
        margin-bottom: 12px; /* Add spacing below inputs */
    }

    /* Dropdown Menu */
    #metric-select {
        width: 80%; /* Dropdown width set to 80% of the container */
        margin: 0 auto 10px; /* Center the dropdown */
        padding: 12px; /* Larger vertical padding for easier interaction */
        font-size: 16px; /* Increase font size for better readability */
        border: 1px solid #ccc; /* Add border for clarity */
        border-radius: 5px; /* Rounded corners */
        text-align: center;
    }

    /* Buttons */
    .button-container {
        display: flex; /* Use flex layout for buttons */
        flex-direction: row; /* Align buttons in a row */
        justify-content: center; /* Center the buttons */
        gap: 10px; /* Add small gap between buttons */
        margin-top: 10px; /* Add space above button container */
    }

    button {
        width: 45%; /* Restrict button width */
        font-size: 14px; /* Keep font readable */
        padding: 8px; /* Compact padding for touch targets */
        margin: 0; /* Remove excess margin */
    }

    /* Result Section */
    .result {
        width: 50%; /* Restrict result highlight width */
        margin: 10px auto; /* Center the result */
        font-size: 16px; /* Keep result font size readable */
        padding: 10px; /* Adjust padding */
        text-align: center; /* Center-align text */
    }

    
    /* Caveat Text */
    .result + p + p span {
        font-size: 0.8rem; /* Smaller font size for caveats */
        color: gray; /* Subtle color for caveat text */
        line-height: 1.3; /* Adjust line height */
    }

    /* Footer */
    .footer {
        font-size: 12px; /* Adjust footer text size */
        padding: 10px; /* Reduce padding */
    }
}

label {
    display: block !important; /* Ensure labels occupy their own line */
    text-align: center !important; /* Force center-align the label text */
    font-size: 17px !important; /* Ensure the font size is applied */
    font-weight: bold !important; /* Emphasize labels */
    margin: 0 auto 10px !important; /* Center horizontally and add spacing below */
    width: 100% !important; /* Ensure labels span the full container width */
}



/* Center the dropdown container */
.dropdown-container {
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Horizontally center the dropdown */
    align-items: center; /* Vertically align the dropdown (if needed) */
    width: 100%; /* Ensure the container spans full width */
    margin: 20px auto; /* Add spacing above and below */
}

/* Style the dropdown itself */
#metric-select {
    width: 100%; /* Take most of the container width */
    max-width: 300px; /* Limit the dropdown's maximum width */
    padding: 10px; /* Add padding for usability */
    font-size: 16px; /* Maintain readability */
    border-radius: 5px; /* Modern rounded corners */
    border: 1px solid #ccc; /* Subtle border for visibility */
    text-align: center; /* Align text inside dropdown */
    appearance: none; /* Remove browser-specific dropdown styling */
    background-color: var(--surface-color); /* Match background design */
}

/* Responsive styles for smaller screens */
@media (max-width: 768px) {
    #metric-select {
        width: 85%; /* Adjust width for smaller screens */
        font-size: 14px; /* Slightly reduce font size */
    }
}

/* --------------------------------------------------------------
# Result and Explanation Styling
-------------------------------------------------------------- */
.result {
    display: none; /* Initially hidden */
    text-align: center;
    margin-top: 20px;
    font-size: 24px;

    color: var(--contrast-color);
    background-color: var(--highlight-color); /* Softer yellow background */
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Explanation Styling */
.result + p {
    font-size: 16px;
    color: var(--default-color);
    text-align: center;
    margin-top: 10px;
    padding: 10px 15px;
    background-color: var(--highlight-color); /* Match background with result */
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Link Styling */
.result + p a {
    color: var(--link-color);
    font-weight: normal;
    text-decoration: underline;
    transition: color 0.3s;
}

.result + p a:hover {
    color: var(--accent-color); /* Accent color on hover */
}


