/* Basic Reset and Font Setup */
body {
    /* Using Noto Nastaliq Urdu for Urdu and Roboto for English */
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* Soft cream background */
    background-color: #fdfaf0;
    margin: 0;
    transition: font-family 0.3s ease;
}

/* Apply Urdu font and RTL direction when Urdu is active */
body.lang-ur-active {
    font-family: 'Noto Nastaliq Urdu', serif;
    direction: rtl;
}

.calculator-container {
    background-color: #ffffff;
    padding: 35px; /* Slightly increased padding */
    border-radius: 12px; /* Softer corners */
    /* Elegant green border */
    border: 2px solid #046307; /* Darker, richer green */
    box-shadow: 0 6px 15px rgba(4, 99, 7, 0.2); /* Subtle green shadow */
    text-align: center;
    width: 90%;
    max-width: 420px; /* Slightly wider */
}

/* Adjust text alignment based on language */
body.lang-ur-active .calculator-container {
    text-align: right;
}

h1 {
    /* Main heading in green */
    color: #046307;
    margin-bottom: 25px;
    font-size: 2em; /* Slightly larger title */
    font-weight: 700; /* Bolder title */
}

/* Ensure h1 uses appropriate font */
body.lang-ur-active h1 {
     font-family: 'Noto Nastaliq Urdu', serif; /* Ensure Urdu font for title in Urdu mode */
}
body:not(.lang-ur-active) h1 {
     font-family: 'Roboto', sans-serif; /* Ensure English font for title in English mode */
     font-weight: 700;
}


.lang-switcher {
    margin-bottom: 25px;
    text-align: center;
}

.lang-button {
    padding: 8px 18px;
    margin: 0 6px;
    cursor: pointer;
    border: 1px solid #046307; /* Green border */
    background-color: #f0f0f0; /* Light background for inactive */
    color: #333;
    border-radius: 6px; /* Rounded corners */
    font-family: 'Roboto', sans-serif; /* Consistent font for buttons */
    font-size: 0.9em;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.lang-button:hover {
    background-color: #e5f0e5; /* Very light green tint on hover */
    border-color: #05800a;
}

.lang-button.active {
    /* Active button in green */
    background-color: #046307;
    color: white;
    border-color: #034f06;
    font-weight: bold;
}

.input-group {
    margin-bottom: 18px;
    text-align: left;
}

body.lang-ur-active .input-group {
    text-align: right;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: #333; /* Darker label color for contrast */
    font-weight: bold;
    font-size: 0.95em;
}

.input-group input[type="number"] {
    width: calc(100% - 24px);
    padding: 12px; /* More padding */
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    /* Ensure LTR input for numbers even in RTL mode */
    direction: ltr;
    text-align: left;
    transition: border-color 0.3s ease;
}

.input-group input[type="number"]:focus {
     border-color: #05800a; /* Green border on focus */
     outline: none; /* Remove default outline */
     box-shadow: 0 0 5px rgba(4, 99, 7, 0.2); /* Subtle green glow on focus */
}

/* Remove spinner arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}


#calculate-btn {
    padding: 14px 30px; /* Larger button */
    background-color: #05800a; /* Slightly brighter green for action */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em; /* Larger text */
    font-weight: bold;
    margin-top: 15px;
    transition: background-color 0.3s ease;
    width: 100%;
    font-family: 'Roboto', sans-serif; /* Consistent font */
}
/* Ensure button text also changes font in Urdu mode if needed, or keep Roboto */
body.lang-ur-active #calculate-btn {
    font-family: 'Noto Nastaliq Urdu', serif; /* Apply Urdu font to button */
     font-weight: 700; /* Adjust weight for Urdu font */
}


#calculate-btn:hover {
    background-color: #046307; /* Darker green on hover */
}

#result {
    margin-top: 30px;
    font-size: 1.25em; /* Slightly larger result text */
    color: #333;
    line-height: 1.6; /* Better spacing */
}

#result p {
    margin-bottom: 12px;
    font-weight: bold;
    color: #046307; /* Result intro text in green */
}

/* Style for the calculated numbers */
#result #years,
#result #months,
#result #days {
    font-weight: bold;
    color: #111; /* Dark color for numbers */
    font-size: 1.2em; /* Make numbers slightly larger */
    margin: 0 2px; /* Minimal horizontal space around numbers */
}

/* Style for the unit labels (Years, Months, Days) */
#result [data-key="resultYears"],
#result [data-key="resultMonths"],
#result [data-key="resultDays"] {
    font-weight: normal;
    color: #046307; /* Green labels */
    font-size: 1em; /* Base size for labels */
    margin-left: 5px;  /* Space before label (adjust for RTL below) */
    margin-right: 10px; /* Space after label (adjust for RTL below) */
}

/* Adjust spacing for RTL */
body.lang-ur-active #result [data-key="resultYears"],
body.lang-ur-active #result [data-key="resultMonths"],
body.lang-ur-active #result [data-key="resultDays"] {
    margin-left: 10px; /* Space after label in RTL */
    margin-right: 5px; /* Space before label in RTL */
}


.error {
    color: #B71C1C; /* Darker red for error messages */
    margin-top: 15px;
    font-weight: bold;
    min-height: 1.2em;
    font-size: 0.9em;
}

/* Responsive adjustments */
@media (max-width: 450px) {
    .calculator-container {
        padding: 25px;
        margin: 15px; /* Add margin on smaller screens */
        width: auto; /* Allow container to shrink */
    }
    h1 {
        font-size: 1.7em;
    }
    #calculate-btn {
        font-size: 1.1em;
        padding: 12px 25px;
    }
    #result {
        font-size: 1.15em;
    }
    .input-group input[type="number"] {
         padding: 10px;
    }
}