* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%);
    min-height: 100vh;
    color: #1f2937;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background: #4f46e5;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: white;
    display: flex;
    align-items: center;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    display: none;
}

/* Navigation Tabs */
.nav-tabs {
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-button:hover {
    color: #1f2937;
    background: #f9fafb;
}

.tab-button.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: #eef2ff;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-header svg {
    color: #4f46e5;
}

.card-header h2 {
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-info p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
}

.stat-icon {
    padding: 0.75rem;
    border-radius: 0.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    ring: 2px;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input.error,
.form-group select.error {
    border-color: #ef4444;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.error-message {
    display: block;
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.25rem;
}

.readonly-input {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: #4f46e5;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-success:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: #4f46e5;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.btn-link:hover {
    color: #4338ca;
}

/* Student Info */
.student-info {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.student-info h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.info-grid p span {
    font-weight: 500;
}

/* Grade Preview */
.grade-preview {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.grade-preview p:first-child {
    font-size: 0.875rem;
    color: #065f46;
    margin-bottom: 0.25rem;
}

.grade-preview p:last-child {
    font-size: 1.875rem;
    font-weight: 700;
    color: #047857;
}

/* Students List */
.students-list {
    max-height: 600px;
    overflow-y: auto;
}

.student-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s;
}

.student-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.student-details {
    flex: 1;
}

.student-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.student-icon {
    background: #eef2ff;
    padding: 0.5rem;
    border-radius: 9999px;
    color: #4f46e5;
}

.student-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.student-info-list {
    margin-left: 2.5rem;
}

.student-info-list p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.student-info-list span {
    font-weight: 500;
}

.btn-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state svg {
    margin: 0 auto 0.75rem;
    opacity: 0.5;
}

/* Grade Distribution */
.grade-bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.grade-label {
    width: 4rem;
    font-weight: 600;
    color: #374151;
}

.bar-container {
    flex: 1;
    background: #e5e7eb;
    border-radius: 9999px;
    height: 1.5rem;
    overflow: hidden;
}

.bar-fill {
    background: #4f46e5;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    transition: width 0.3s;
}

.bar-percentage {
    width: 4rem;
    text-align: right;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Top Performers */
.performer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
}

.performer-item:hover {
    background: #f3f4f6;
}

.performer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rank-badge {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.875rem;
}

.rank-1 { background: #eab308; }
.rank-2 { background: #9ca3af; }
.rank-3 { background: #fb923c; }
.rank-other { background: #d1d5db; color: #6b7280; }

.performer-details h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.125rem 0;
}

.performer-details p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.performer-score {
    font-size: 1.125rem;
    font-weight: 700;
    color: #4f46e5;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f9fafb;
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    white-space: nowrap;
}

tr:hover {
    background: #f9fafb;
}

.student-cell {
    font-weight: 500;
    color: #1f2937;
}

.student-roll {
    font-size: 0.875rem;
    color: #6b7280;
}

.grade-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.grade-a { background: #d1fae5; color: #065f46; }
.grade-b { background: #dbeafe; color: #1e40af; }
.grade-c { background: #fef3c7; color: #92400e; }
.grade-d { background: #fed7aa; color: #9a3412; }
.grade-f { background: #fee2e2; color: #991b1b; }

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.view-header h2 {
    margin: 0;
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.filter-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
}

.filter-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.filter-info span {
    font-size: 0.875rem;
    color: #4338ca;
}

/* Summary Stats */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-card {
    padding: 1rem;
    border-radius: 0.5rem;
}

.summary-card p:first-child {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.summary-card p:last-child {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-blue { background: #dbeafe; }
.summary-blue p:last-child { color: #1e40af; }

.summary-green { background: #d1fae5; }
.summary-green p:last-child { color: #065f46; }

.summary-purple { background: #e9d5ff; }
.summary-purple p:last-child { color: #6b21a8; }

.summary-orange { background: #fed7aa; }
.summary-orange p:last-child { color: #9a3412; }

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    margin-top: 3rem;
}

.footer p {
    text-align: center;
    padding: 1.5rem 0;
    color: #6b7280;
}

/* Responsive Design */
@media (min-width: 640px) {
    .subtitle {
        display: block;
    }
    
    .logo-text h1 {
        font-size: 1.875rem;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .view-header .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
