﻿
/* Course Progress Tree Styles */
.course-tree {
    --tree-line-color: rgba(var(--primary-rgb), 0.2);
    --tree-node-color: var(--primary);
}

.tree-item {
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.tree-item-content {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.75rem;
    padding: 1rem;
    border: 2px solid transparent;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    min-height: 4rem;
}

.tree-item:hover .tree-item-content {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tree-connector {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    height: 2rem;
    position: relative;
}

.connector-line {
    width: 2rem;
    height: 2px;
    background: var(--tree-line-color);
    margin-right: 0.5rem;
}

.connector-node {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tree-node-color);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tree-item-main {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 1rem;
}

.status-indicator {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid; /* Thinner border */
    transition: all 0.3s ease;
}

.indicator-completed {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.indicator-bookmarked {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #2563eb;
}

.indicator-viewed {
    background: rgba(107, 114, 128, 0.15);
    border-color: rgba(107, 114, 128, 0.3);
    color: #4b5563;
}

.indicator-not-started {
    background: rgba(243, 244, 246, 0.8);
    border-color: rgba(209, 213, 219, 0.6);
    color: #9ca3af;
}

.status-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

.tree-item-info {
    min-width: 0;
}

.tree-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

    .tree-item-link:hover .tree-item-title {
        color: var(--primary);
    }

.tree-item-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #374151;
    transition: color 0.3s ease;
    line-height: 1.3;
}

.tree-item-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.tree-level-0 .tree-item-title {
    font-size: 1.375rem;
    font-weight: 700;
    font-family: "gelica", sans-serif;
    color: var(--text-primary);
}

.tree-level-0 .tree-item-content {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(255, 255, 255, 0.9));
    border-color: var(--primary);
}

.tree-level-1 {
    margin-left: 0rem; /*1rem;*/
}

.tree-level-2 {
    margin-left: 0rem; /*2rem;*/
}

.tree-level-3 {
    margin-left: 0rem; /*3rem;*/
}

.tree-item-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

    .status-badge.viewed {
        background: rgba(107, 114, 128, 0.1);
        color: #4b5563;
        border: 2px solid rgba(107, 114, 128, 0.2);
        box-shadow: none;
        transition: all 0.3s ease;
    }

        .status-badge.viewed:hover {
            background: rgba(107, 114, 128, 0.2);
            border-color: rgba(107, 114, 128, 0.4);
            transform: scale(1.05);
        }

.tree-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.action-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid rgba(var(--primary-rgb), 0.2);
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .action-btn:hover {
        background: rgba(var(--primary-rgb), 0.2);
        border-color: var(--primary);
        transform: scale(1.1);
    }

    .action-btn.success {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
    }

        .action-btn.success:hover {
            background: var(--primary-dark);
            border-color: var(--primary-dark);
        }

    .action-btn.processing {
        pointer-events: none;
        opacity: 0.7;
        animation: pulse 1.5s ease-in-out infinite;
    }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tree-item-content {
        padding: 0.75rem;
        flex-wrap: wrap;
    }

    .tree-connector {
        margin-right: 0.5rem;
    }

    .connector-line {
        width: 1rem;
    }

    .tree-item-main {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .tree-item-info {
        flex: 1;
        min-width: 0;
        margin-bottom: 0.5rem;
    }

    .tree-item-actions {
        margin-left: 0;
        justify-self: end;
    }

    .action-btn {
        width: 2.25rem;
        height: 2.25rem;
    }

    .tree-level-1, .tree-level-2, .tree-level-3 {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .tree-item-content {
        padding: 0.5rem;
    }

    .tree-item-title {
        font-size: 1rem;
    }

    .tree-level-0 .tree-item-title {
        font-size: 1.25rem;
    }

    .action-btn {
        width: 2rem;
        height: 2rem;
    }

    .status-indicator {
        width: 1.75rem;
        height: 1.75rem;
    }
}

/* Dark status indicators for level 0 */
.tree-level-0 .indicator-completed {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: rgba(var(--primary-rgb), 0.4);
    color: var(--primary-dark);
}

.tree-level-0 .indicator-bookmarked {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--primary);
}

.tree-level-0 .indicator-viewed {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
}

.tree-level-0 .indicator-not-started {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.2);
    color: rgba(var(--primary-rgb), 0.7);
}






/* ========================================
           THEME-SPECIFIC TREE ITEM STYLES
           ======================================== */

/**
         * Individual tree item theming based on theme class
         * Each tree item can have its own theme (nature, sky, sunset, mystical)
         * regardless of the global body theme
         */

/* Nature Theme Tree Items */
.tree-item.nature .tree-item-content {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08), rgba(255, 255, 255, 0.9));
    border-color: rgba(76, 175, 80, 0.2);
}

.tree-item.nature:hover .tree-item-content {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.12), rgba(255, 255, 255, 0.95));
    border-color: rgba(76, 175, 80, 0.4);
}

.tree-item.nature .tree-item-title {
    color: #2e7d32;
}

.tree-item.nature .tree-item-link:hover .tree-item-title {
    color: #4caf50;
}

