/* Course Learning Page Styles */

/* ========== PROGRESS CARD - Modern Design ========== */
.progress-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
}

/* Circular Progress */
.circular-progress {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.circular-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circular-progress .circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 3.5;
}

.circular-progress .circle-progress {
    fill: none;
    stroke: url(#progressGradient);
    stroke: #4f46e5;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.circular-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: #4f46e5;
}

/* Certificate Button */
.certificate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.certificate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    color: white;
}

.certificate-btn i {
    font-size: 1.1rem;
}

/* Certificate Locked */
.certificate-locked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 0.8rem;
}

.certificate-locked i {
    color: #94a3b8;
}

/* Shared Badge */
.shared-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ========== LESSON ITEM STYLES - Clean & Modern ========== */
.lesson-item {
    transition: all 0.2s ease;
    border-radius: 10px !important;
}

.lesson-item:hover:not(.active) {
    background-color: #f1f5f9 !important;
}

/* Active Lesson - Solid Indigo (Clean & Professional) */
.lesson-item.active {
    background-color: #4f46e5 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.lesson-item.active span,
.lesson-item.active div {
    color: white !important;
}

/* Completed lesson indicator */
.lesson-item:not(.active) .bi-check-circle-fill {
    color: #10b981 !important;
}

/* Hover effect for non-active items */
.hover-bg-light:hover {
    background-color: #f3f4f6;
}

.hover-bg-gray:hover {
    background-color: #e5e7eb !important;
}

.transition-all {
    transition: all 0.2s ease;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-text-danger:hover {
    color: #ef4444 !important;
}

.toc-link.active {
    color: #ef4444 !important;
}

.article-content p {
    line-height: 1.8;
    color: #4b5563;
}

/* Code Snippets Styling - VS Code Dark Theme */
.article-content pre {
    background-color: #1e1e1e !important;
    border-radius: 8px;
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.article-content pre code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    background: transparent !important;
    background-color: transparent !important;
}

.article-content pre code.hljs {
    background-color: transparent !important;
    background: transparent !important;
    padding: 0;
}

/* Copy Button Styling */
.copy-code-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: #334155;
    color: #94a3b8;
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 10;
}

.copy-code-btn:hover {
    background-color: #475569;
    color: #e2e8f0;
    border-color: #64748b;
}

.copy-code-btn.copied {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.copy-code-btn i {
    font-size: 0.9rem;
}

.article-content code:not(pre code) {
    background-color: #f1f5f9;
    color: #dc2626;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* Tables */
.article-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.article-content table th,
.article-content table td {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
}

.article-content table th {
    background-color: #f9fafb;
    font-weight: 600;
}

/* Lists */
.article-content ul,
.article-content ol {
    line-height: 1.8;
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin: 0.5rem 0;
}

/* Headings */
.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #374151;
}

/* Alert Boxes */
.article-content .alert {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    border-left: 4px solid;
}

.article-content .alert-info {
    background-color: #dbeafe;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.article-content .alert-success {
    background-color: #d1fae5;
    border-left-color: #10b981;
    color: #065f46;
}

.article-content .alert-warning {
    background-color: #fef3c7;
    border-left-color: #f59e0b;
    color: #92400e;
}

.article-content .alert-danger {
    background-color: #fee2e2;
    border-left-color: #ef4444;
    color: #991b1b;
}

/* Prevent horizontal scroll */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.learning-page,
.learning-page * {
    max-width: 100%;
    box-sizing: border-box;
}

.learning-page {
    overflow-x: hidden;
    width: 100%;
}

/* Force content to stay within viewport */
.article-content {
    overflow-x: hidden;
    max-width: 100%;
}

.article-content>* {
    max-width: 100%;
    overflow-x: auto;
}

/* Sticky TOC */
.sticky-top {
    position: sticky;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for TOC */
.sticky-top::-webkit-scrollbar {
    width: 6px;
}

.sticky-top::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sticky-top::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.sticky-top::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Sidebar Styles */
@media (max-width: 767.98px) {
    .sidebar-mobile {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        max-width: 85vw;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    .sidebar-mobile.show {
        transform: translateX(0);
    }

    header {
        padding: 0 0.75rem !important;
    }

    header .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .flex-grow-1.bg-light {
        padding: 0.75rem !important;
    }

    .bg-white.rounded-4 {
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .bg-white.rounded-4 h1 {
        font-size: 1.15rem !important;
        line-height: 1.4;
    }

    .article-content {
        font-size: 0.9rem;
        overflow-x: hidden;
        word-wrap: break-word;
    }

    .article-content h2 {
        font-size: 1.15rem;
        margin-top: 1.5rem;
    }

    .article-content h3 {
        font-size: 1rem;
        margin-top: 1.25rem;
    }

    .article-content h4 {
        font-size: 0.95rem;
        margin-top: 1rem;
    }

    .article-content p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.7;
    }

    .article-content pre {
        padding: 2.5rem 0.75rem 0.75rem 0.75rem;
        font-size: 0.75rem;
        margin: 1rem -1rem;
        border-radius: 0;
        max-width: calc(100% + 2rem);
        width: calc(100% + 2rem);
    }

    .article-content pre code {
        font-size: 0.72rem;
        line-height: 1.5;
        white-space: pre-wrap;
        word-break: break-all;
    }

    .article-content code:not(pre code) {
        font-size: 0.8em;
        word-break: break-all;
    }

    .article-content img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    /* Tables - make scrollable on mobile */
    .article-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.8rem;
        margin: 1rem -1rem;
        width: calc(100% + 2rem);
    }

    .article-content table th,
    .article-content table td {
        padding: 0.5rem 0.75rem;
        min-width: 100px;
    }

    /* Grid layouts - stack on mobile */
    .article-content [style*="grid-template-columns: repeat(2"] {
        display: flex !important;
        flex-direction: column !important;
    }

    .article-content [style*="display: grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* Flex layouts - stack on mobile */
    .article-content [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* Alert boxes on mobile */
    .article-content .alert,
    .article-content [class*="alert-"] {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
        font-size: 0.85rem;
    }

    /* File info boxes */
    .article-content .file-info,
    .article-content [style*="background: #f8f9fa"] {
        padding: 0.75rem 1rem !important;
        margin: 0.75rem 0;
        font-size: 0.85rem;
    }

    /* Workflow diagrams - stack vertically */
    .article-content [style*="display: flex"][style*="align-items: center"][style*="justify-content"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .article-content [style*="display: flex"][style*="align-items: center"][style*="justify-content"]>div[style*="color: #48bb78"] {
        transform: rotate(90deg);
    }

    .nav-buttons {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .nav-buttons button,
    .nav-buttons a {
        width: 100%;
    }

    .copy-code-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    .main-content-scroll {
        padding: 0.75rem !important;
    }

    /* Tech stack boxes */
    .article-content [style*="box-shadow: 0 2px 8px"] {
        margin-bottom: 0.75rem;
    }

    /* Lists on mobile */
    .article-content ul,
    .article-content ol {
        padding-left: 1.25rem;
    }

    .article-content li {
        margin: 0.35rem 0;
        line-height: 1.6;
    }

    /* Inline code in mobile */
    .article-content code:not(pre code) {
        padding: 0.15rem 0.3rem;
        font-size: 0.78em;
    }

    /* Force inline styles to be responsive */
    .article-content [style*="width:"],
    .article-content [style*="min-width:"] {
        width: 100% !important;
        min-width: unset !important;
    }

    /* Override fixed widths in inline styles */
    .article-content [style*="width: 300px"],
    .article-content [style*="width: 400px"],
    .article-content [style*="width: 500px"] {
        width: 100% !important;
    }

    /* Nested flex containers */
    .article-content>div[style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Any element with padding that might cause overflow */
    .article-content [style*="padding: 25px"],
    .article-content [style*="padding: 20px"] {
        padding: 12px !important;
    }
}

@media (min-width: 768px) {
    .sidebar-mobile {
        width: var(--sidebar-width);
        position: static;
        transform: none;
    }
}

@media (max-width: 375px) {
    .bg-white.rounded-4 {
        padding: 0.75rem !important;
    }

    .bg-white.rounded-4 h1 {
        font-size: 1rem !important;
    }

    .article-content {
        font-size: 0.85rem;
    }

    .article-content pre {
        margin: 0.75rem -0.75rem;
        padding: 2rem 0.5rem 0.5rem 0.5rem;
    }

    .article-content pre code {
        font-size: 0.7rem;
    }

    /* Extra small screen fixes */
    .article-content [style*="display: grid"],
    .article-content [style*="display: flex"] {
        gap: 0.5rem !important;
    }
}