:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --secondary-color: #3f37c9;
    --accent-color: #f72585;
    --success-color: #4cc9f0;
    --error-color: #f94144;
    --warning-color: #f8961e;
    --text-dark: #2b2d42;
    --text-light: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --border-radius: 16px;
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 12px 40px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --e-grade-background: #ffebeb;
    --result-pass: #28a745;
    --result-comp: #ffc107;
    --result-repeat: #dc3545;
    --result-abst: #6c757d;
    --result-unknown: #007bff;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column; 
    justify-content: flex-start; 
    align-items: center;
    padding: 0; 
    line-height: 1.6;
    overflow-x: hidden;
}

.navbar {
    width: 100%;
    max-width: 900px; 
    margin: 0 auto; 
    background-color: var(--primary-color);
    padding: 10px 20px;
    box-shadow: var(--shadow-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    z-index: 10; 
    position: sticky; 
    top: 0; 
    border-radius: 0 0 var(--border-radius) var(--border-radius); 
}

.navbar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: auto; 
    flex-grow: 1; 
}

.site-title {
    color: var(--text-light);
    font-size: 1.5rem; 
    font-weight: 700;
    margin: 0;
    flex-grow: 0; 
    text-align: left; 
    padding-right: 20px; 
}

.hamburger-icon {
    display: none; 
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.navbar-links {
    list-style: none;
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.navbar-links li {
    margin: 0;
}

.navbar-links .btn {

    padding: 8px 15px; 
    font-size: 0.9rem;
    min-width: auto;
    box-shadow: none; 
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
    border: 1px solid transparent; 
}

.navbar-links .btn:hover:not(:disabled) {
     transform: translateY(-2px); 
     box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); 
}

.navbar-links #loginBtn {
    background: linear-gradient(45deg, #ff7e5f, #feb47b); 
    color: var(--text-dark); 
    border-color: #ff7e5f;
}
.navbar-links #loginBtn:hover:not(:disabled) {
     background: linear-gradient(45deg, #feb47b, #ff7e5f);
     color: white; 
     border-color: #feb47b;
}

.navbar-links #viewDataBtn,
.navbar-links #dataBtn { 
    background: linear-gradient(45deg, #6a11cb, #2575fc); 
    color: white;
    border-color: #6a11cb;
}
.navbar-links #viewDataBtn:hover:not(:disabled),
.navbar-links #dataBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #2575fc, #6a11cb);
    border-color: #2575fc;
}

.navbar-links #logoutBtn {
    background: linear-gradient(45deg, #ee0979, #ff6a00); 
    color: white;
    border-color: #ee0979;
}
.navbar-links #logoutBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff6a00, #ee0979);
    border-color: #ff6a00;
}

.navbar-links #homeBtn {
     background: linear-gradient(45deg, #00f260, #0575e6); 
     color: white;
     border-color: #00f260;
}
.navbar-links #homeBtn:hover:not(:disabled) {
     background: linear-gradient(45deg, #0575e6, #00f260);
     border-color: #0575e6;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 0; 
    }

    .navbar-header {
        width: 100%;
        justify-content: space-between; 
        align-items: center;
        flex-grow: 0; 
    }

    .site-title {
        text-align: left; 
        font-size: 1.3rem; 
        padding-right: 0; 
    }

    .hamburger-icon {
        display: block; 
    }

    .navbar-links {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        padding: 10px 0;
        display: none; 
        border-top: 1px solid rgba(255, 255, 255, 0.2); 
    }

    .navbar-links.active {
        display: flex; 
    }

    .navbar-links li {
        width: 100%;
        text-align: center;
    }

    .navbar-links .btn {
        width: 90%; 
        margin: 0 auto; 
    }
}

