/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors - Muted Neutral Palette */
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-border-hover: #d1d5db;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;

    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #eff6ff;

    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;

    /* Spacing - Compact */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 10px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 56px;

    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-blue: linear-gradient(135deg, #4FACFE 0%, #00F2FE 100%);
    --gradient-orange: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    --gradient-purple: linear-gradient(135deg, #A8EDEA 0%, #FED6E3 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);


    /* Border & Shadow */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(79, 172, 254, 0.3);
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    overflow-x: hidden;
}

/* App Layout */
#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar-header {
    height: var(--topbar-height);
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--color-primary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    border-radius: 6px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    gap: var(--space-xl);
    z-index: 100;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.term-switcher {
    display: flex;
    gap: var(--space-xs);
    padding: 2px;
    background: var(--color-bg);
    border-radius: 6px;
}

.term-btn {
    padding: var(--space-xs) var(--space-md);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.term-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: var(--space-sm);
    color: var(--color-text-light);
}

.search-box input {
    padding: var(--space-sm) var(--space-sm) var(--space-sm) 36px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: var(--font-size-sm);
    width: 240px;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-btn:hover {
    border-color: var(--color-border-hover);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.profile-menu {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
}

.profile-dropdown-item:hover {
    background-color: var(--color-background);
}

.profile-dropdown-item svg {
    flex-shrink: 0;
}

.profile-dropdown-item span {
    font-size: 14px;
}

.profile-dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 4px 0;
}

/* Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

.page-header {
    margin-bottom: var(--space-xl);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.breadcrumbs a {
    color: var(--color-primary);
    text-decoration: none;
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    border-color: var(--color-border-hover);
    background: var(--color-bg);
}

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

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

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

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-sm {
    padding: 4px var(--space-sm);
    font-size: var(--font-size-xs);
}

.icon-btn {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--color-text);
}

.stat-change {
    font-size: var(--font-size-xs);
    color: var(--color-success);
    margin-top: var(--space-xs);
}

/* Tables */
.table-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height) - 110px);
}

.table-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.table-controls {
    display: flex;
    gap: var(--space-sm);
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

table {
    width: 100;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

thead {
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 10;
}

th {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

tbody tr:hover {
    background: var(--color-bg);
    cursor: pointer;
}

tbody tr:last-child td {
    border-bottom: none;
}


.header-cell {
    min-width: 120px;
    text-align: center;
}

.header-cell a {
    text-decoration: none;
    width: 100%;
}

.score-cell {
    /* min-width: 120px; */
    text-align: center;
}


.score-input {
    width: 60px;
    padding: 2px 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    text-align: center;
    font-size: var(--font-size-sm);
}

.rating-input {
    width: 80px;
    padding: 2px 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    text-align: center;
    font-size: var(--font-size-sm);
}

.score-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* Forms */
.select,
select,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    transition: all 0.2s;
}

.select:focus,
select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.form-help {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-lg);
}

.tab {
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Criteria tabs (right-aligned) */
#criteria-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
}

#criteria-tabs .tab {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    background: var(--color-surface);
    border-bottom: none;
}

#criteria-tabs .tab:hover {
    background: var(--color-bg-secondary);
}

#criteria-tabs .tab.active {
    background: var(--color-primary);
    color: white;
    border-bottom: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--color-surface);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s;
    position: relative;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.2s;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s;
}

.drawer-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.drawer-body {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

/* Toast */
.toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 320px;
    animation: slideInRight 0.3s;
}

.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast-error {
    border-left: 3px solid var(--color-danger);
}

.toast-warning {
    border-left: 3px solid var(--color-warning);
}

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--color-text-muted);
}

.empty-state svg {
    margin: 0 auto var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-xs);
    color: var(--color-text);
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--color-bg) 25%, #f0f0f0 50%, var(--color-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-sm);
}

.skeleton-card {
    height: 120px;
    border-radius: 8px;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.activity-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* Join Link Panel */
.join-panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.join-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.join-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: monospace;
    font-size: var(--font-size-sm);
}

/* Grading Component */
.component-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.component-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.component-name {
    font-weight: 600;
}

