/* --- App Structure --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar (Desktop Only) --- */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    margin-bottom: 32px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo i {
    font-size: 24px;
    color: var(--accent-color);
}

.sidebar-logo h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
    flex-grow: 1;
    margin: 32px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background-color: var(--accent-hover-bg);
    color: var(--text-primary);
}

.sidebar-menu a.active {
    background-color: var(--accent-color);
    color: var(--accent-text);
    box-shadow: var(--shadow-sm);
}

.sidebar-menu .fa-fw {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
}

.sidebar-footer a:hover {
    background-color: var(--accent-hover-bg);
    color: var(--text-primary);
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 32px 48px;
    overflow-y: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 800;
}

.subtitle {
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
    font-size: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    display: grid;
    place-items: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--accent-hover-bg);
    color: var(--text-primary);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    cursor: pointer;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* --- Learning Path --- */
.learning-path-container {
    position: relative;
    display: grid;
    gap: 24px;
}

.module {
    position: relative;
    padding: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s, box-shadow 0.3s;
}

.module:hover {
    box-shadow: var(--shadow-md);
}

.module.unlocked {
    opacity: 1;
    transform: translateY(0);
}

.module.locked {
    opacity: 0.6;
    pointer-events: none;
}

.module-header h3 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.task-list {
    list-style: none;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition);
}

.task-item:hover {
    transform: translateX(4px);
    border-color: var(--accent-color);
}

.task-item.completed {
    opacity: 0.7;
}

.task-item.completed h4 {
    text-decoration: line-through;
}

.task-status-icon {
    margin-right: 16px;
    color: var(--text-secondary);
    font-size: 18px;
}

.task-item.completed .task-status-icon {
    color: var(--success);
}

.task-details-link {
    flex-grow: 1;
    text-decoration: none;
    color: var(--text-primary);
}

.task-details h4 {
    font-weight: 600;
    font-size: 15px;
}

.task-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* --- Skeleton Loaders --- */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.module-skeleton {
    height: 150px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-card);
    background: linear-gradient(to right, var(--bg-card) 8%, var(--accent-hover-bg) 38%, var(--bg-card) 54%);
    background-size: 2000px 100%;
    animation: shimmer 1.5s linear infinite;
}

/* --- Footer Navigation (Mobile Only) --- */
.footer-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 0 10px;
}

[data-theme='dark'] .footer-nav {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.footer-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.footer-nav .nav-item i {
    font-size: 20px;
}

.footer-nav .nav-item.active,
.footer-nav .nav-item:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* --- Profile Pop-up Menu --- */
.profile-popover {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 220px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 1100;
    padding: 8px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: top right;
}

.profile-popover.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.popover-item .fa-fw {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.popover-item:hover {
    background-color: var(--accent-hover-bg);
}

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

/* --- Responsive Rules --- */
@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }
    .footer-nav {
        display: flex;
    }
    .main-content {
        padding: 24px 20px 90px;
    }
    .header-actions .theme-toggle {
        display: none; /* Tombol tema di header disembunyikan, pindah ke popover */
    }
    .header-title h1 {
        font-size: 24px;
    }
}
