/* 
   Academic & Dashboard Tracker Custom CSS
   Theme: Midnight Indigo / Neon Cyan (Dark Premium)
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0a0b10;
    --bg-card: rgba(18, 19, 30, 0.7);
    --bg-card-solid: #12131e;
    --bg-sidebar: #0e0f17;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-color: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.3);
    --secondary-color: #06b6d4; /* Cyan */
    --secondary-glow: rgba(6, 182, 212, 0.3);
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --sidebar-width: 260px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #232533;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Card Glassmorphism Style */
.card-premium {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}
.card-premium:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
}

/* Sidebar Styling */
.sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: transform var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-menu {
    list-style: none;
    padding: 20px 10px;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}
.sidebar-menu li {
    margin-bottom: 6px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sidebar-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.03);
}
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(99, 102, 241, 0.6) 100%);
    box-shadow: 0 4px 15px var(--primary-glow);
}
.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
}

/* Navbar */
.topbar {
    background: rgba(10, 11, 16, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    margin: -30px -30px 30px -30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.profile-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
}
.profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Custom UI Elements */
.badge-target {
    background: rgba(6, 182, 212, 0.1);
    color: var(--secondary-color);
    border: 1px solid rgba(6, 182, 212, 0.2);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stats-icon.primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.stats-icon.secondary {
    background: rgba(6, 182, 212, 0.1);
    color: var(--secondary-color);
    border: 1px solid rgba(6, 182, 212, 0.2);
}
.stats-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.stats-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.stats-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Tables Styling */
.table-premium {
    color: var(--text-primary) !important;
    border-collapse: separate;
    border-spacing: 0 8px;
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-primary) !important;
    --bs-table-border-color: var(--border-color) !important;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04) !important;
    --bs-table-hover-color: #ffffff !important;
}
.table-premium th {
    border: none;
    color: var(--text-secondary) !important;
    font-weight: 600;
    padding: 12px 16px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    background-color: transparent !important;
}
.table-premium tbody tr {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.table-premium tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    transform: scale(1.002);
}
.table-premium td {
    padding: 16px;
    vertical-align: middle;
    border-top: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    background-color: transparent !important;
    color: var(--text-primary) !important;
}
.table-premium td:first-child {
    border-left: 1px solid var(--border-color) !important;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}
.table-premium td:last-child {
    border-right: 1px solid var(--border-color) !important;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Danger Row Custom Style for Reconciliation */
.table-premium tr.table-danger-premium {
    background-color: rgba(239, 68, 68, 0.15) !important;
}
.table-premium tr.table-danger-premium td {
    color: #fca5a5 !important;
    background-color: transparent !important;
    border-top: 1px solid rgba(239, 68, 68, 0.25) !important;
    border-bottom: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.table-premium tr.table-danger-premium td:first-child {
    border-left: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.table-premium tr.table-danger-premium td:last-child {
    border-right: 1px solid rgba(239, 68, 68, 0.25) !important;
}

/* Forms styling */
.form-control-premium {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary) !important;
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}
.form-control-premium:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    outline: none;
}
.form-select-premium {
    background-color: var(--bg-card-solid);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
}
.form-select-premium:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Custom Button */
.btn-premium-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4f46e5 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}
.btn-premium-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    opacity: 0.95;
}
.btn-premium-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.2s ease;
}
.btn-premium-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Glassmorphism Login Card */
.login-bg {
    background: radial-gradient(circle at 10% 20%, rgb(18, 16, 28) 0%, rgb(10, 11, 16) 90%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-bg::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    filter: blur(150px);
    top: -50px;
    right: -50px;
    opacity: 0.3;
}
.login-bg::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    filter: blur(150px);
    bottom: -50px;
    left: -50px;
    opacity: 0.25;
}
.login-card {
    background: rgba(18, 19, 30, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    padding: 40px;
    z-index: 10;
}

/* Mobile responsive hamburger menu */
.menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Star/Scale indicator */
.scale-stars {
    color: var(--accent-warning);
    font-size: 1.1rem;
    display: inline-flex;
    gap: 2px;
}

/* Passing Grade Alert badge on SKD */
.badge-pg {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}
.badge-pg.lulus {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-pg.gagal {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Alert custom */
.alert-custom-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
}

/* Progress target bar */
.progress-skd-pg {
    height: 8px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

/* Glowing Recommendation Card */
.card-recommendation {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(99, 102, 241, 0.12) 100%);
    border: 1px dashed rgba(6, 182, 212, 0.4);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.1);
    position: relative;
    overflow: hidden;
}
.card-recommendation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--secondary-color), var(--primary-color));
}