.tree-item.nature .connector-node {
    background: #4caf50;
    border-color: white;
}

.tree-item.nature .action-btn {
    border-color: rgba(76, 175, 80, 0.2);
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

    .tree-item.nature .action-btn:hover {
        background: rgba(76, 175, 80, 0.2);
        border-color: #4caf50;
    }

    .tree-item.nature .action-btn.success {
        background: #4caf50;
        border-color: #4caf50;
        color: white;
    }

        .tree-item.nature .action-btn.success:hover {
            background: #2e7d32;
            border-color: #2e7d32;
        }

/* Sky Theme Tree Items */
.tree-item.sky .tree-item-content {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.08), rgba(255, 255, 255, 0.9));
    border-color: rgba(33, 150, 243, 0.2);
}

.tree-item.sky:hover .tree-item-content {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.12), rgba(255, 255, 255, 0.95));
    border-color: rgba(33, 150, 243, 0.4);
}

.tree-item.sky .tree-item-title {
    color: #1565c0;
}

.tree-item.sky .tree-item-link:hover .tree-item-title {
    color: #2196f3;
}

.tree-item.sky .connector-node {
    background: #2196f3;
    border-color: white;
}

.tree-item.sky .action-btn {
    border-color: rgba(33, 150, 243, 0.2);
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
}

    .tree-item.sky .action-btn:hover {
        background: rgba(33, 150, 243, 0.2);
        border-color: #2196f3;
    }

    .tree-item.sky .action-btn.success {
        background: #2196f3;
        border-color: #2196f3;
        color: white;
    }

        .tree-item.sky .action-btn.success:hover {
            background: #1565c0;
            border-color: #1565c0;
        }

/* Sunset Theme Tree Items */
.tree-item.sunset .tree-item-content {
    background: linear-gradient(135deg, rgba(255, 112, 67, 0.08), rgba(255, 255, 255, 0.9));
    border-color: rgba(255, 112, 67, 0.2);
}

.tree-item.sunset:hover .tree-item-content {
    background: linear-gradient(135deg, rgba(255, 112, 67, 0.12), rgba(255, 255, 255, 0.95));
    border-color: rgba(255, 112, 67, 0.4);
}

.tree-item.sunset .tree-item-title {
    color: #d84315;
}

.tree-item.sunset .tree-item-link:hover .tree-item-title {
    color: #ff7043;
}

.tree-item.sunset .connector-node {
    background: #ff7043;
    border-color: white;
}

.tree-item.sunset .action-btn {
    border-color: rgba(255, 112, 67, 0.2);
    background: rgba(255, 112, 67, 0.1);
    color: #ff7043;
}

    .tree-item.sunset .action-btn:hover {
        background: rgba(255, 112, 67, 0.2);
        border-color: #ff7043;
    }

    .tree-item.sunset .action-btn.success {
        background: #ff7043;
        border-color: #ff7043;
        color: white;
    }

        .tree-item.sunset .action-btn.success:hover {
            background: #d84315;
            border-color: #d84315;
        }

/* Mystical Theme Tree Items */
.tree-item.mystical .tree-item-content {
    background: linear-gradient(135deg, rgba(126, 87, 194, 0.08), rgba(255, 255, 255, 0.9));
    border-color: rgba(126, 87, 194, 0.2);
}

.tree-item.mystical:hover .tree-item-content {
    background: linear-gradient(135deg, rgba(126, 87, 194, 0.12), rgba(255, 255, 255, 0.95));
    border-color: rgba(126, 87, 194, 0.4);
}

.tree-item.mystical .tree-item-title {
    color: #512da8;
}

.tree-item.mystical .tree-item-link:hover .tree-item-title {
    color: #7e57c2;
}

.tree-item.mystical .connector-node {
    background: #7e57c2;
    border-color: white;
}

.tree-item.mystical .action-btn {
    border-color: rgba(126, 87, 194, 0.2);
    background: rgba(126, 87, 194, 0.1);
    color: #7e57c2;
}

    .tree-item.mystical .action-btn:hover {
        background: rgba(126, 87, 194, 0.2);
        border-color: #7e57c2;
    }

    .tree-item.mystical .action-btn.success {
        background: #7e57c2;
        border-color: #7e57c2;
        color: white;
    }

        .tree-item.mystical .action-btn.success:hover {
            background: #512da8;
            border-color: #512da8;
        }

/* Enhanced Status Indicators for Themed Tree Items */
.tree-item.nature .indicator-completed {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.tree-item.nature .indicator-bookmarked {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.25);
    color: #4caf50;
}

.tree-item.sky .indicator-completed {
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.3);
    color: #1565c0;
}

.tree-item.sky .indicator-bookmarked {
    background: rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.25);
    color: #2196f3;
}

.tree-item.sunset .indicator-completed {
    background: rgba(255, 112, 67, 0.15);
    border-color: rgba(255, 112, 67, 0.3);
    color: #d84315;
}

.tree-item.sunset .indicator-bookmarked {
    background: rgba(255, 112, 67, 0.1);
    border-color: rgba(255, 112, 67, 0.25);
    color: #ff7043;
}

