:root {
    --primary-color: #7c3aed; /* Vibrant Purple */
    --primary-light: #8b5cf6;
    --primary-dark: #6d28d9;
    --bg-color: #f8fafc; /* Very light gray/white */
    --surface-color: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(124, 58, 237, 0.1), 0 4px 6px -2px rgba(124, 58, 237, 0.05);
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.school-logo {
    height: 32px;
    width: auto;
}

.logo {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    white-space: nowrap;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: var(--transition);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    transition: max-width 0.3s ease;
}

.main-content.wide {
    max-width: 1400px;
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(124, 58, 237, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
    width: 100%;
    height: 120px;
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius-md);
    background-color: rgba(124, 58, 237, 0.03);
    transition: var(--transition);
}

.file-upload-wrapper:hover {
    background-color: rgba(124, 58, 237, 0.08);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
    z-index: 1;
}

.file-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* View Specific */
.login-card {
    max-width: 450px;
    margin: 4rem auto;
    text-align: center;
    border: none;
    background: linear-gradient(145deg, #ffffff, #f3f4f6);
    box-shadow: 20px 20px 60px #d1d9e6, -20px -20px 60px #ffffff;
}

.login-card h2 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.login-card p, .upload-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.student-header, .admin-header {
    text-align: center;
    margin-bottom: 1rem;
}

.student-header h2 {
    color: var(--primary-color);
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    margin-bottom: 0.5rem;
}

.score-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.score-cards .card {
    padding: 1rem;
}

.score-cards .score-item {
    padding: 0.4rem 0;
}

@media (max-width: 768px) {
    .score-cards {
        grid-template-columns: 1fr;
    }
}

.score-details {
    margin-top: 1rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.score-item:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.dashboard-grid .card {
    padding: 1rem;
}

.dashboard-grid canvas, #progressChart {
    max-height: 220px;
    width: 100% !important;
}

.chart-card {
    padding: 1rem;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }

.error-msg {
    color: #ef4444;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.success-msg {
    color: #10b981;
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.slide-in {
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

/* Data Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    min-width: 800px; /* Force scroll on small screens */
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: rgba(124, 58, 237, 0.05);
    color: var(--primary-dark);
    font-weight: 600;
}

.data-table tr:hover {
    background-color: rgba(124, 58, 237, 0.02);
}

.text-danger {
    color: #ef4444 !important;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .nav-container {
        padding: 0.8rem 1.5rem;
    }
    
    .logo {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 5rem 2rem;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        gap: 2rem;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-link {
        font-size: 1.1rem;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .login-card {
        margin: 2rem auto;
    }

    .dashboard-grid, .score-cards {
        grid-template-columns: 1fr;
    }

    .data-table th, .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 0.9rem;
    }
    
    .school-logo {
        height: 28px;
    }

    .student-header p {
        font-size: 0.9rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch !important;
    }
}

.footer {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    background-color: #fff;
}
