:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-dark: #0f172a;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.username {
    font-weight: 600;
    color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content.large {
    max-width: 800px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
}

.close-btn:hover {
    color: var(--text);
}

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

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.info-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.actions .btn {
    flex: 1;
}

/* Grades */
.grades-section {
    background: var(--card);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.grades-section h2 {
    margin-bottom: 1.5rem;
}

.grades-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.grade-category {
    margin-bottom: 2rem;
}

.grade-category h3 {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

.grade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.grade-course {
    flex: 1;
    font-weight: 500;
}

.grade-type {
    color: var(--text-light);
    font-size: 0.875rem;
}

.grade-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.125rem;
}

.grade-date {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-left: 1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
}

/* Course Cards */
.course-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.course-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.course-count {
    font-size: 0.875rem;
    color: var(--text-light);
    background: var(--card);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.course-letter-grade {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(135deg, #EBF4FF 0%, #E0EAFF 100%);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

.course-grades {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-grade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--card);
    border-radius: 6px;
}

.grade-type-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-light);
}

.grade-value-inline {
    font-weight: 700;
    color: var(--primary);
    margin-right: 1rem;
}

.grade-date-inline {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Settings */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

.notification-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.notification-header {
    margin-bottom: 1rem;
}

.notification-fields {
    display: none;
    margin-top: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions {
        flex-direction: column;
    }

    .grade-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Admin Panel */
.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-user-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.admin-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.admin-user-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-light);
}

.admin-user-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-stat {
    background: var(--card);
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
}

.admin-stat .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.admin-stat .stat-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.admin-user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

.loading-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}