.container {
    background: var(--card-gradient);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    padding: 30px 20px;
    width: 100%;
    max-width: 900px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    transition: var(--transition);
    z-index: 1;
    margin-top: 30px; 
    margin-bottom: 30px; 
    flex: 1; /* Allow container to grow and push footer to bottom */
}
.container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(67, 97, 238, 0.1) 0%, transparent 70%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.container:hover::before {
    opacity: 1;
}
.container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}
.title {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.file-details {
    background: rgba(67, 97, 238, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: 500;
    min-height: 20px;
    font-size: 1.1rem;
    color: var(--secondary-color);
    border-left: 4px solid var(--primary-color);
    text-align: left;
    transition: var(--transition);
}
.file-details:hover {
    transform: translateX(5px);
}
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    margin-bottom: 30px;
    transition: var(--transition);
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
    z-index: 0;
}
.upload-area:hover {
    background-color: rgba(67, 97, 238, 0.05);
    border-color: var(--secondary-color);
    transform: translateY(-3px);
}
.upload-area.highlight {
    background-color: rgba(67, 97, 238, 0.1);
    border-color: var(--accent-color);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.2); }
    70% { box-shadow: 0 0 0 15px rgba(67, 97, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}
.upload-icon {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: var(--transition);
}
.upload-area:hover .upload-icon {
    transform: scale(1.1);
    color: var(--secondary-color);
}
.upload-area p {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text-dark);
}
#fileInput {
    display: none;
}
.browse-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    display: inline-block;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    border: none;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    min-width: 180px;
}
.browse-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}
.browse-btn:hover::before {
    left: 100%;
}
.browse-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.4);
}
.buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    min-width: 180px;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    gap: 8px; 
}
.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s ease;
}
.btn:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}
#generateBtn {
    background: linear-gradient(45deg, #28a745, #218838);
    color: white;
}
#generateBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #218838, #28a745);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-3px);
}
#resetBtn {
    background: linear-gradient(45deg, var(--error-color), #f8961e);
    color: white;
}
#resetBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #f8961e, var(--error-color));
    box-shadow: 0 8px 20px rgba(249, 65, 68, 0.3);
    transform: translateY(-3px);
}
#submitEmailBtn {
     background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
}
#submitEmailBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, var(--primary-light), var(--primary-color));
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.4);
    transform: translateY(-3px);
}
#okLoginBtn { 
     background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
}
#okLoginBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, var(--primary-light), var(--primary-color));
    box-shadow: 0 8gpx 20px rgba(67, 97, 238, 0.4);
    transform: translateY(-3px);
}
#cancelLoginBtn { 
     background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
}
#cancelLoginBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #5a6268, #6c757d);
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
    transform: translateY(-3px);
}

#skipEmailBtn {
     background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
}
#skipEmailBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #5a6268, #6c757d);
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
    transform: translateY(-3px);
}
.status {
    min-height: 60px;
    margin-bottom: 25px;
    font-weight: 500;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: 10px;
    transition: var(--transition);
}
.status.success {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}
.status.error {
    background-color: rgba(249, 65, 68, 0.1);
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}
.status.processing {
    background-color: rgba(248, 150, 30, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}
.status i {
    margin-right: 12px;
    font-size: 1.3rem;
}
.error-tip {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(249, 65, 68, 0.1);
    border-radius: 8px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    animation: fadeIn 0.5s ease-out;
}
.error-tip strong {
    color: var(--error-color);
    font-weight: 600;
}
.download-area {
    margin-bottom: 25px;
    animation: fadeInUp 0.5s ease-out;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.download-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 16px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    border: none; 
    cursor: pointer;
}
.download-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}
.download-btn:hover::after {
    left: 100%;
}
.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(67, 97, 238, 0.4);
}
.progress-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
    display: none;
}
.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.4s ease;
}
.footer {
    width: 100%;
    max-width: 900px;
    margin: auto auto 0 auto;
    background-color: var(--primary-color);
    padding: 8px 20px;
    box-shadow: var(--shadow-medium);
    display: block;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    z-index: 10;
    position: sticky;
    bottom: 0;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    color: var(--text-light);
    font-weight: 400;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
}
.footer-icon {
    margin-right: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
}
.footer a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}
.footer a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}
.shape {
    position: absolute;
    opacity: 0.1;
    animation: float 15s infinite linear;
}
.shape.circle {
    border-radius: 50%;
    background: var(--primary-color);
}
.shape.triangle {
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 50px solid var(--accent-color);
    background: transparent;
}
.shape.square {
    background: var(--success-color);
}
@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}
.file-access-section {
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    text-align: center;
}
.file-access-section p {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 20px;
}
.dropdown-group {
    display: flex;
    flex-direction: column; 
    align-items: center;
    gap: 15px; 
    margin-bottom: 20px;
}

