/* ============================================================
   course-detail.css – Trang Chi tiết Khóa học
   Frontend Developer: Nguyễn Đức Thắng
   Sprint 2 – KhoaHocIT.Shop
   ============================================================ */

/* ---------- Breadcrumb ---------- */
.breadcrumb-bar {
    background: #f1f5f9;
    border-bottom: 1px solid var(--border, #e5e7eb);
    padding: 12px 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--indigo, #5b6af8);
    text-decoration: none;
    transition: color .2s;
}

.breadcrumb a:hover { color: var(--indigo-light, #7c8aff); }

.breadcrumb .sep { color: #9ca3af; font-size: .75rem; }

.breadcrumb .current {
    color: #6b7280;
    font-weight: 500;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Main Layout ---------- */
.course-detail-page {
    padding: 40px 0 80px;
    background: var(--bg, #f8f9fc);
    min-height: 80vh;
}

.course-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 40px;
    align-items: start;
}

/* Prevent grid children from overflowing their track */
.course-main,
.course-sidebar { min-width: 0; }

/* ---------- Course Hero ---------- */
.course-hero { margin-bottom: 28px; }

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--indigo, #5b6af8);
    background: var(--indigo-pale, #eef0ff);
    padding: 4px 12px;
    border-radius: 99px;
    margin-bottom: 14px;
}

.course-hero .course-title {
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 800;
    color: var(--text-primary, #111827);
    line-height: 1.3;
    margin: 0 0 12px;
    letter-spacing: -.02em;
}

.course-excerpt {
    color: #4b5563;
    font-size: .95rem;
    line-height: 1.65;
    margin-bottom: 20px;
}

.course-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    color: #374151;
}

.meta-item .text-amber { color: #f59e0b; }
.meta-item .text-indigo { color: var(--indigo, #5b6af8); }
.meta-item .text-muted  { color: #9ca3af; }

/* ---------- Video Player ---------- */
.video-player-wrapper {
    margin-bottom: 32px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,.14);
    background: #000;
}

.video-player {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
}

.video-player iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.video-caption {
    padding: 12px 20px;
    background: #111827;
    color: #9ca3af;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-caption i { color: var(--indigo, #5b6af8); }

/* ---------- Tabs ---------- */
.course-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border, #e5e7eb);
    margin-bottom: 28px;
    overflow-x: auto;
    scrollbar-width: none;
}

.course-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 20px;
    font-size: .88rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}

.tab-btn:hover { color: var(--indigo, #5b6af8); }

.tab-btn.active {
    color: var(--indigo, #5b6af8);
    border-bottom-color: var(--indigo, #5b6af8);
}

.tab-count {
    background: var(--indigo-pale, #eef0ff);
    color: var(--indigo, #5b6af8);
    font-size: .72rem;
    padding: 2px 7px;
    border-radius: 99px;
}

/* ---------- Tab Content ---------- */
.tab-content { display: none; }
.tab-content.active { display: block; }

.description-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 24px 0 12px;
}

.description-content p {
    color: #374151;
    line-height: 1.75;
    font-size: .93rem;
}

.what-learn-list,
.requirement-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.what-learn-list li,
.requirement-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .88rem;
    color: #374151;
}

.what-learn-list i { color: #10b981; flex-shrink: 0; margin-top: 3px; }
.requirement-list i { color: var(--indigo, #5b6af8); flex-shrink: 0; margin-top: 3px; }

/* ---------- Curriculum ---------- */
.curriculum-list { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; overflow: hidden; }

.curriculum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f8f9fc;
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: .88rem;
    color: #374151;
    font-weight: 600;
}

.btn-expand-all {
    background: transparent;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 5px 12px;
    font-size: .8rem;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .2s, color .2s;
}

.btn-expand-all:hover {
    background: var(--indigo-pale, #eef0ff);
    color: var(--indigo, #5b6af8);
}

.lesson-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .18s;
}

.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: #f9fafb; }
.lesson-item.free { background: #f0fdf4; }
.lesson-item.free:hover { background: #dcfce7; }

.lesson-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.lesson-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #6b7280;
    flex-shrink: 0;
}

.lesson-icon { font-size: 1rem; flex-shrink: 0; }
.free-icon   { color: #10b981; }
.locked-icon { color: #9ca3af; }

.lesson-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.lesson-title {
    font-size: .88rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.free-badge {
    font-size: .72rem;
    font-weight: 600;
    color: #059669;
    background: #d1fae5;
    padding: 1px 7px;
    border-radius: 99px;
    width: fit-content;
}

.lesson-duration {
    font-size: .8rem;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------- Instructor ---------- */
.instructor-card {
    display: flex;
    gap: 24px;
    padding: 24px;
    background: var(--white, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
}

.instructor-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instructor-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback { font-size: 3rem; color: #9ca3af; }

.instructor-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #111827;
}

.instructor-title {
    font-size: .83rem;
    color: #6b7280;
    margin: 0 0 14px;
}

.instructor-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.instructor-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .83rem;
    color: #374151;
}

.instructor-stats .stat i { color: var(--amber, #f59e0b); }

.instructor-bio {
    font-size: .88rem;
    color: #4b5563;
    line-height: 1.65;
    margin: 0;
}

/* ---------- Sidebar ---------- */
.course-sidebar { position: relative; }

.sticky-sidebar {
    position: sticky;
    top: 20px;
    background: var(--white, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.09);
}

.sidebar-thumb {
    position: relative;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    aspect-ratio: 16/9;
    overflow: hidden;
}

.sidebar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
}

.thumb-placeholder i { font-size: 3rem; color: rgba(255,255,255,.6); }
.thumb-placeholder span { color: rgba(255,255,255,.9); font-weight: 700; font-size: .95rem; }

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}

.sidebar-thumb:hover .thumb-overlay { opacity: 1; }

.btn-preview-video {
    background: rgba(255,255,255,.95);
    color: var(--indigo, #5b6af8);
    border: none;
    border-radius: 99px;
    padding: 10px 22px;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    transition: transform .15s;
}

.btn-preview-video:hover { transform: scale(1.04); }

/* Price Block */
.sidebar-price-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
    flex-wrap: wrap;
}

.price-current {
    font-size: 1.7rem;
    font-weight: 800;
    color: #dc2626;
}

.price-old {
    font-size: 1rem;
    color: #9ca3af;
    text-decoration: line-through;
}

.price-discount {
    background: #fef2f2;
    color: #dc2626;
    font-size: .78rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
}

/* CTA Buttons */
.btn-enroll {
    width: calc(100% - 48px);
    margin: 14px 24px 10px;
    justify-content: center;
    padding: 14px;
    font-size: .95rem;
    border-radius: 12px;
}

.btn-wishlist {
    width: calc(100% - 48px);
    margin: 0 24px 16px;
    justify-content: center;
    padding: 12px;
    font-size: .88rem;
    border-radius: 12px;
}

.guarantee-note {
    text-align: center;
    font-size: .78rem;
    color: #6b7280;
    margin: 0 24px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.guarantee-note i { color: #10b981; }

/* Course Info List */
.course-info-list {
    list-style: none;
    padding: 16px 24px;
    margin: 0;
    border-top: 1px solid var(--border, #e5e7eb);
    display: grid;
    gap: 10px;
}

.course-info-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
    color: #374151;
}

.course-info-list li i {
    width: 18px;
    color: var(--indigo, #5b6af8);
    flex-shrink: 0;
}

/* Share */
.sidebar-share {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--border, #e5e7eb);
    font-size: .82rem;
    color: #6b7280;
}

.share-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    color: #fff;
    transition: transform .15s, opacity .15s;
    text-decoration: none;
}

.share-btn:hover { transform: scale(1.1); opacity: .9; }
.share-btn.fb { background: #1877f2; }
.share-btn.tw { background: #1da1f2; }
.share-btn.li { background: #0a66c2; }

/* ---------- Related Courses ---------- */
.related-courses {
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--border, #e5e7eb);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

/* Thumbnail ảnh thật trong related-grid */
.related-grid .course-thumbnail {
    position: relative;
    overflow: hidden;
}
.related-grid .course-thumbnail img {
    width: 100%; height: 160px;
    object-fit: cover; display: block;
    transition: transform .35s ease;
}
.related-grid .course-card:hover .course-thumbnail img { transform: scale(1.04); }
.related-grid .course-thumb-placeholder {
    width: 100%; height: 160px;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; transition: transform .35s ease;
}
.related-grid .course-card:hover .course-thumb-placeholder { transform: scale(1.04); }
.related-grid .course-thumb-placeholder span {
    color: rgba(255,255,255,.92); font-size:.85rem; font-weight:700;
    text-align:center; line-height:1.4;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .course-layout {
        grid-template-columns: 1fr;
    }

    .course-sidebar { order: -1; }

    .sticky-sidebar { position: static; }

    .what-learn-list,
    .requirement-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .course-detail-page { padding: 20px 0 60px; }
    .course-meta-row { gap: 12px; }
    .instructor-card { flex-direction: column; }
    .related-grid { grid-template-columns: 1fr; }
    .sidebar-price-block { padding: 14px 16px 0; }
    .btn-enroll  { width: calc(100% - 32px); margin: 12px 16px 8px; }
    .btn-wishlist { width: calc(100% - 32px); margin: 0 16px 12px; }
    .guarantee-note { margin: 0 16px 12px; }
    .course-info-list { padding: 12px 16px; }
    .sidebar-share { padding: 12px 16px; }
    .what-learn-list, .requirement-list { grid-template-columns: 1fr; }
}
