body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; */
    background-color: #f4f7fa;
    margin: 0;
    padding: 10px;
    color: #333;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px; /* Slightly larger, more modern radius */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow-x: auto; /* For horizontal scroll on small screens */
    margin-top: 70px; /* Clearance for fixed nav */
    position: relative;
}
h1 {
    color: #2c3e50;
    margin-bottom: 30px;
}
/* NEW: Grades Section Header */
.grades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* For mobile */
    gap: 15px;
}
.grades-header h1 {
    margin: 0;
    font-size: 28px;
}
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* NEW: Grade Table Card */
.grade-table-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
    padding: 10px;
    overflow-x: auto;
}
/* NEW: Grades Footer */
.grades-footer {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}
button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 7.5rem; /* Added for consistency on main buttons */
}
button:hover {
    background-color: #2980b9;
}
#addSubject {
    background-color: #3498db; /* Changed color to distinguish from Calculate */
    position: fixed; /* Make it float */
    bottom: 60px; /* Position it above the chat button */
    left: 10px;
    padding: 12px 20px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    z-index: 150;
    border-radius: 50px; /* Make it pill-shaped */
    display: flex; /* Align icon and text */
    align-items: center;
    justify-content: center;
    gap: 8px; /* Space between icon and text */
    animation: glowing-blue 2.5s infinite ease-in-out; /* Add the blue glowing animation */
}
#addSubject:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    animation-play-state: paused; /* Pause the glow on hover */
}
#calculate {
    background-color: #27ae60;
    position: fixed; /* Make it float */
    bottom: 0px; /* Position it above the chat button */
    left: 10px;
    padding: 12px 20px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    z-index: 150; /* Ensure it's above other content but below modals */
    border-radius: 50px; /* Make it pill-shaped */
    animation: glowing 2.5s infinite ease-in-out; /* Add the glowing animation */
}
#calculate:hover {
    background-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
    animation-play-state: paused; /* Pause the glow on hover for a stable effect */
}
/* NEW: Keyframes for the glowing effect */
@keyframes glowing {
    0% { box-shadow: 0 4px 20px rgba(39, 174, 96, 0.4); }
    50% { box-shadow: 0 8px 35px rgba(39, 174, 96, 0.8); }
    100% { box-shadow: 0 4px 20px rgba(39, 174, 96, 0.4); }
}
/* NEW: Keyframes for the blue glowing effect */
@keyframes glowing-blue {
    0% { box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4); }
    50% { box-shadow: 0 8px 35px rgba(52, 152, 219, 0.8); }
    100% { box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4); }
}
/* Download button styles */
.download-buttons {
    display: flex;
    gap: 10px;
}
#downloadBtn {
    background-color: #f39c12;
}
#downloadBtn:hover {
    background-color: #e67e22;
}
#pdfBtn, #scanGradesBtn {
    background-color: #9b59b6;
}
#pdfBtn:hover {
    background-color: #8e44ad;
}
table {
    width: 100%;
    border-collapse: separate; /* Changed for rounded corners */
    border-spacing: 0;
    margin-bottom: 20px;
    font-size: 13px;
}
th, td {
    padding: 10px 8px; /* Reduced padding */
    text-align: center;
    border-bottom: 1px solid #e9ecef; /* Use only bottom borders for a cleaner look */
    vertical-align: middle; /* Better alignment */
}
th {
    background-color: #34495e;
    color: white;
    position: sticky;
    top: 0;
    font-size: 12px; /* Smaller for a more refined header */
    text-transform: uppercase; /* Professional look */
    letter-spacing: 0.5px;
    border-bottom: 2px solid #3498db; /* Accent border */
}
/* Add rounded corners to the first and last header cells */
th:first-child {
    border-top-left-radius: 8px;
}
th:last-child {
    border-top-right-radius: 8px;
}
.subject-th {
    background-color: #2c3e50;
    text-align: left;
}
input[type="text"],
input[type="number"] {
    width: 75px; /* Reduced width */
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    text-align: center;
    font-size: 13px;
    transition: border-color 0.3s, box-shadow 0.3s; /* Smooth focus effect */
}
input[type="text"] {
    width: 130px;
}
/* Red highlight for scores below threshold */
input.low-score {
    background-color: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
}
/* Style for input focus */
input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
.remove-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 0.2rem;
    cursor: pointer;
    font-size: 12px;
    margin-left: 5px;
}
.remove-btn:hover {
    background-color: #c0392b;
}
.average-cell, .period-avg-row td {
    background-color: #f8f9fa; /* Consistent light background for all averages */
    font-weight: bold;
    color: #27ae60;
    font-size: 15px;
}
.average-cell small {
    font-size: 12px;
    color: #666;
    display: block;
}
.period-avg-row {
    font-weight: bold;
}
.overall-average {
    background-color: #d5f4e6;
    font-size: 18px; /* Slightly increased for emphasis */
    color: #27ae60;
}
.result {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: right;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    grid-column: 3 / 4;
}
.error {
    color: #e74c3c;
    text-align: left;
    font-weight: 500;
    grid-column: 1 / 2;
    padding: 10px;
    background: #fff0f0;
    border-radius: 5px;
}
/* Navigation bar styling */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #2c3e50;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 3.75rem;
}
.nav-logo a {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
}
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}
.nav-menu li a {
    color: white;
    text-decoration: none;
    padding: 0.625rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.nav-menu li a:hover {
    background-color: #34495e;
}
.nav-profile {
    display: flex;
    align-items: center;
    position: relative;
}
.profile-pic {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #3498db;
    transition: transform 0.2s;
}
.profile-pic:hover {
    transform: scale(1.1);
}
/* Profile dropdown - MINIMIZED VERSION */
.profile-dropdown {
    position: absolute;
    top: 2.8rem; /* Reduced from 50px for tighter fit */
    right: 0;
    background: #34495e;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); /* Slightly tighter shadow for minimalism */
    display: none; /* Hidden initially */
    min-width: 120px; /* Reduced from 150px */
    z-index: 101;
}
.profile-dropdown.active {
    display: block;
}
.profile-dropdown a {
    display: block;
    color: white;
    padding: 0.5rem 0.75rem; /* Reduced from 10px 15px for compact items */
    text-decoration: none;
    transition: background 0.3s;
    font-size: 14px; /* Added: Slightly smaller font for density */
}
.profile-dropdown a:hover {
    background: #2c3e50;
}
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer; /* Make it obvious it's clickable */
}
.hamburger span {
    width: 1.5rem;
    height: 0.2rem;
    background-color: white;
    margin: 0.2rem 0;
    transition: 0.3s;
} /* Spacing bars */
/* Mobile: Hamburger menu - FIXED FOR REFRESH */
@media (max-width: 768px) {
    .grades-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .controls {
        flex-direction: column;
        gap: 15px; /* Increased gap */
    }
    input[type="text"], input[type="number"] {
        width: 80px; /* Increased from 50px for better mobile touch */
    }
    input[type="text"] {
        width: 120px; /* Increased from 100px */
    }
    th, td {
        padding: 12px; /* Increased from 6px for mobile */
        font-size: 14px; /* Slightly larger on mobile */
    }
    button {
        padding: 12px 20px; /* Scaled down but still larger than original */
        font-size: 16px; /* Scaled down */
        min-width: 100px; /* Adjusted for mobile */
    }
    .remove-btn {
        padding: 6px 12px; /* Scaled for mobile */
        font-size: 14px;
    }
    .small-btn {
        padding: 10px 18px; /* Scaled for mobile */
        font-size: 16px;
    }
    .grades-footer {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background-color: #2c3e50;
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        padding: 20px 0;
        z-index: 99; /* Below profile dropdown */
    }
    .nav-menu.active {
        left: 0;
    }
    .hamburger {
        display: flex;
    }
    .nav-profile {
        margin-left: auto;
    }
    /* NEW: Landscape mobile fix for table overflow */
    @media (max-width: 768px) and (orientation: landscape) {
        .container { padding: 10px; }
        th, td { padding: 8px; font-size: 12px; }
        input[type="number"], input[type="text"] { width: 60px; padding: 6px; font-size: 14px; }
    }
}
/* UPDATED: Help Section Styling */
.help-header {
    text-align: center;
    margin-bottom: 40px;
}
.help-header h1 {
    margin-bottom: 5px;
}
.help-header p {
    font-size: 18px;
    color: #666;
    margin-top: 0;
}
.help-content {
    max-width: 800px;
    margin: 0 auto;
}
.help-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}
.help-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}
.help-card h2 {
    background: #f8f9fa;
    color: #2c3e50;
    padding: 20px;
    margin: 0;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s;
    position: relative;
}
.help-card h2:hover {
    background-color: #e9ecef;
}
.accordion-icon {
    margin-left: auto;
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.4s ease;
}
.accordion-icon::before,
.accordion-icon::after {
    content: '';
    position: absolute;
    background-color: #3498db;
    transition: transform 0.4s ease;
}
.accordion-icon::before { /* Vertical bar */
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}
.accordion-icon::after { /* Horizontal bar */
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}
.accordion-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease;
}
.accordion-content.active {
    grid-template-rows: 1fr;
}
.accordion-content > div {
    overflow: hidden;
}
.accordion-content ol, .accordion-content ul, .accordion-content dl {
    padding-left: 20px;
}
.accordion-content a {
    color: #3498db;
    text-decoration: none;
}
.accordion-content a:hover {
    text-decoration: underline;
}
.accordion-content.active + h2 .accordion-icon, /* Sibling selector for icon rotation */
.help-card h2.active .accordion-icon {
    transform: rotate(135deg);
}
.help-card h2.active .accordion-icon::before {
    transform: translateX(-50%) rotate(90deg);
}
.back-btn {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 0.9375rem 1.875rem; /* Matches global button increase */
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px; /* Matches global */
    margin-top: 20px;
    display: block;
    margin-left: auto;
}
.back-btn:hover {
    background-color: #229954;
}
/* Smooth transitions for sections */
section {
    transition: opacity 0.3s ease;
    opacity: 1;
}
/* Hide all sections by default, show the active one */
section:not(.active) {
    display: none;
}
/* UPDATED: Settings Section Styling */
.settings-header {
    text-align: center;
    margin-bottom: 40px;
}
.settings-header h1 {
    margin-bottom: 5px;
}
.settings-header p {
    font-size: 18px;
    color: #666;
    margin-top: 0;
}
.settings-content {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}
.setting-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}
.setting-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.07);
}
.setting-card h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 18px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}
.setting-card p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    flex-grow: 1; /* Pushes buttons to the bottom */
}
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.setting-item label {
    font-weight: 500;
    color: #495057;
}
.setting-input-group {
    display: flex;
    gap: 10px;
}
.setting-input-group input {
    flex-grow: 1;
    width: 100%; /* Take available space */
}
.setting-card input[type="number"],
.setting-card input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.setting-card input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
.small-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap; /* Prevent button text from wrapping */
}
.small-btn:hover {
    background-color: #2980b9;
}
.danger-zone {
    border-left: 4px solid #e74c3c;
}
.danger-zone h3 {
    color: #e74c3c;
}
.clear-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    margin-top: 10px;
}
.clear-btn:hover {
    background-color: #c0392b;
}
.warning-btn {
    background-color: #f39c12;
}
.warning-btn:hover {
    background-color: #e67e22;
}
.small-text {
    font-size: 12px;
    color: #666; /* Darkened */
    margin-top: 5px;
}
/* Toggle switch styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;    
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: #27ae60;
}
input:checked + .toggle-slider:before {
    transform: translateX(26px);
}
/* Dark mode overrides */
body.dark-mode {
    background-color: #2c3e50;
    color: #ecf0f1;
}
body.dark-mode .container {
    background: #34495e;
    color: #ecf0f1;
}
body.dark-mode table th {
    background-color: #1a252f;
}
body.dark-mode .help-card, body.dark-mode .setting-card, body.dark-mode .profile-card, body.dark-mode .contact-card {
    background: #3d566e;
    border-color: #6c757d;
}
body.dark-mode .result { background-color: #1e3a2f; color: #a3e4d7; }
body.dark-mode .error { color: #ff6b6b; }
body.dark-mode .average-cell { background-color: #2d4a3a; color: #a3e4d7; }
body.dark-mode .period-avg-row { background-color: #1e3a2f; }
body.dark-mode input { background-color: #3d566e; border-color: #5a6c7d; color: #ecf0f1; }
body.dark-mode textarea { background-color: #3d566e; border-color: #5a6c7d; color: #ecf0f1; }
body.dark-mode input::placeholder { color: #a0a0a0; opacity: 0.7; } /* Added for better dark mode placeholder visibility */
/* Footer styling */
footer {
    text-align: center;
    padding: 1.25rem;
    color: #666;
    margin-top: 20px;
}
.footer-links a {
    color: #3498db;
    text-decoration: none;
    margin: 0 10px;
}
.footer-links a:hover {
    text-decoration: underline;
}
/* UPDATED: Profile Section Styling */
.profile-header {
    text-align: center;
    margin-bottom: 40px;
}
.profile-header h1 {
    margin-bottom: 5px;
}
.profile-header p {
    font-size: 18px;
    color: #666;
    margin-top: 0;
}
.profile-content {
    max-width: 1000px;
    margin: 0 auto;
}
.profile-info-grid {
    display: none; /* Hidden by default, shown with .active class */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap; /* Allow columns to wrap on smaller screens */
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}
.profile-info-grid.active {
    display: flex;
}
.profile-grid-left {
    flex: 1 1 300px; /* Flex-grow, flex-shrink, and base width */
}
.profile-grid-right {
    flex: 2 1 500px; /* Takes up more space, but can shrink */
}
.change-pic-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #3498db;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
}
.change-pic-btn:hover {
    background: #2980b9;
}
#profileDisplayName {
    margin: 10px 0 5px 0;
    font-size: 22px;
    color: #2c3e50;
}
#profileDisplayEmail {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}
.profile-edit-form {
    display: flex;
    width: 100%;
    gap: 10px;
    margin-bottom: 10px;
}
.profile-edit-form input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}
.session-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}
.secondary-btn {
    background-color: #e9ecef;
    color: #495057;
}
.secondary-btn:hover {
    background-color: #ced4da;
}
.session-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}
.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;    
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-bottom: 10px;
    transition: background-color 0.3s;
}
.session-item:hover {
    background-color: #e9ecef;
}
.session-item span {
    font-size: 14px;
}
.session-item div {
    display: flex;
    gap: 8px;
}
.session-card-info p {
    font-size: 13px; /* Slightly smaller for better fit */
    color: #666;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.stat-item {
    background: white;
    border: 1px solid #e9ecef;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.stat-item div:first-child {
    font-size: 14px;
    color: #667;
}
.stat-value {
    font-size: 22px;
    font-weight: bold;
    color: #27ae60;
}
/* NEW: Mandatory Login Section Styling */
.login-section {
    position: fixed;
    inset: 0;
    background-color: #f4f7fa;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
body.dark-mode .login-section {
    background-color: #2c3e50;
}
.auth-card {
    background: #fdfdff;
    padding: 30px 40px;
    border-radius: 12px;
    border: 1px solid #e0e6ec;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    text-align: center;
    width: 100%;
    max-width: 420px;
}
.auth-card h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #2c3e50;
}
.auth-card p {
    margin: 0 0 30px 0;
    color: #667;
}
/* NEW: Chart container styling */
.chart-container {
    position: relative;
    margin: 20px 0;
    height: 300px; /* Give canvas a defined height */
}
.charts-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (max-width: 992px) { /* Changed breakpoint for better tablet view */
    .profile-info-grid {
        flex-direction: column; /* Stack columns vertically */
    }
}
/* NEW: QR Scan Modal Styling */
.qr-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 95%;
    max-width: 400px;
    text-align: center;
    position: relative;
}
.qr-modal video {
    width: 100%;
    max-width: 300px;
    border: 2px solid #ddd;
    border-radius: 5px;
}
.qr-status {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}
.qr-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}
/* NEW: Styles for the QR Display Modal */
#qrDisplayCanvas {
    margin: 20px auto;
    display: block;
    border: 5px solid white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    max-width: 100%;
}
.qr-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}
/* UPDATED: Auth Form Styling */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}
.auth-form .form-group {
    display: flex;
    flex-direction: column;
}
.auth-form label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}
.auth-form input { /* Inherits from contact form, which is good */
    font-size: 15px;
}
.auth-form .submit-btn {
    margin-top: 10px;
    width: 100%;
}
.auth-toggle {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #667;
}
.auth-toggle-btn {
    background: none;
    color: #3498db;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    padding: 0;
}
.auth-error {
    color: #e74c3c;
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
}
/* Contact section styling */
.contact-section h1 {
    margin-bottom: 10px;
}
.contact-intro {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 18px;
}
.contact-content {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}
.contact-form-container {
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.contact-form {
    display: grid;
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
.contact-form textarea {
    height: 120px;
    resize: vertical;
}
.contact-info-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.contact-info-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.contact-info-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}
.contact-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 16px;
}
.contact-info-item a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}
.contact-info-item a:hover {
    text-decoration: underline;
}
.quick-link-btn {
    display: block;
    background: #e9ecef;
    color: #495057;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}
.quick-link-btn:hover {
    background-color: #3498db;
    color: white;
}
.submit-btn {
    background-color: #27ae60;
    padding: 15px 30px; /* Matches global increase */
    font-size: 18px; /* Matches global */
}
.submit-btn:hover {
    background-color: #229954;
}
@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .charts-wrapper {
        grid-template-columns: 1fr;
    }
}