@media (min-width: 769px) { 
    .dropdown-group {
        flex-direction: row;
        justify-content: center;
    }
    .dropdown {
        margin-bottom: 0; 
    }
}

.dropdown {
    padding: 10px 15px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234361ee%22%20d%3D%22M287%2C146.2c0%2C1.2-0.3%2C2.4-0.8%2C3.5L150.4%2C283.4c-2.2%2C2.2-5.8%2C2.2-8%2C0L5.3%2C149.7c-2.2-2.2-2.2-5.8%2C0-8l1.4-1.4c2.2-2.2%2C5.8-2.2%2C8%2C0l135.4%2C135.4L277.8%2C141.5c2.2-2.2%2C5.8-2.2%2C8%2C0l1.4%2C1.4C286.7%2C143.8%2C287%2C145%2C287%2C146.2z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px auto;
    padding-right: 30px;
}
.dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}
.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}
#viewResultBtn {
    background: linear-gradient(45deg, #28a745, #218838);
    color: white;
}
#viewResultBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #218838, #28a745);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-3px);
}
#downloadExcelBtn {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
}
#downloadExcelBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, var(--accent-color), var(--primary-color));
    box-shadow: 0 12px 25px rgba(67, 97, 238, 0.4);
    transform: translateY(-3px);
}
#deleteAllOutputFilesBtn {
    background: linear-gradient(45deg, var(--error-color), #c82333);
    color: white;
}
#deleteAllOutputFilesBtn:hover:not(:disabled) {
    background: linear-gradient(45deg, #c82333, var(--error-color));
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.4);
    transform: translateY(-3px);
}
.school-list-section {
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    text-align: left;
    animation: fadeIn 0.5s ease-out;
}
.school-list-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    flex-wrap: wrap;
}
.school-list-section .section-header h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin: 0 0 10px 0;
    flex-basis: 100%;
}
.school-list-section .school-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-grow: 1;
    justify-content: flex-start;
}
.school-list-section .school-actions .select-all-label {
    margin-right: 5px;
    font-size: 0.9rem;
    color: var(--text-dark);
}
.school-list-section .school-actions input[type="checkbox"] {
    margin-right: 10px;
    min-width: 18px;
    min-height: 18px;
    accent-color: var(--primary-color);
}
.school-list-section .school-actions .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: auto;
}
.school-list-section .delete-btn {
    background: linear-gradient(45deg, var(--error-color), #c82333);
    color: white;
}
.school-list-section .delete-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #c82333, var(--error-color));
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.4);
    transform: translateY(-2px);
}
.school-list-section .download-files-btn {
    background: linear-gradient(45deg, var(--primary-light), var(--success-color));
    color: white;
}
.school-list-section .download-files-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, var(--success-color), var(--primary-light));
    box-shadow: 0 4px 10px rgba(76, 201, 240, 0.3);
    transform: translateY(-2px);
}
.school-list-section .delete-btn:disabled,
.school-list-section .download-files-btn:disabled {
     opacity: 0.5;
     cursor: not-allowed;
}
.student-list, .subject-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}
.student-item:hover {
    background-color: #f9f9f9;
}
.student-item:last-child {
    border-bottom: none;
}
.student-roll-name, .subject-info {
    flex-grow: 1;
    text-align: left;
    font-weight: 500;
    color: var(--text-dark);
    padding-right: 10px;
}
.view-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
    flex-shrink: 0;
}
.view-icon:hover {
    color: var(--accent-color);
    text-decoration: underline;
}
.view-icon i {
    font-size: 1rem;
}

