/* CSS Design System for ToolsRemun UB Dashboard */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

html {
    font-size: 17.5px !important;
}

:root {
    --bg-dark: #080b11;
    --bg-card: rgba(17, 25, 40, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.3);
    --primary-grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    
    --accent-cyan: #06b6d4;
    --accent-cyan-grad: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
    
    --accent-purple: #a855f7;
    --accent-purple-grad: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    
    --success: #10b981;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(168, 85, 247, 0.06) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Dashboard Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: rgba(8, 12, 21, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    flex-shrink: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: var(--primary-grad);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.menu-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.02);
}

.menu-item.active {
    color: white;
    background: var(--primary-grad);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 16px -4px var(--primary-glow);
}

.menu-item-icon {
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.5rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    height: 100%;
}

.panel-title-section {
    margin-bottom: 2rem;
}

.panel-title-section h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.35rem;
}

.panel-title-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-panel.active {
    display: block;
}

/* Glassmorphism Panel Container */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
}

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

.upload-card {
    background: rgba(255, 255, 255, 0.015);
    border: 2px dashed rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.upload-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
}

.upload-card.dragover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.04);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.upload-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.upload-card p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
}

.file-input {
    display: none;
}

.select-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.upload-card:hover .select-btn {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* File Selected State */
.file-info {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease forwards;
}

.file-info.active {
    display: flex;
}

.file-info .icon-check {
    color: var(--success);
    font-weight: bold;
}

.file-info .file-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #e2e8f0;
}

/* Action Button */
.action-area {
    text-align: center;
    margin-top: 1.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2.25rem;
    background: var(--primary-grad);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px 0 var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Search and Filters */
.controls-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 1.5rem;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.005);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.015);
    padding: 0.85rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

td {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

tr.table-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

tr.table-row:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Column sorting th */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
}

th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary);
}

th.sortable .sort-indicator {
    margin-left: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: inline-block;
}

th.sortable.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

th.sortable.active .sort-indicator {
    color: var(--accent-cyan);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-uts {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-uas {
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-koreksi-uts {
    background: rgba(168, 85, 247, 0.12);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.badge-koreksi-uas {
    background: rgba(236, 72, 153, 0.12);
    color: #fbcfe8;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.badge-session {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Expandable rows details */
.detail-row {
    display: none;
    background: rgba(0, 0, 0, 0.2);
}

.detail-row.active {
    display: table-row;
}

.detail-container {
    padding: 1.25rem;
    animation: slideDown 0.3s ease forwards;
}

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

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

.detail-column {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
}

.detail-column h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-column.uts-col h4 { color: #a5b4fc; }
.detail-column.uas-col h4 { color: #67e8f9; }

.course-item {
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.008);
    border-radius: 8px;
    margin-bottom: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-item:last-child {
    margin-bottom: 0;
}

.course-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.course-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.course-peserta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.45rem;
    border-radius: 5px;
}

/* Toast Alerts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: #111827;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 280px;
    animation: slideUp 0.3s ease forwards;
}

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

/* Loader overlay */
.loader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 11, 17, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1.25rem;
}

.loader-overlay.active {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

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

@keyframes slideDown {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Theme Toggle Widget Styling */
.theme-toggle-container {
    margin-top: auto;
    margin-bottom: 1rem;
    padding: 0.75rem 0.5rem 0 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-toggle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-toggle-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border-color);
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.theme-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Light Theme Colors & Variables Override */
body.light-theme {
    --bg-dark: #f8fafc; /* Slate 50 */
    --bg-card: rgba(255, 255, 255, 0.85);
    --border-color: rgba(15, 23, 42, 0.08); /* Slate 900 */
    --text-primary: #0f172a; /* Slate 900 - dark text for clarity */
    --text-secondary: #475569; /* Slate 600 */
    
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --primary-grad: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    
    --accent-cyan: #0891b2;
    --accent-cyan-grad: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    
    --accent-purple: #9333ea;
    --accent-purple-grad: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

body.light-theme {
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(8, 145, 178, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(147, 51, 234, 0.04) 0px, transparent 50%);
}

body.light-theme .sidebar {
    background: rgba(241, 245, 249, 0.8); /* Slate 100 */
}

body.light-theme .brand-name {
    background: linear-gradient(to right, #0f172a, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .panel-title-section h1 {
    background: linear-gradient(to right, #0f172a, #1e293b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .menu-item:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.02);
}

body.light-theme .menu-item.active {
    color: white;
    box-shadow: 0 8px 16px -4px var(--primary-glow);
}

body.light-theme .glass-panel {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

body.light-theme .upload-card {
    background: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .upload-card:hover {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.08);
}

body.light-theme .select-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

body.light-theme .upload-card:hover .select-btn {
    color: white;
}

body.light-theme .search-input {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .export-btn {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-primary);
}

body.light-theme .export-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme th {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme tr.table-row:hover {
    background-color: rgba(0, 0, 0, 0.015);
}

body.light-theme .detail-row {
    background: rgba(0, 0, 0, 0.015);
}

body.light-theme .detail-column {
    background: rgba(255, 255, 255, 0.5);
}

body.light-theme .course-item {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(0, 0, 0, 0.02);
}

body.light-theme .course-peserta {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .toast {
    background: white;
    color: #0f172a;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

body.light-theme .loader-overlay {
    background: rgba(255, 255, 255, 0.85);
}

body.light-theme .theme-btn.active {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .theme-toggle-buttons {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme select {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

/* Light Theme Stats Value Colors Override */
body.light-theme #stats-uts-soal { color: #4f46e5 !important; }
body.light-theme #stats-uas-soal { color: #0891b2 !important; }
body.light-theme #stats-uts-koreksi { color: #7e22ce !important; }
body.light-theme #stats-uas-koreksi { color: #db2777 !important; }

body.light-theme #stats-sempro-dosen,
body.light-theme #stats-semhas-dosen,
body.light-theme #stats-kompre-dosen,
body.light-theme #stats-pembimbing-dosen,
body.light-theme #stats-s3_mat-dosen,
body.light-theme #stats-s2_mat-dosen {
    color: #059669 !important;
}

body.light-theme #stats-sempro-total,
body.light-theme #stats-semhas-total,
body.light-theme #stats-kompre-total,
body.light-theme #stats-pembimbing-total,
body.light-theme #stats-s3_mat-total,
body.light-theme #stats-s2_mat-total {
    color: #0891b2 !important;
}

/* Light Theme Inline Stats Cards Backgrounds Override */
body.light-theme .results-panel .glass-panel div[style*="background:rgba(255,255,255,0.015)"],
body.light-theme .results-panel .glass-panel div[style*="background: rgba(255, 255, 255, 0.015)"] {
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Light Theme Badges Color Overrides */
body.light-theme .badge-uts {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.2);
}
body.light-theme .badge-uas {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
    border-color: rgba(6, 182, 212, 0.2);
}
body.light-theme .badge-koreksi-uts {
    background: rgba(168, 85, 247, 0.1);
    color: #7e22ce;
    border-color: rgba(168, 85, 247, 0.2);
}
body.light-theme .badge-koreksi-uas {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
    border-color: rgba(236, 72, 153, 0.2);
}
body.light-theme .badge-session {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}

.logout-btn-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
