/* ============================================
   ENHANCED LEARNING HUB - CREATIVE UI
   Features: Progress Tracking, Next/Previous Navigation
   ============================================ */

/* Root Variables for Easy Theming */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Global Styles */
.lhm-single-topic-display,
.lhm-subject-display {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--background);
}

/* ============================================
   PROGRESS SIDEBAR WITH TOPIC LIST
   ============================================ */

.lhm-learning-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 100px);
}

/* Progress Sidebar */
.lhm-progress-sidebar {
    position: sticky;
    top: 24px;
    height: fit-content;
    max-height: calc(100vh - 48px);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lhm-sidebar-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 24px;
    color: white;
}

.lhm-sidebar-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.lhm-progress-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 14px;
}

.lhm-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.lhm-stat-icon {
    font-size: 16px;
}

/* Progress Bar */
.lhm-overall-progress {
    margin-top: 16px;
}

.lhm-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: rgba(255,255,255,0.95);
}

.lhm-progress-bar-container {
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.lhm-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Topics List in Sidebar */
.lhm-topics-scroll-container {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

.lhm-topics-progress-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lhm-topic-progress-item {
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

.lhm-topic-progress-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--background);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.lhm-topic-progress-link:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.lhm-topic-progress-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.lhm-topic-progress-link.completed {
    background: #f0fdf4;
    border-color: var(--success-color);
}

.lhm-topic-progress-link.completed:hover {
    background: #dcfce7;
}

.lhm-topic-progress-link.active.completed {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

/* Topic Number/Status Icon */
.lhm-topic-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.lhm-topic-progress-link.active .lhm-topic-status {
    background: white;
    color: var(--primary-color);
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.lhm-topic-progress-link.completed .lhm-topic-status {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.lhm-topic-progress-link.completed .lhm-topic-status::before {
    content: "✓";
    font-size: 18px;
}

.lhm-topic-info {
    flex: 1;
    min-width: 0;
}

.lhm-topic-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.lhm-topic-meta {
    font-size: 12px;
    opacity: 0.7;
}

/* Lock Icon for Locked Topics */
.lhm-topic-lock {
    color: var(--text-secondary);
    font-size: 18px;
}

.lhm-topic-progress-link.active .lhm-topic-lock {
    color: white;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.lhm-main-content-area {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Topic Header */
.lhm-topic-header-enhanced {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.lhm-topic-header-enhanced::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.lhm-breadcrumb-enhanced {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.95;
}

.lhm-breadcrumb-enhanced a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.lhm-breadcrumb-enhanced a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.lhm-breadcrumb-separator {
    opacity: 0.6;
}

.lhm-topic-title-enhanced {
    font-size: 36px;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.2;
    position: relative;
    z-index: 1;
    color: #fff;
}

.lhm-topic-description-enhanced {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

/* Completion Badge */
.lhm-completion-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--success-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.lhm-completion-badge .icon {
    font-size: 18px;
}

/* Content Area */
.lhm-topic-content-enhanced {
    padding: 40px;
}

.lhm-content-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

/* Content Items Styling */
.lhm-content-item {
    margin-bottom: 32px;
}

/* Rich Content */
.lhm-rich-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
}

.lhm-rich-content p {
    margin-bottom: 20px;
}

.lhm-rich-content h1,
.lhm-rich-content h2,
.lhm-rich-content h3,
.lhm-rich-content h4 {
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

.lhm-rich-content h1 { font-size: 32px; }
.lhm-rich-content h2 { font-size: 28px; }
.lhm-rich-content h3 { font-size: 24px; }
.lhm-rich-content h4 { font-size: 20px; }

.lhm-rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin: 24px 0;
}

.lhm-rich-content code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    color: #e11d48;
}

.lhm-rich-content ul,
.lhm-rich-content ol {
    margin: 20px 0 20px 32px;
}

.lhm-rich-content li {
    margin-bottom: 12px;
    line-height: 1.8;
}

.lhm-rich-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 24px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Code Blocks */
.lhm-code-container {
    background: #1e293b;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 24px 0;
    box-shadow: var(--shadow-lg);
}

.lhm-code-header {
    background: #0f172a;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
}

.lhm-code-language {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lhm-copy-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lhm-copy-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.lhm-copy-button.copied {
    background: var(--success-color);
}

.lhm-code-container pre {
    margin: 0;
    padding: 24px;
    overflow-x: auto;
}

.lhm-code-container code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.7;
    color: #e2e8f0;
}

/* Image Content */
.lhm-image-content {
    text-align: center;
    padding: 24px;
    background: var(--background);
    border-radius: var(--radius-md);
}

.lhm-image-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   NAVIGATION CONTROLS (Next/Previous)
   ============================================ */

.lhm-navigation-controls {
    padding: 32px 40px;
    background: var(--background);
    border-top: 2px solid var(--border-color);
}

.lhm-nav-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Mark as Complete Section */
.lhm-complete-section {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.lhm-complete-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.lhm-complete-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.lhm-complete-button.completed {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    cursor: default;
}

.lhm-complete-button.completed:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.3);
}

/* Next/Previous Buttons */
.lhm-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.lhm-nav-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.lhm-nav-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lhm-nav-button:hover::before {
    opacity: 0.05;
}

.lhm-nav-button:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.lhm-nav-button-content {
    position: relative;
    z-index: 1;
}

.lhm-nav-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
}

.lhm-nav-topic-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.lhm-nav-icon {
    font-size: 32px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.lhm-nav-button.prev:hover .lhm-nav-icon {
    transform: translateX(-4px);
}

.lhm-nav-button.next:hover .lhm-nav-icon {
    transform: translateX(4px);
}

.lhm-nav-button.prev {
    flex-direction: row;
}

.lhm-nav-button.next {
    flex-direction: row-reverse;
    text-align: right;
}

.lhm-nav-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Back to Topics Button */
.lhm-back-to-topics {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

.lhm-back-to-topics:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateX(-4px);
}

/* ============================================
   AUDIO PLAYER (Enhanced)
   ============================================ */

.lhm-audio-player-container {
    margin: 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.lhm-audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.lhm-audio-player .audio-icon {
    font-size: 32px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.lhm-audio-player .audio-label {
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.lhm-audio-element {
    flex: 1;
    min-width: 300px;
    border-radius: 30px;
    background: rgba(255,255,255,0.95);
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ============================================
   NO CONTENT STATE
   ============================================ */

.lhm-no-content {
    text-align: center;
    padding: 60px 40px;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.lhm-no-content-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.lhm-no-content p {
    color: var(--text-secondary);
    font-size: 18px;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .lhm-learning-container {
        grid-template-columns: 280px 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .lhm-topic-header-enhanced {
        padding: 32px 24px;
    }
    
    .lhm-topic-title-enhanced {
        font-size: 28px;
    }
    
    .lhm-topic-content-enhanced {
        padding: 32px 24px;
    }
}

@media (max-width: 768px) {
    .lhm-learning-container {
        grid-template-columns: 1fr;
    }
    
    .lhm-progress-sidebar {
        position: relative;
        top: 0;
        max-height: 400px;
        margin-bottom: 16px;
    }
    
    .lhm-topic-header-enhanced {
        padding: 24px 20px;
    }
    
    .lhm-topic-title-enhanced {
        font-size: 24px;
    }
    
    .lhm-topic-description-enhanced {
        font-size: 16px;
    }
    
    .lhm-topic-content-enhanced {
        padding: 24px 20px;
    }
    
    .lhm-navigation-controls {
        padding: 24px 20px;
    }
    
    .lhm-nav-buttons {
        flex-direction: column;
    }
    
    .lhm-nav-button.next {
        flex-direction: row;
        text-align: left;
    }
    
    .lhm-rich-content {
        font-size: 16px;
    }
    
    .lhm-code-container pre {
        padding: 16px;
    }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

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

.lhm-main-content-area {
    animation: fadeInUp 0.5s ease;
}

.lhm-topic-progress-item {
    animation: fadeInUp 0.3s ease;
    animation-fill-mode: both;
}

.lhm-topic-progress-item:nth-child(1) { animation-delay: 0.05s; }
.lhm-topic-progress-item:nth-child(2) { animation-delay: 0.1s; }
.lhm-topic-progress-item:nth-child(3) { animation-delay: 0.15s; }
.lhm-topic-progress-item:nth-child(4) { animation-delay: 0.2s; }
.lhm-topic-progress-item:nth-child(5) { animation-delay: 0.25s; }

/* Smooth Scrolling */
.lhm-topics-scroll-container {
    scroll-behavior: smooth;
}

.lhm-topics-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.lhm-topics-scroll-container::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 10px;
}

.lhm-topics-scroll-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.lhm-topics-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Loading State */
.lhm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.lhm-complete-button.just-completed {
    animation: successPulse 0.6s ease;
}