.sheet-tabs-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px; 
    padding: 0 10px; 
    overflow-x: auto; 
    scrollbar-width: thin; 
    -webkit-overflow-scrolling: touch; 
}

.sheet-tabs-container::-webkit-scrollbar {
    height: 8px;
}

.sheet-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sheet-tabs-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sheet-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.sheet-tab-btn {
    padding: 10px 15px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background-color: white;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0; 
}

.sheet-tab-btn:hover {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.sheet-tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
}

.content-display-area {
    margin-top: 20px;
    text-align: left; 
    overflow-x: auto; 
}

.excel-table-viewer {
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 20px;
    font-size: 0.9em;
    color: var(--text-dark);
}

.excel-table-viewer th,
.excel-table-viewer td {
    border: 1px solid #ddd; 
    padding: 8px; 
    text-align: left; 
    white-space: nowrap; 
}

.excel-table-viewer th {
    background-color: var(--primary-light); 
    color: white; 
    font-weight: 600;
    position: sticky; 
    top: 0; 
    z-index: 1; 
}

.excel-table-viewer tbody tr:nth-child(even) {
    background-color: #f9f9f9; 
}

.excel-table-viewer tbody tr:hover {
    background-color: #f1f1f1; 
}

.sticky-cell-b {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: inherit; 
    border-right: 2px solid var(--primary-color);
}

.excel-table-viewer tbody tr:nth-child(odd) .sticky-cell-b {
    background-color: #fff; 
}

.excel-table-viewer tbody tr:nth-child(even) .sticky-cell-b {
    background-color: #f9f9f9; 
}

.excel-table-viewer th.sticky-cell-b {
    z-index: 3; 
    background-color: var(--primary-light);
}

.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    padding-top: 60px;
}
.modal-content {
    background-color: #fefefee6; 
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: animatezoom 0.6s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(8px); 
}
@keyframes animatezoom {
    from {transform: scale(0.8); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}
.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1;
}
.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}
.modal-content h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.8rem;
    text-align: center;
}
.modal-content p {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.1rem;
}
#modalBodyContent {
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
}
.modal-body-content { 
     width: 100%;
     padding: 0 10px;
     box-sizing: border-box;
     display: flex;
     flex-direction: column; 
     align-items: center;
     margin-bottom: 15px;
     gap: 10px; 
}

.modal-body-content input[type="text"],
.modal-body-content input[type="password"],
.modal-body-content input[type="email"] {
    padding: 12px 15px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    max-width: 300px; 
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.modal-body-content input:focus {
     outline: none;
     border-color: var(--accent-color);
     box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

#modalSubjectDetails {
     max-height: 300px;
     overflow-y: auto;
     margin-top: 15px;
     margin-bottom: 20px;
     border: 1px solid #ddd;
     border-radius: 8px;
     background-color: #fff;
     width: 100%;
}
#modalSubjectDetails table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
#modalSubjectDetails th,
#modalSubjectDetails td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    font-size: 0.85rem;
}
#modalSubjectDetails th {
    background-color: var(--primary-light);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}