/* Monitoring Read-Only Mode Banner */
.monitoring-banner {
    background: linear-gradient(90deg, #b91c1c 0%, #7f1d1d 100%);
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(185, 28, 28, 0.35);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Leaderboard card styling */
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.leaderboard-rank.rank-1 { background: #ffd700; color: #000; }
.leaderboard-rank.rank-2 { background: #c0c0c0; color: #000; }
.leaderboard-rank.rank-3 { background: #cd7f32; color: #000; }

/* Bottom Navigation (Hidden on Desktop) */
.bottom-nav {
    display: none;
}

/* Responsive Overrides */
@media (max-width: 991.98px) {
    body {
        padding-bottom: 75px !important;
    }
    .sidebar-wrapper {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .topbar {
        margin: -20px -20px 20px -20px;
        padding: 15px 20px;
    }
    .menu-toggle-btn {
        display: none !important;
    }
    
    /* Bottom Navigation Bar (Visible on Mobile) */
    .bottom-nav {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(18, 19, 30, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }
    .bottom-nav-container {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 65px;
    }
    .bottom-nav-link {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        text-decoration: none !important;
        font-size: 0.72rem;
        font-weight: 500;
        transition: all 0.2s ease;
        gap: 4px;
    }
    .bottom-nav-link i {
        font-size: 1.2rem;
        transition: transform 0.2s ease, color 0.2s ease;
    }
    .bottom-nav-link:hover {
        color: var(--text-primary);
    }
    .bottom-nav-link.active {
        color: var(--secondary-color) !important;
    }
    .bottom-nav-link.active i {
        transform: translateY(-2px);
        color: var(--secondary-color) !important;
    }

    /* Light Theme support for bottom nav */
    .light-theme .bottom-nav {
        background: rgba(255, 255, 255, 0.85);
        border-top-color: rgba(0, 0, 0, 0.08);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    }
    .light-theme .bottom-nav-link {
        color: var(--text-secondary);
    }
    .light-theme .bottom-nav-link.active {
        color: var(--primary-color) !important;
    }
    .light-theme .bottom-nav-link.active i {
        color: var(--primary-color) !important;
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.animation-delay-1 { animation-delay: 0.1s; }
.animation-delay-2 { animation-delay: 0.2s; }
.animation-delay-3 { animation-delay: 0.3s; }

/* Premium Tabs Style */
.nav-tabs-premium {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: 14px;
}
.nav-link-premium {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    border-radius: 10px !important;
}
.nav-link-premium:hover {
    color: #fff !important;
}
.nav-link-premium.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(99, 102, 241, 0.6) 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* QuillJS Dark Theme Customization */
.ql-toolbar.ql-snow {
    border-color: var(--border-color) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
}
.ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-secondary) !important;
}
.ql-toolbar.ql-snow .ql-fill {
    fill: var(--text-secondary) !important;
}
.ql-toolbar.ql-snow .ql-picker {
    color: var(--text-secondary) !important;
}
.ql-container.ql-snow {
    border-color: var(--border-color) !important;
    background: rgba(255, 255, 255, 0.01) !important;
    border-bottom-left-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.95rem !important;
    color: var(--text-primary) !important;
}
.ql-editor {
    min-height: 150px;
}
.ql-editor.ql-blank::before {
    color: rgba(255, 255, 255, 0.3) !important;
    font-style: normal !important;
}

/* ==========================================================================
   LIGHT THEME AND SMOOTH MODE SWITCHING TRANSITIONS
   ========================================================================== */

.light-theme {
    --bg-main: #f8fafc; /* slate 50 */
    --bg-card: rgba(255, 255, 255, 0.85); /* white glassmorphism */
    --bg-card-solid: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a; /* slate 900 */
    --text-secondary: #475569; /* slate 600 */
    --primary-color: #4f46e5; /* indigo 600 */
    --primary-glow: rgba(79, 70, 229, 0.12);
    --secondary-color: #0891b2; /* cyan 600 */
    --secondary-glow: rgba(8, 145, 178, 0.12);
}

/* Light Theme CSS Overrides */
.light-theme .sidebar-brand-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.light-theme .form-control-premium,
.light-theme .form-select-premium {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
}
.light-theme .form-control-premium::placeholder {
    color: #94a3b8 !important;
}
.light-theme .form-control-premium:focus,
.light-theme .form-select-premium:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px var(--primary-glow) !important;
    background: #ffffff !important;
}
.light-theme .table-premium th {
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}
.light-theme .table-premium td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.light-theme .nav-link-premium {
    color: var(--text-secondary) !important;
}
.light-theme .nav-link-premium.active {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}
.light-theme .nav-link-premium:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-primary) !important;
}
.light-theme .ql-toolbar.ql-snow {
    background: rgba(0, 0, 0, 0.02) !important;
}
.light-theme .ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-secondary) !important;
}
.light-theme .ql-container.ql-snow {
    background: #ffffff !important;
}
.light-theme .ql-editor.ql-blank::before {
    color: #94a3b8 !important;
}
.light-theme .card-premium {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.light-theme .card-premium:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -6px rgba(0, 0, 0, 0.1);
}
.light-theme .text-white {
    color: #0f172a !important;
}
.light-theme .btn-close-white {
    filter: invert(1);
}
.light-theme .alert-custom-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.light-theme .btn-premium-secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary) !important;
}
.light-theme .btn-premium-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}
.light-theme .sidebar-menu li a {
    color: var(--text-secondary);
}
.light-theme .sidebar-menu li a:hover,
.light-theme .sidebar-menu li.active a {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-color) !important;
}
.light-theme .topbar {
    background: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
.light-theme .scale-stars i {
    color: #e2e8f0; /* Light gray stars */
}
.light-theme .scale-stars i.fa-solid {
    color: #f59e0b; /* Yellow stars */
}

/* Global Transitions for smooth theme shifts */
body,
.card-premium,
.sidebar-wrapper,
.topbar,
.form-control-premium,
.form-select-premium,
.table-premium td,
.table-premium th,
a,
button,
i,
span {
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Custom Cyan helper classes */
.text-cyan {
    color: var(--secondary-color) !important;
}
.bg-cyan {
    background-color: var(--secondary-color) !important;
}
.border-cyan {
    border-color: var(--secondary-color) !important;
}
.btn-cyan {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #0a0b10 !important;
}
.btn-cyan:hover {
    opacity: 0.9;
}
.btn-outline-cyan {
    color: var(--secondary-color) !important;
    border-color: rgba(6, 182, 212, 0.35) !important;
    background-color: transparent !important;
}
.btn-outline-cyan:hover {
    background-color: rgba(6, 182, 212, 0.1) !important;
    color: #fff !important;
}
