:root {
    --sky-blue-light: #e0f2fe; /* Lightest Sky Blue for backgrounds */
    --sky-blue-mid: #7dd3fc;   /* Mid Sky Blue for accents */
    --sky-blue-dark: #0ea5e9;  /* Darker Sky Blue for text/borders */
    --orange-primary: #f97316; /* Vibrant Orange */
    --orange-light: #fdba74;   /* Lighter Orange for accents */
    --text-primary: #374151;   /* Dark Gray for text */
    --text-secondary: #6b7280; /* Medium Gray */
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --success-color: #10b981;
    --error-color: #ef4444;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--sky-blue-light) 0%, #bae6fd 100%);
    color: var(--text-primary);
    margin: 0;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
}

.main-container {
    width: 100%;
    max-width: 900px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.8em;
    color: var(--orange-primary);
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -1px;
}

header .tagline {
    font-size: 1.1em;
    color: var(--text-secondary);
    font-weight: 300;
}

.calculator-card, .grading-info-card {
    background-color: var(--bg-card);
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow-color);
    margin-bottom: 30px;
}

.form-instructions {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: var(--sky-blue-dark);
    font-weight: 500;
    padding: 10px;
    background-color: var(--sky-blue-light);
    border-radius: 6px;
    border: 1px dashed var(--sky-blue-mid);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* Spacing between rows */
    margin-bottom: 25px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: var(--sky-blue-mid);
    color: white;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px;}
th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px;}


td {
    border-bottom: 1px solid var(--border-color);
}
tr:last-child td {
    border-bottom: none;
}

td:first-child { /* Subject name column */
    font-weight: 500;
    color: var(--sky-blue-dark);
}

input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus {
    border-color: var(--orange-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2); /* Orange focus ring */
}
input::placeholder {
    color: #cbd5e1; /* Light gray for placeholder */
    font-weight: 300;
}

.action-button {
    background: linear-gradient(to right, var(--orange-primary), var(--orange-light));
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 50px; /* Pill shape */
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}
.action-button:active {
    transform: translateY(0px);
    box-shadow: 0 3px 10px rgba(249, 115, 22, 0.3);
}


.grading-info-card h3 {
    color: var(--orange-primary);
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
}
.grading-info-card table th {
    background-color: var(--orange-light);
    color: var(--text-primary);
}
.grading-info-card table td {
    font-size: 0.9em;
    border-color: #fed7aa; /* Lighter orange border */
}
.grading-info-card .note {
    margin-top: 15px;
    font-size: 0.9em;
    color: var(--text-secondary);
    background-color: #fffbeb; /* Very light yellow */
    padding: 10px;
    border-left: 4px solid var(--orange-light);
    border-radius: 4px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Darker overlay */
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-card);
    margin: 8% auto;
    padding: 0; /* Remove padding, handle with header/body */
    border: none;
    width: 90%;
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden; /* For border-top on header */
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}


.modal-header {
    padding: 18px 25px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header.success {
    background-color: var(--success-color);
    color: white;
}
.modal-header.error {
    background-color: var(--error-color);
    color: white;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.modal-body {
    padding: 20px 25px;
}
.modal-body p#popupMessage {
    font-size: 1.05em;
    margin-bottom: 20px;
}


.close-btn {
    color: var(--text-secondary);
    float: right;
    font-size: 30px;
    font-weight: bold;
    position: absolute;
    top: 12px;
    right: 20px;
    transition: color 0.2s ease;
}
.modal-header.success .close-btn,
.modal-header.error .close-btn {
    color: white;
    opacity: 0.8;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--orange-primary);
    text-decoration: none;
    cursor: pointer;
}
.modal-header.success .close-btn:hover,
.modal-header.error .close-btn:hover {
    opacity: 1;
}


#popupResultTable { width: 100%; margin-top: 15px; border-spacing: 0 5px; }
#popupResultTable th {
    background-color: var(--sky-blue-mid);
    color: white;
    font-size: 0.9em;
}
#popupResultTable td {
    border: 1px solid var(--border-color);
    padding: 10px;
    font-size: 0.95em;
}
#popupResultTable td:nth-child(1) { font-weight: 500; } /* Subject name */
#popupResultTable td:nth-child(5), /* Grade */
#popupResultTable td:nth-child(6)  /* GP */
{
    font-weight: 600;
    text-align: center;
}
#popupResultTable td:nth-child(6) { color: var(--orange-primary); } /* GP color */


.final-results-summary {
    margin-top: 25px;
    padding: 15px;
    background-color: var(--sky-blue-light);
    border-radius: 8px;
    border: 1px solid var(--sky-blue-mid);
}
.final-results-summary p {
    font-size: 1.2em;
    font-weight: 500;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
}
.final-results-summary span {
    color: var(--orange-primary);
    font-weight: 700;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    header h1 { font-size: 2.2em; }
    header .tagline { font-size: 1em; }
    .calculator-card, .grading-info-card { padding: 20px; }
    th, td { padding: 10px 8px; font-size: 0.9em; }
    input[type="number"] { padding: 8px; font-size: 0.95em;}
    .action-button { padding: 12px 24px; font-size: 1em; }
    .modal-content { margin: 10% auto; width: 95%; }
    .modal-header h3 {font-size: 1.2em;}
    .final-results-summary p { font-size: 1.1em; }
}
@media (max-width: 480px) {
    body { padding: 15px; }
    header h1 { font-size: 1.8em; }
    header .tagline { font-size: 0.9em; }
    .form-instructions { font-size: 0.85em; }
    /* Consider stacking table for very small screens if needed, or allow horizontal scroll */
    table { font-size: 0.85em; }
    th, td { padding: 8px 5px; }
    .action-button svg { display: none; } /* Hide icon on small buttons */
    .action-button { padding: 10px 20px; }
}

/* ... (your existing CSS) ... */

.site-footer {
    text-align: center;
    padding: 20px 15px;
    margin-top: 40px; /* Space above the footer */
    background-color: var(--sky-blue-dark); /* Or a different contrasting color */
    color: var(--sky-blue-light); /* Light text on dark background */
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
}

.site-footer p {
    margin: 5px 0;
    opacity: 0.9;
}

.site-footer a { /* If you add links in footer */
    color: var(--orange-light);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}