#modalSubjectDetails colgroup {
    display: table-column-group;
}
#modalSubjectDetails col:nth-child(1) {
    width: 20%;
}
#modalSubjectDetails col:nth-child(2) {
    width: 40%;
}
#modalSubjectDetails col:nth-child(3) {
    width: 20%;
}
#modalSubjectDetails col:nth-child(4) {
    width: 20%;
}
#modalSubjectDetails tr:nth-child(even) {
    background-color: #f9f9f9;
}
#modalSubjectDetails tr:hover {
     background-color: #f1f1f1;
}
#modalSubjectDetails tr.grade-e-row {
    background-color: var(--e-grade-background);
}
#modalSubjectDetails tr.grade-e-row:nth-child(even) {
     background-color: var(--e-grade-background);
}
#modalSubjectDetails tr.grade-e-row:hover {
     background-color: #ffcccc;
}
#modalSubjectDetails tbody tr.overall-row {
    display: none;
}
.overall-details {
    margin-top: 10px;
    padding: 10px;
    background-color: #f1f1f1;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 0.95rem;
    color: var(--text-dark);
    width: 100%;
}
.overall-row-container {
    display: flex;
    flex-direction: column;
}
.overall-row-label {
    font-weight: bold;
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--secondary-color);
    text-align: center;
}
.overall-row-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}
.overall-result-row {
    grid-template-columns: 1fr;
    margin-bottom: 8px;
}
.overall-result-row .overall-item {
     grid-column: span 1;
}
.overall-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fff;
}
.overall-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 3px;
    text-align: center;
    width: 100%;
}
.overall-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
    word-break: break-word;
}
.overall-row-grid:not(.overall-result-row) .overall-item:nth-child(-n+3) .overall-value {
    color: var(--primary-color);
}
.overall-row-grid:not(.overall-result-row) .overall-item:nth-child(n+4) .overall-value {
    color: var(--secondary-color);
}
.result-status.pass { color: var(--result-pass); }
.result-status.comp { color: var(--result-comp); }
.result-status.compartment { color: var(--result-comp); }
.result-status.repeat { color: var(--result-repeat); }
.result-status.abst { color: var(--result-abst); }
.result-status:not(.pass):not(.comp):not(.compartment):not(.repeat):not(.abst) { color: var(--result-unknown); }
.compartment-subjects-grid {
    grid-template-columns: 1fr;
    margin-top: 8px;
}
.compartment-item {
    grid-column: span 1;
     padding: 6px;
     border: 1px solid #eee;
     border-radius: 5px;
     background-color: #fff;
     text-align: left;
}
.compartment-item .overall-label {
    text-align: center;
    width: 100%;
}
.compartment-list {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
     width: 100%;
}
.compartment-list div {
    margin-bottom: 2px;
}
.compartment-list div:last-child {
    margin-bottom: 0;
}

.student-names-list {
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
}

.student-names-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
}

.student-names-list li {
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 1rem;
    color: var(--text-dark);
    transition: background-color 0.3s ease;
}

.student-names-list li:last-child {
    border-bottom: none;
}

.student-names-list li:hover {
    background-color: #f9f9f9;
}

#modalSubjectStats,
#modalGradeDistribution {
    margin-top: 10px;
}

#modalSubjectStats .overall-row-grid,
#modalGradeDistribution .overall-row-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.grade-distribution-grid {
     grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
}

#modalSubjectStats .overall-item,
#modalGradeDistribution .overall-item {
     padding: 8px;
     border: 1px solid #ccc;
     box-shadow: 0 2px 5px rgba(0,0,0,0.05);
     background-color: #f8f9fa;
}

#modalSubjectStats .overall-label,
#modalGradeDistribution .overall-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

#modalSubjectStats .overall-value,
#modalGradeDistribution .overall-value {
     font-size: 1rem;
     font-weight: 700;
     color: var(--primary-color);
}

.modal-excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    color: var(--text-dark);
    margin-top: 15px;
    max-height: 400px;
    overflow: auto;
    display: block;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.modal-excel-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.modal-excel-table th,
.modal-excel-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    white-space: nowrap;
}

.modal-excel-table th {
    background-color: var(--primary-light);
    color: white;
    font-weight: 600;
}

.modal-excel-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.modal-excel-table tbody tr:hover {
    background-color: #f1f1f1;
}

.sticky-cell-b-modal {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: inherit; 
    border-right: 2px solid var(--primary-color);
}

