body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #4CAF50;
    color: white;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

header p {
    margin-top: 5px;
    font-size: 1rem;
}

header a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

header a:hover {
    text-decoration: underline;
}

/* Style for the explanation text at the top and bottom */
.explanation-text {
    background-color: #e0f2f7; /* Light blue background */
    color: #0056b3; /* Darker blue text */
    padding: 15px 20px;
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
    border-bottom: 1px solid #cce5ed;
}

.footer-explanation {
    margin-top: 20px; /* Add some margin above the footer */
    border-top: 1px solid #cce5ed; /* Add a top border */
    border-bottom: none; /* Remove bottom border if it was inherited */
}


main {
    flex-grow: 1;
    padding: 20px;
    max-width: 1200px; /* Adjusted to 1200px as per old CSS request */
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.calculator-section, .table-section, .formula-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Style for the simple converter section to distinguish it */
.simple-converter-section {
    border-color: #a0d468; /* A slightly different border color */
    background-color: #f0fff0; /* A slightly different background color */
}


h2, h3 {
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.3rem;
    color: #555;
    border-bottom: 1px solid #eee;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.input-group input[type="number"],
.input-group select { /* Added select for simple converter */
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.highlight-text {
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
}

.radio-group, .checkbox-group {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-group label, .checkbox-group label {
    display: flex;
    align-items: center;
    background-color: #e9e9e9;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.radio-group label:hover, .checkbox-group label:hover {
    background-color: #dcdcdc;
}

.radio-group input[type="radio"], .checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* New styles for IELTS input row */
.ielts-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f0f8ff; /* Light blue background */
}

.ielts-input-row label[for="isEnglishMajor"] {
    margin-bottom: 0; /* Remove bottom margin for inline display */
    font-weight: bold;
    flex-shrink: 0; /* Prevent label from shrinking */
}

.ielts-input-row input[type="checkbox"]#isEnglishMajor {
    margin-right: 15px;
    transform: scale(1.3); /* Make checkbox slightly larger */
    flex-shrink: 0;
}

.ielts-score-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1; /* Allow container to take available space */
    transition: all 0.3s ease-in-out; /* Smooth transition for display */
    overflow: hidden; /* Hide overflow when collapsed */
    max-height: 0; /* Initially hidden */
    opacity: 0; /* Initially transparent */
}

.ielts-score-container.show {
    max-height: 100px; /* Max height when shown */
    opacity: 1; /* Fully visible */
}

.ielts-score-container label {
    margin-bottom: 0;
    font-weight: bold;
    white-space: nowrap; /* Prevent label from wrapping */
}

.ielts-score-container input[type="number"] {
    flex-grow: 1; /* Allow input to take available space */
    max-width: 120px; /* Limit max width for number input */
    padding: 8px;
}

.ielts-score-container small {
    display: block;
    margin-top: 0;
    color: #666;
    font-size: 0.85em;
    flex-shrink: 0;
    white-space: nowrap;
}


button#calculateBtn, button#simpleCalculateBtn { /* Apply to both buttons */
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%;
    transition: background-color 0.3s ease;
    margin-top: 20px;
}

button#calculateBtn:hover, button#simpleCalculateBtn:hover {
    background-color: #45a049;
}

.result-box { /* Applied to both result boxes now */
    margin-top: 20px;
    padding: 20px;
    background-color: #e9ffe9;
    border: 1px solid #d4edda;
    border-radius: 8px;
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    color: #28a745;
    display: none; /* Ẩn ban đầu */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.result-box.show {
    display: block; /* Hiện khi có kết quả */
}

.result-box.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #dc3545;
}

.result-box.warning {
    background-color: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 10px;
    text-align: center;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #555;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

.formula-section .formula-display {
    font-size: 1.5rem;
    text-align: center;
    background-color: #e0f7fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.formula-section ul {
    list-style-type: disc;
    margin-left: 20px;
}

.formula-section ul li {
    margin-bottom: 8px;
}


footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    background-color: #333;
    color: white;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    main {
        margin: 10px;
        padding: 15px;
    }
    .calculator-section, .table-section, .formula-section {
        padding: 15px;
    }
    .input-group input[type="number"],
    .input-group select {
        width: calc(100% - 10px); /* Adjust width for smaller screens */
    }
    button#calculateBtn, button#simpleCalculateBtn {
        font-size: 1rem;
        padding: 10px 15px;
    }
    .radio-group, .checkbox-group {
        flex-direction: column;
        gap: 8px;
    }
    .radio-group label, .checkbox-group label {
        width: 100%;
    }
    .ielts-input-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .ielts-score-container {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .ielts-score-container input[type="number"] {
        max-width: 100%;
    }
    table {
        font-size: 0.85rem;
    }
    th, td {
        padding: 8px;
    }
}