/* NEW: Assistant styling */
.ai-section {
    padding: 20px 0;
}
.ai-content {
    max-width: 800px;
    margin: 0 auto;
}
.ai-chat-container {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    height: 500px;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}
.ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: white;
}
.ai-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 5px;
}
.ai-message.user {
    background: #235575;
    color: white;
    text-align: right;
}
.ai-message.ai {
    background: #e8f4fd;
    color: #2c3e50;
}
.ai-message .retry-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 12px;
}
.ai-message .retry-btn:hover {
    background: #229954;
}
.ai-chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
}
.ai-chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
}
.ai-chat-input button {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}
.ai-chat-input button:hover {
    background: #229954;
}
.ai-status {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}
/* UPDATED: Floating Assistant Widget - USE ONLY AI Chat.png */
.floating-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px;
    height: auto; /* Allow height to adjust based on content */
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 200;
    display: flex;
    flex-direction: column; /* Arrange items vertically */
    align-items: center;
    justify-content: center;
    padding: 0; /* Remove default button padding */
    transition: transform 0.3s ease; /* Add transition for smooth scaling */
}
.floating-chat-toggle:hover {
    background: none; /* Explicitly remove background on hover */
    transform: scale(1.1); /* Make it 10% larger on hover */
}
.floating-chat-toggle img {
    width: 70px; /* Set explicit width for the image */
    height: auto; /* Maintain aspect ratio */
    border-radius: 0; /* Removed border-radius to show original image shape */
    object-fit: cover;
    opacity: 1; /* Ensure image is fully opaque */
}
.floating-chat-label {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin-top: 4px;
    padding: 2px 5px;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.3s ease; /* Smooth fade transition */
}
.floating-chat-window {
    position: fixed;
    bottom: 120px; /* Increased bottom offset to avoid overlap with toggle */
    right: 20px;
    width: 300px;
    height: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 199;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #ddd;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.floating-chat-toggle:hover .floating-chat-label {
    opacity: 1; /* Fade in on hover */
}
.floating-chat-window.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}
.floating-chat-header {
    background: #3498db;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.floating-chat-header h4 {
    margin: 0;
    font-size: 16px;
}
.floating-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}
.floating-chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #f8f9fa;
}
.floating-chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
    background: white;
}
.floating-chat-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}
.floating-chat-input button {
    padding: 8px 12px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
}
.floating-chat-input button:hover {
    background: #229954;
}
.floating-chat-status {
    font-size: 12px;
    text-align: center;
    padding: 5px;
    color: #666;
    background: #f8f9fa;
}
.floating-chat-full-link {
    text-align: center;
    padding: 5px;
    font-size: 12px;
}
.floating-chat-full-link a {
    color: #3498db;
    text-decoration: none;
}
.floating-chat-full-link a:hover {
    text-decoration: underline;
}
/* Mobile adjustments for floating chat */
@media (max-width: 768px) {
    .floating-chat-toggle {
        width: 60px; /* Slightly smaller for mobile screens */
        bottom: 15px;
        right: 15px;
    }
    .floating-chat-window {
        width: calc(100vw - 30px);
        height: 70vh; /* Adjust height for mobile */
        bottom: 85px; /* Position above the smaller toggle button */
        right: 15px;
        max-height: 500px; /* Add max-height to prevent it from being too tall */
    }
    .floating-chat-header h4 {
        font-size: 14px;
    }
}
body.dark-mode .floating-chat-input {
    background: #34495e;
}
body.dark-mode .floating-chat-input input {
    background: #3d566e;
    border-color: #5a6c7d;
    color: #ecf0f1;
}
body.dark-mode .floating-chat-status {
    color: #a0a0a0;
    background: #3d566e;
}
.grade-scan-progress {
    width: 100%;
    background-color: #f3f3f3;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    height: 30px;
}
.ocr-progress-bar {
    width: 0;
    height: 100%;
    background-color: #27ae60;
    transition: width 0.4s ease;
}
.ocr-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 30px;
    color: #333;
}
body.dark-mode .grade-table-card {
    background: #34495e;
    border-color: #4a5c6d;
}
/* NEW: Semester grouping styles */
.sem1-th {
    background-color: #3498db !important; /* Blue for 1st Sem */
}
.sem2-th {
    background-color: #27ae60 !important; /* Green for 2nd Sem */
}
.sem-avg-th {
    background-color: #9b59b6 !important; /* Purple for avgs */
}
th:hover::after {
    content: attr(data-tooltip); /* Tooltips for semesters */
    position: absolute;
    background: #333;
    color: white;
    padding: 5px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}
.sem1-avg {
    background-color: #ebf3fd !important; /* Light blue for 1st sem avg */
}
.sem2-avg {
    background-color: #d5f4e6 !important; /* Light green for 2nd sem avg */
}