.tree-item.mystical .indicator-completed {
    background: rgba(126, 87, 194, 0.15);
    border-color: rgba(126, 87, 194, 0.3);
    color: #512da8;
}

.tree-item.mystical .indicator-bookmarked {
    background: rgba(126, 87, 194, 0.1);
    border-color: rgba(126, 87, 194, 0.25);
    color: #7e57c2;
}

/* Tree connector lines themed */
.tree-item.nature {
    --tree-line-color: rgba(76, 175, 80, 0.2);
    --tree-node-color: #4caf50;
}

.tree-item.sky {
    --tree-line-color: rgba(33, 150, 243, 0.2);
    --tree-node-color: #2196f3;
}

.tree-item.sunset {
    --tree-line-color: rgba(255, 112, 67, 0.2);
    --tree-node-color: #ff7043;
}

.tree-item.mystical {
    --tree-line-color: rgba(126, 87, 194, 0.2);
    --tree-node-color: #7e57c2;
}

/* Special styling for level 0 (course overview) themed items */
.tree-item.nature.tree-level-0 .tree-item-content {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(255, 255, 255, 0.95));
    border-color: #4caf50;
}

.tree-item.sky.tree-level-0 .tree-item-content {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(255, 255, 255, 0.95));
    border-color: #2196f3;
}

.tree-item.sunset.tree-level-0 .tree-item-content {
    background: linear-gradient(135deg, rgba(255, 112, 67, 0.15), rgba(255, 255, 255, 0.95));
    border-color: #ff7043;
}

.tree-item.mystical.tree-level-0 .tree-item-content {
    background: linear-gradient(135deg, rgba(126, 87, 194, 0.15), rgba(255, 255, 255, 0.95));
    border-color: #7e57c2;
}

/* Enhanced level 0 title colors */
.tree-item.nature.tree-level-0 .tree-item-title {
    color: #2e7d32;
}

.tree-item.sky.tree-level-0 .tree-item-title {
    color: #1565c0;
}

.tree-item.sunset.tree-level-0 .tree-item-title {
    color: #d84315;
}

.tree-item.mystical.tree-level-0 .tree-item-title {
    color: #512da8;
}




/* ---------- MOBILE LAYOUT FIXES ---------- */
@media (max-width: 768px) {
    /* Hide the tree lines + dot on mobile to make space */
    .tree-connector, .tree-connector .connector-line, .tree-connector .connector-node, .status-indicator {
        display: none !important;
    }
    /* Keep everything on one row */
    .tree-item-content {
        padding: 0.75rem;
        min-height: auto;
        flex-wrap: nowrap;
    }

    .tree-item-main {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.5rem;
        width: 100%;
    }
    /* Title takes the available space */
    .tree-item-info {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
    }
    /* Optional: hide subtitles except for level 0 to save space */
    .tree-item:not(.tree-level-0) .tree-item-subtitle {
        display: none;
    }
    /* Put the "eye" immediately before the buttons and push both to the right */
    .tree-item-status {
        order: 2;
        margin-left: auto; /* pushes status + actions to the far right */
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    /* Buttons sit after the eye and stay tight */
    .tree-item-actions {
        order: 3;
        margin-left: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    /* Slightly smaller buttons on mobile */
    .action-btn {
        width: 2.25rem;
        height: 2.25rem;
    }
    /* Typographic tweaks for space */
    .tree-item-title {
        font-size: 1.06rem;
        margin-bottom: 0; /* tighter title */
    }
    /* No extra left indentation for nested rows on mobile */
    .tree-level-1, .tree-level-2, .tree-level-3 {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .tree-item-content {
        padding: 0.5rem;
    }

    .tree-item-title {
        font-size: 1rem;
    }

    .action-btn {
        width: 2rem;
        height: 2rem;
    }
}


/* Theme-specific tint for 'viewed' and 'not-started' states */
.tree-item.nature .indicator-viewed {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.25);
    color: #2e7d32;
}

.tree-item.nature .indicator-not-started {
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.tree-item.sky .indicator-viewed {
    background: rgba(33, 150, 243, 0.12);
    border-color: rgba(33, 150, 243, 0.25);
    color: #1565c0;
}

.tree-item.sky .indicator-not-started {
    background: rgba(33, 150, 243, 0.08);
    border-color: rgba(33, 150, 243, 0.2);
    color: #2196f3;
}

.tree-item.sunset .indicator-viewed {
    background: rgba(255, 112, 67, 0.12);
    border-color: rgba(255, 112, 67, 0.25);
    color: #d84315;
}

.tree-item.sunset .indicator-not-started {
    background: rgba(255, 112, 67, 0.08);
    border-color: rgba(255, 112, 67, 0.2);
    color: #ff7043;
}

.tree-item.mystical .indicator-viewed {
    background: rgba(126, 87, 194, 0.12);
    border-color: rgba(126, 87, 194, 0.25);
    color: #512da8;
}

.tree-item.mystical .indicator-not-started {
    background: rgba(126, 87, 194, 0.08);
    border-color: rgba(126, 87, 194, 0.2);
    color: #7e57c2;
}
