/* 🌈 RESPONSIVE BACKGROUND SYSTEM 🌈 */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    background: var(--bg);
    overflow: hidden;
    pointer-events: none;
}

#bg-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.12;
    transition: background-image 1s ease-in-out, opacity 0.5s;
    filter: blur(2px);
}

/* 🧊 GLASSMORPHISM ENHANCEMENTS 🧊 */
.glass-card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2) !important;
}

.theme-junior .glass-card {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Junior Specific Animations */
@keyframes float-bg {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.junior-bg-animate {
    animation: float-bg 8s infinite alternate ease-in-out;
}

/* 📱 Responsive Mobile Overrides */
@media (max-width: 768px) {
    #bg-pattern {
        background-size: cover;
        background-position: center;
        opacity: 0.08;
    }
    .glass-card {
        border-radius: 1.25rem;
        padding: 1.5rem !important;
    }
    .dashboard-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .sidebar {
        width: 100%;
        order: 2; /* Sidebar moves below content on mobile dashboard */
    }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        position: static;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    .sidebar-item {
        white-space: nowrap;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* Junior Theme Styles */
body.theme-junior {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --bg: #f8fafc;
    --bg2: #f1f5f9;
    --card-bg: #ffffff;
    --border: rgba(79, 70, 229, 0.1);
    --text: #1e293b;
    --muted: #64748b;
    background-color: var(--bg);
}

body.theme-junior .navbar {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1.5px solid var(--border);
}

body.theme-junior .card {
    border-radius: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}

body.theme-junior .card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 30px -5px rgba(79, 70, 229, 0.1);
}

body.theme-junior .btn {
    border-radius: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Senior Theme Styles (Dark/Minimal) */
body.theme-senior {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --bg: #030712;
    --bg2: #111827;
    --card-bg: rgba(17, 24, 39, 0.7);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f9fafb;
    --muted: #9ca3af;
    background-color: var(--bg);
}

body.theme-senior .card {
    border-radius: 1.25rem;
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

/* ✨ Global Shared Animations ✨ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-up {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Sidebar Layout for Dashboard */
.dashboard-container {
    display: flex;
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    position: sticky;
    top: 6rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.5rem;
    border-radius: 1.25rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sidebar-item:hover {
    background: var(--primary-glow);
    color: var(--text);
    transform: translateX(5px);
}

.sidebar-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
    border-color: rgba(255, 255, 255, 0.1);
}

body.theme-junior .sidebar-item {
    border-radius: 2rem;
}

/* Subject Cards Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.subject-card {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    overflow: visible;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: auto;
}

.subject-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(225deg, transparent 0%, rgba(255,255,255,0.05) 100%);
    opacity: 0; transition: opacity 0.4s;
}

.subject-card:hover::after { opacity: 1; }

.subject-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.progress-container {
    height: 10px;
    background: rgba(0,0,0,0.08);
    border-radius: 5px;
    overflow: hidden;
}

body.theme-senior .progress-container {
    background: rgba(255,255,255,0.08);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Learning Interface Enhancements */
.paragraph-module {
    animation: fadeInUp 0.8s forwards;
    height: auto;
    overflow: visible;
}

.p-text {
    background: linear-gradient(to right, var(--text), var(--muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: normal;
    word-wrap: break-word;
    height: auto;
    overflow: visible;
}