.weight-input {
    width: 80px;
    text-align: right;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 120px 140px auto;
    gap: var(--space-sm);
    align-items: center;
}

/* Chart */
.chart-container {
    padding: var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: var(--space-xl);
}

canvas {
    max-width: 100%;
    height: auto;
}

/* Alert */
.alert {
    padding: var(--space-md);
    border-radius: 6px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: start;
    gap: var(--space-sm);
}

.alert-warning {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    color: #92400e;
}

.alert-info {
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    color: #1e3a8a;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Class Cards */
.filters-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.filters-row {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-end;
}

.filter-group {
    flex: 1;
}

.class-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.class-card {
    background: #ffffff;
    /*linear-gradient(135deg, #2d3748 0%, #1a202c 100%); */
    border-radius: 12px;
    padding: var(--space-xl);
    color: #000;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.class-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.class-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.class-code {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: var(--space-xs);
}

.class-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.class-status.upcoming {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.class-name {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.class-schedule {
    font-size: var(--font-size-sm);
    color: #94a3b8;
    margin-bottom: var(--space-xl);
}

.term-progress-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.term-progress-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: var(--space-md);
}

.term-label {
    font-size: var(--font-size-xs);
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.term-value {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.term-value.completed {
    color: #4ade80;
}

.term-value.in-progress {
    color: #fbbf24;
}

.term-value.pending {
    color: #64748b;
}

.term-status-text {
    font-size: var(--font-size-xs);
    color: #94a3b8;
    text-transform: capitalize;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: var(--space-xs);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-fill.completed {
    background: linear-gradient(90deg, #4ade80, #22c55e);
}

.progress-fill.in-progress {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.class-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.class-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.class-stat svg {
    color: #60a5fa;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: white;
}

/* Utility Classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}

.text-muted {
    color: var(--color-text-muted);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}




.title-wrap {
    display: flex;
    align-items: center;
}

.schedcode {
    margin: 0;
    padding-right: 12px;
    position: relative;
}

/* CSS vertical bar */
.schedcode::after {
    content: "";
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: #000;
    /* adjust color */
}

.right-stack {
    display: flex;
    flex-direction: column;
    padding-left: 12px;
}

.scode {
    font-weight: 600;
    font-size: 16px;
}

.sschdule {
    font-size: 10px;
    color: #666;
}

/* ==================== View Management ==================== */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ==================== Loading View ==================== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ==================== Login View ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    font-size: var(--font-size-2xl);
    color: var(--color-text);
    margin-bottom: 8px;
}

.login-card .text-muted {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
}

.login-card .text-center {
    text-align: center;
}

.login-card .mb-3 {
    margin-bottom: 20px;
}

.login-card .mb-4 {
    margin-bottom: 32px;
}

.login-card .mt-3 {
    margin-top: 20px;
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--color-text-muted);
}

.form-control {
    flex: 1;
    padding: 10px 12px;
    font-size: var(--font-size-base);
    border: 1px solid var(--color-border);
    border-radius: 0 6px 6px 0;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
}

.form-check-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: var(--font-size-base);
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
    text-decoration: none;
}

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

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

.btn-primary:disabled {
    background: var(--color-text-light);
    cursor: not-allowed;
}

.btn-outline-danger {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
}

.btn-outline-danger:hover {
    background: #dc2626;
    color: white;
}

.w-100 {
    width: 100%;
}

.py-2 {
    padding-top: 12px;
    padding-bottom: 12px;
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
}

.me-2 {
    margin-right: 8px;
}

/* ==================== Toast Notifications ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid var(--color-primary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--color-success);
    background: var(--color-success-light);
}

.toast-error {
    border-left-color: var(--color-danger);
    background: var(--color-danger-light);
}

.toast-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-light);
}

.toast-info {
    border-left-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* ==================== Sidebar Footer ==================== */
.sidebar-footer {
    margin-top: auto;
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.sidebar-footer .nav-item {
    color: var(--color-danger);
}

.sidebar-footer .nav-item:hover {
    background: var(--color-danger-light);
}


/* Attendance Buttons - Modern Design */
.attendance-group {
    display: flex;
    gap: 2px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
}

.attendance-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 28px;
    margin: 0;
}

.attendance-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-card-hover);
    transform: scale(1.05);
}

.attendance-btn.present.active {
    background: var(--gradient-success);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.attendance-btn.absent.active {
    background: var(--gradient-orange);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.attendance-btn.excuse.active {
    background: var(--gradient-blue);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.attendance-btn.late.active {
    background: linear-gradient(135deg, #FFB84D 0%, #FFA726 100%);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* Attendance Status Badge (View Mode) */
.attendance-status-badge {
    font-size: 0.75rem;
    padding: 6px 10px;
    font-weight: 600;
    display: inline-block;
    min-width: 70px;
}



/* Attendance Display Button (Edit Mode) */
.attendance-display-btn {
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 6px 12px;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.attendance-display-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Attendance Display Button (View Mode) */
.attendance-display-btn-view {
    font-size: 0.675rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px 10px;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.attendance-display-btn-view:hover {
    filter: brightness(1.1);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Attendance Popup Selector - Modern Dark Theme */
.attendance-popup {
    position: fixed;
    background: var(--bg-dark-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: popupOpen 0.2s forwards;
}

.attendance-popup-grid {
    display: flex;
    gap: 5px;
}

.attendance-popup-option {
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid transparent;
}

.attendance-popup-option.present {
    background: #198754;
}

.attendance-popup-option.absent {
    background: #dc3545;
}

.attendance-popup-option.excuse {
    background: #0dcaf0;
}

.attendance-popup-option.late {
    background: #ffc107;
    color: #000;
}

.attendance-popup-option:hover {
    transform: scale(1.15);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.attendance-popup-option:active {
    transform: scale(0.95);
}

.attendance-popup-option.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.bg-absent {
    background-color: #ef4444;
}

.bg-late {
    background-color: #f59e0b;
}

.bg-present {
    background-color: #10b981;
}

.bg-excuse {
    background-color: #0ea5e9;
}


/* Header Dropdown Styles */
.header-dropdown {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    margin-left: var(--space-sm);
    z-index: 100;
}

.header-dropdown-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
}

.header-dropdown-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.header-dropdown-btn:active {
    transform: scale(0.95);
}

.header-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.header-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-dropdown-item {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: background 0.15s ease;
}

.header-dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.header-dropdown-item:last-child {
    border-radius: 0 0 6px 6px;
}

.header-dropdown-item:hover {
    background: var(--color-bg);
}

.header-dropdown-item.delete {
    color: var(--color-danger);
}

.header-dropdown-item.delete:hover {
    background: var(--color-danger-light);
}

.header-dropdown-item svg {
    flex-shrink: 0;
}

/* Dropdown section styles */
.dropdown-section {
    padding: 8px 0;
}

.dropdown-section-label {
    padding: 4px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-right: 8px;
}

.status-badge.bg-success {
    background: #28a745;
}

.status-badge.bg-danger {
    background: #dc3545;
}

.status-badge.bg-info {
    background: #17a2b8;
}

.status-badge.bg-warning {
    background: #ffc107;
    color: #212529;
}

/* ==================== Enhanced Modal Styles ==================== */
.modal-enhanced {
    max-width: 520px;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.modal-subtitle {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 0;
    margin-top: 2px;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* Enhanced Form Groups */
.form-group-enhanced {
    margin-bottom: var(--space-xl);
}

.form-label-enhanced {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.form-label-enhanced svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.form-help-enhanced {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
    padding-left: 26px;
}

/* Enhanced Form Controls */
.form-control-enhanced {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--font-size-base);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-control-enhanced:hover {
    border-color: var(--color-border-hover);
}

.form-control-enhanced:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light);
    background: white;
}

.form-control-enhanced::placeholder {
    color: var(--color-text-light);
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
}

.select-wrapper:hover .select-arrow {
    color: var(--color-primary);
}

/* Input with Icon/Suffix */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    pointer-events: none;
    background: var(--color-bg);
    padding: 4px 8px;
    border-radius: 4px;
}

.input-with-icon input {
    padding-right: 70px;
}

/* Enhanced Buttons */
.btn-enhanced {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-size: var(--font-size-base);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-enhanced svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-enhanced::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-enhanced:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary.btn-enhanced {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary.btn-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary.btn-enhanced:active {
    transform: translateY(0);
}

.btn-secondary.btn-enhanced {
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary.btn-enhanced:hover {
    background: var(--color-bg);
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
}

.btn-secondary.btn-enhanced:active {
    transform: translateY(0);
}

/* Modal Animation Enhancement */
@keyframes modalScaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-enhanced {
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Input Number Styling */
input[type="number"].form-control-enhanced::-webkit-inner-spin-button,
input[type="number"].form-control-enhanced::-webkit-outer-spin-button {
    opacity: 1;
    height: 40px;
}

input[type="date"].form-control-enhanced {
    position: relative;
}

input[type="date"].form-control-enhanced::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

input[type="date"].form-control-enhanced::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: var(--color-primary-light);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-enhanced {
        max-width: 95%;
        margin: var(--space-md);
    }

    .modal-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-enhanced {
        padding: 10px 20px;
        font-size: var(--font-size-sm);
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn-enhanced {
        width: 100%;
    }
}

.input-error {
    border: 1 px solid #FF6B6B;
    border-color: #FF6B6B;
    background-color: #facbcb;
}

/* Emoji Rating Buttons - Modern Design */
.emoji-group {
    display: flex;
    gap: 1px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0;
    margin: 0;
}

.emoji-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 2px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.3s ease;
    min-width: 26px;
    min-height: 26px;
    max-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    flex-shrink: 0;
}

.emoji-btn:hover {
    transform: scale(1.35);
    /* border-color: var(--primary-color); */
    /* background: var(--bg-card-hover); */
    /* box-shadow: var(--shadow-glow); */
}

.emoji-btn.active {
    background: var(--gradient-blue);
    border-color: transparent;
    transform: scale(1.2);
    box-shadow: var(--shadow-glow);
}

.emoji-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Emoji Display Button (Single Button) */
.emoji-display-btn {
    font-size: 2rem;
    cursor: pointer;
    border: 2px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 12px;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 50px;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.emoji-display-btn:hover {
    border-color: #0d6efd;
    background: #e7f1ff;
    transform: scale(1.05);
}

.emoji-display-btn:active {
    transform: scale(0.95);
}

/* Emoji Display Button (View Mode) */
.emoji-display-btn-view {
    font-size: 2rem;
    cursor: pointer;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 8px;
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.emoji-display-btn-view:hover {
    border-color: #0d6efd;
    background: #e7f1ff;
    transform: scale(1.1);
}

.emoji-display-btn-view:active {
    transform: scale(0.95);
}

/* Emoji Popup Selector - Modern Dark Theme */
.emoji-popup {
    position: fixed;
    background: var(--bg-dark-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: popupOpen 0.2s forwards;
}

.emoji-popup-grid {
    display: flex;
    gap: 5px;
}

.emoji-popup-option {
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    background: var(--bg-card);
    transition: all 0.3s ease;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-popup-option:hover {
    background: var(--bg-card-hover);
    transform: scale(1.2);
    box-shadow: var(--shadow-glow);
}

.emoji-popup-option:active {
    transform: scale(0.95);
}

.emoji-popup-option.active {
    background: var(--gradient-blue);
    box-shadow: var(--shadow-glow);
}

/* ====================
   Student Tiles Styles
   ==================== */

.student-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.student-tile {
    background: var(--color-surface);
    border-radius: 8px;
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--color-border);
}

.student-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary);
}

.student-tile-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.student-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.avatar-initials {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.student-status {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.student-status.status-passed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.student-status.status-failing {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.student-status.status-no-grade {
    background: var(--color-border);
    color: var(--color-text-muted);
}

.student-info {
    flex: 1;
    min-width: 0;
}

.student-name {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-number {
    font-size: var(--font-size-xs);
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 2px;
}

.student-course {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-grades {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.grades-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.grade-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xs);
    background: var(--color-background);
    border-radius: 6px;
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
}

.grade-column:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.final-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.final-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xs);
    background: var(--color-background);
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.final-item.remarks-passed .final-value {
    color: var(--color-success);
}

.final-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.final-value {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

.grade-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grade-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.grade-value {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

.grade-value.grade-passed {
    color: var(--color-success);
}

.grade-value.grade-failing {
    color: var(--color-warning);
}

.grade-value.grade-none {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.grade-progress {
    margin-top: var(--space-xs);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
}

.progress-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.progress-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
    text-align: center;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .student-tiles-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .student-tile {
        padding: var(--space-sm);
    }

    .student-tile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
        padding-bottom: var(--space-sm);
        margin-bottom: var(--space-sm);
    }

    .student-avatar {
        width: 40px;
        height: 40px;
    }

    .avatar-initials {
        font-size: var(--font-size-base);
    }

    .student-info {
        width: 100%;
    }

    .grades-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
    }

    .grade-column {
        padding: var(--space-xs);
    }

    .grade-label {
        font-size: 0.65rem;
    }

    .grade-value {
        font-size: var(--font-size-md);
    }

    .final-section {
        grid-template-columns: 1fr;
    }
}


.failed-status {
    /* background: #fecaca; */
    color: #b91c1c;
    font-size: var(--font-size-base);
    font-weight: 700;
}

.passed-status {
    /* background: #d1fae5; */
    color: #065f46;
    font-size: var(--font-size-base);
    font-weight: 700;
}


.criteria-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.criteria-row input {
    flex: 1;
}

.criteria-row .percentage-input {
    width: 80px;
}


.period-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Score Popup - compact size */
#scorePopup {
    width: 260px;
}


/* Rating Popup Tooltip - Compact Design */
.rating-popup {
    display: none;
    position: fixed;
    background: var(--color-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    width: 240px;
    animation: popupOpen 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* Desktop-only popup - hide on mobile */
@media (max-width: 768px) {
    .rating-popup {
        display: none !important;
    }
}

.rating-popup-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.rating-popup-header h2 {
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}



.rating-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
    font-weight: 400;
}

.rating-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.rating-close-btn:active {
    transform: scale(0.95);
}

.rating-popup-body {
    padding: 10px;
    background: var(--color-surface);
}

.rating-student-name {
    font-size: 10px;
    color: var(--color-text);
    margin-bottom: 8px;
    font-weight: 600;
    padding: 5px 8px;
    background: var(--color-bg);
    border-radius: 4px;
    border-left: 2px solid var(--color-primary);
}

.rating-quick-grades {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.rating-quick-btn {
    flex: 1;
    padding: 6px 4px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    transition: all 0.15s ease;
    text-align: center;
}

.rating-quick-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rating-quick-btn:active {
    transform: translateY(0);
}

.rating-divider {
    display: flex;
    align-items: center;
    margin: 8px 0 6px;
    color: var(--color-text-muted);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rating-divider::before,
.rating-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

.rating-divider span {
    padding: 0 8px;
}

.rating-form-group {
    margin: 0;
}

.rating-form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 10px;
}

.rating-input-wrapper {
    display: flex;
    gap: 5px;
}

.rating-input-wrapper input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: all 0.15s ease;
    font-weight: 600;
    text-align: center;
}

.rating-input-wrapper input:hover {
    border-color: var(--color-border-hover);
}

.rating-input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
    background: white;
}

.rating-input-wrapper input::placeholder {
    color: var(--color-text-light);
    font-weight: 400;
}

.rating-apply-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rating-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.rating-apply-btn:active {
    transform: translateY(0);
}

/* Clickable Rating Display */
.rating-clickable {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-block;
}

.rating-clickable:hover {
    background: #f0f0ff;
    transform: scale(1.05);
}

.rating-clickable:active {
    transform: scale(0.98);
}

.rating-clickable.failed {
    color: #dc3545;
}

/* ==================== Missing Styles from styles.css ==================== */

/* Popup Animation */
@keyframes popupOpen {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(-10px);
    }

    50% {
        transform: scale(1.05) translateY(0);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Score Rating Display - Compact */
.score-rating-display {
    margin-top: 8px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--color-border);
    font-size: 9px;
    color: var(--color-text-muted);
}

.score-rating-display span {
    display: inline-block;
    vertical-align: middle;
}

.score-rating-display .fw-bold {
    color: #667eea;
    font-size: 1.3rem;
    font-weight: 700;
    margin-left: 4px;
    text-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

/* Font Weight Utility */
.fw-bold {
    font-weight: 700;
}

/* Score Popup - wider than rating popup */
#scorePopup {
    width: 280px;
}

/* Grade Computation Styles */
.grade-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.grade-clickable:hover {
    background-color: #f0f0ff !important;
    transform: scale(1.02);
}

.computation-breakdown h6 {
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

.computation-breakdown table {
    margin-bottom: 0;
}

.computation-formula {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-size: 0.9rem;
    line-height: 1.6;
}

.computation-formula strong {
    font-size: 1.1rem;
}

/* Term Summary Row Styles */
.term-summary-row {
    background-color: #f0f4ff !important;
    border-top: 3px solid #667eea;
    border-bottom: 2px solid #667eea;
    font-weight: 600;
}

.term-summary-row:hover {
    background-color: #e6edff !important;
}

.term-summary-cell {
    padding: 10px 4px !important;
    vertical-align: middle;
}

.term-summary-cell .fw-bold {
    color: #667eea;
    font-size: 0.95rem;
}

.term-summary-cell small {
    display: block;
    margin-top: 2px;
    color: #6c757d;
    font-weight: 500;
}

.term-grade-header {
    background-color: #f0f4ff !important;
    border-left: 2px solid #667eea;
}

.term-grade-cell {
    padding: 10px 8px !important;
    text-align: center;
    vertical-align: middle;
    background-color: #667eea !important;
    color: white;
}

.term-grade-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.term-grade-value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.term-grade-value.text-success {
    color: #d4edda !important;
}

.term-grade-value.text-danger {
    color: #f8d7da !important;
}

.student-term-grade-cell {
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    border-left: 2px solid #e0e0e0;
}

.student-term-grade-cell:hover {
    background-color: #e7f1ff !important;
    border-left-color: #667eea;
    transform: scale(1.02);
}

.student-term-grade-cell .fw-bold {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.student-term-grade-cell .bi-calculator {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.student-term-grade-cell:hover .bi-calculator {
    opacity: 0.6;
}

/* Mobile Column Navigation */
.mobile-column-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    gap: 8px;
}

.column-indicator {
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
}

.column-dropdown {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    border: 1px solid #dee2e6;
    background-color: white;
    text-align: center;
}

/* Readonly Display Styles */
.rating-display-large {
    font-weight: 700;
    font-size: 1.2rem;
    color: #198754;
    padding: 8px;
}

.rating-display-large.failed {
    color: #dc3545;
}

.score-display-readonly {
    font-weight: 600;
    font-size: 0.95rem;
    color: #495057;
    padding: 4px;
}


.total-percentage {
    font-weight: 600;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

.total-percentage.valid {
    background: rgba(56, 239, 125, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.total-percentage.invalid {
    background: rgba(255, 107, 107, 0.2);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

/* ==================== Rating/Score Popup Responsive Styles ==================== */
@media (max-width: 768px) {
    .rating-popup {
        width: 220px;
        max-width: 85vw;
    }

    #scorePopup {
        width: 240px;
        max-width: 85vw;
    }

    .rating-popup-header {
        padding: 6px 10px;
    }

    .rating-popup-header h2 {
        font-size: 10px;
    }

    .rating-close-btn {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }

    .rating-popup-body {
        padding: 8px;
    }

    .rating-student-name {
        font-size: 9px;
        padding: 4px 6px;
    }

    .rating-quick-btn {
        padding: 5px 3px;
        font-size: 10px;
    }

    .rating-form-group label {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .rating-input-wrapper input {
        padding: 5px 6px;
        font-size: 11px;
    }

    .rating-apply-btn {
        padding: 5px 10px;
        font-size: 9px;
    }

    .score-rating-display {
        padding: 5px 8px;
        margin-top: 6px;
    }

    .score-rating-display .fw-bold {
        font-size: 1.1rem;
    }
}