.modal-excel-table tbody tr:nth-child(odd) .sticky-cell-b-modal {
    background-color: #fff; 
}

.modal-excel-table tbody tr:nth-child(even) .sticky-cell-b-modal {
    background-color: #f9f9f9; 
}

.modal-excel-table th.sticky-cell-b-modal {
    z-index: 3;
    background-color: var(--primary-light);
}

@media (max-width: 600px) {
    .overall-row-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 6px;
    }
     .overall-item {
         margin-bottom: 4px;
         padding: 5px;
     }
     .overall-row-grid .overall-item:last-child,
     .overall-row-grid .overall-item:nth-last-child(2),
     .overall-row-grid .overall-item:nth-last-child(3) {
         margin-bottom: 0;
     }
    .overall-result-row {
         grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
         gap: 6px;
         margin-bottom: 8px;
    }
    .overall-result-row .overall-item {
         grid-column: span 1;
    }
    .overall-result-row .compartment-subjects {
         grid-column: span 1;
    }
    .overall-details {
        padding: 8px;
        font-size: 0.9rem;
    }
     .overall-row-label {
         font-size: 1rem;
         margin-bottom: 6px;
     }
     .overall-label {
         font-size: 0.8rem;
         margin-bottom: 2px;
     }
     .overall-value {
         font-size: 0.9rem;
     }
     .compartment-item {
         padding: 5px;
    }
     .compartment-list {
         font-size: 0.85rem;
     }
     .modal-content h2 {
         font-size: 1.6rem;
     }
     .modal-content p {
         font-size: 1rem;
     }
     .student-names-list li {
         font-size: 0.9rem;
         padding: 6px 10px;
     }
     #modalBodyContent {
         padding: 0 5px;
     }
     .student-names-list {
         padding: 0 5px;
     }

    #modalSubjectStats .overall-row-grid,
    #modalGradeDistribution .overall-row-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
    }
     .grade-distribution-grid {
         grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
     }
    #modalSubjectStats .overall-item,
    #modalGradeDistribution .overall-item {
        padding: 6px;
    }
     #modalSubjectStats .overall-label,
    #modalGradeDistribution .overall-label {
        font-size: 0.8rem;
    }
    #modalSubjectStats .overall-value,
    #modalGradeDistribution .overall-value {
        font-size: 0.9rem;
    }
}
@media (max-width: 480px) {
     .modal-excel-table {
        font-size: 0.75em;
     }
     .modal-excel-table th,
     .modal-excel-table td {
         padding: 5px;
     }
    .overall-row-grid {
         grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
         gap: 4px;
    }
     .overall-item {
         padding: 4px;
     }
     .overall-label {
         font-size: 0.75rem;
     }
     .overall-value {
         font-size: 0.85rem;
     }
     .overall-details {
         padding: 6px;
     }
      .overall-row-label {
         font-size: 0.95rem;
     }
     .compartment-item {
         padding: 4px;
     }
     .compartment-list {
         font-size: 0.8rem;
     }
     .modal-content h2 {
         font-size: 1.4rem;
     }
     .modal-content p {
         font-size: 0.9rem;
     }
     .student-names-list li {
         font-size: 0.85rem;
         padding: 6px 10px;
     }
      #modalBodyContent {
         padding: 0;
     }
     .student-names-list {
         padding: 0;
     }

    #modalSubjectStats .overall-row-grid,
    #modalGradeDistribution .overall-row-grid {
         grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
         gap: 6px;
    }
     .grade-distribution-grid {
         grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
     }
    #modalSubjectStats .overall-item,
    #modalGradeDistribution .overall-item {
        padding: 5px;
    }
     #modalSubjectStats .overall-label,
    #modalGradeDistribution .overall-label {
        font-size: 0.7rem;
    }
    #modalSubjectStats .overall-value,
    #modalGradeDistribution .overall-value {
        font-size: 0.8rem;
    }
}
