/* ════════════════════════════════════════════════
   Course Detail Page — course-detail.css
   ════════════════════════════════════════════════ */

/* ── Media (video/thumbnail) ── */
.cd-media { border-radius: .75rem; overflow: hidden; }
.cd-media iframe,
.cd-media video,
.cd-media img { width: 100%; display: block; }

/* ── Title ── */
.cd-title { font-size: 1.5rem; font-weight: 700; line-height: 1.4; }

/* ── Meta row ── */
.cd-meta-item { font-size: .9rem; color: #555; white-space: nowrap; }
.cd-category-badge {
    background: #e8f0fe; color: #1a73e8 !important;
    padding: 2px 12px; border-radius: 20px;
    font-size: .8rem; text-decoration: none;
    transition: background .2s;
}
.cd-category-badge:hover { background: #d2e3fc; }

/* ── Instructor row ── */
.cd-instructor-avatar { width: 52px; height: 52px; object-fit: cover; }
.cd-instructor-bio-wrap { font-size: .88rem; }
.cd-bio-less { display: none; }
[aria-expanded="true"] .cd-bio-more { display: none; }
[aria-expanded="true"] .cd-bio-less  { display: inline; }

/* ── Sticky Nav-pills ── */
.cd-nav-wrapper {
    position: sticky;
    top: 96px;          /* ความสูง navbar */
    z-index: 100;
    background: #fff;
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
}
.cd-nav-pills {
    display: flex; gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cd-nav-pills::-webkit-scrollbar { display: none; }
.cd-nav-pill {
    padding: 10px 20px;
    font-size: .9rem;
    font-weight: 500;
    color: #747579;
    text-decoration: none;
    border-radius: 20px;
    white-space: nowrap;
    transition: all .25s ease;
}
.cd-nav-pill:hover {
    color: #066ac9;
    background: rgba(6,106,201,.06);
}
.cd-nav-pill.active {
    color: #fff !important;
    background: #066ac9;
}

/* ── Description (read more / less) ── */
.cd-desc-wrap { position: relative; max-height: 200px; overflow: hidden; transition: max-height .4s ease; }
.cd-desc-wrap.expanded { max-height: none !important; }
.cd-desc-fade {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(transparent, #fff);
    pointer-events: none;
    transition: opacity .3s;
}
.cd-desc-wrap.expanded + .btn-more .desc-more,
.cd-desc-wrap.expanded ~ .btn-more .desc-more { display: none; }
.cd-desc-wrap.expanded + .btn-more .desc-less,
.cd-desc-wrap.expanded ~ .btn-more .desc-less { display: inline; }
.cd-desc-wrap:not(.expanded) + .btn-more .desc-less,
.cd-desc-wrap:not(.expanded) ~ .btn-more .desc-less { display: none; }
.cd-desc-wrap:not(.expanded) + .btn-more .desc-more,
.cd-desc-wrap:not(.expanded) ~ .btn-more .desc-more { display: inline; }
.cd-desc-wrap.expanded .cd-desc-fade { opacity: 0; }
.btn-more { cursor: pointer; font-size: .9rem; color: #066ac9; }
.btn-more i { transition: transform .3s; }
.cd-desc-wrap.expanded ~ .btn-more i { transform: rotate(180deg); }

/* ── Curriculum ── */
.cd-accordion .accordion-button { font-size: .95rem; font-weight: 600; padding: .75rem 1rem; }
.cd-accordion .accordion-button:not(.collapsed) { background: #f8f9fa; box-shadow: none; }
.cd-accordion .accordion-body { padding: .5rem 1rem; }
.cd-video-item { font-size: .88rem; }
.cd-video-item .btn-round { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn-danger-soft { background: rgba(214, 41, 62, .1) !important; color: #d6293e !important; border: none; }

/* ── Flipbook ── */
.cd-flipbook-stage { max-width: 600px; margin: 0 auto; }

/* ── Reviews ── */
.cd-reviews-list .avatar-lg { width: 48px; height: 48px; }
.cd-reviews-list .avatar-img { width: 48px; height: 48px; object-fit: cover; }

/* ── Sidebar (desktop sticky) ── */
.cd-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: thin;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
}
/* ── Price Card Shadow ── */
.cd-price-card {
    border: none !important;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
}

/* ── Icon Buttons (Heart + Share) ── */
.cd-icon-btn {
    background: none; border: none; padding: 4px;
    font-size: 1.2rem; color: #adb5bd;
    cursor: pointer; transition: all .2s ease;
    line-height: 1;
}
.cd-icon-btn:hover { transform: scale(1.15); }
.cd-wishlist-btn:hover,
.cd-wishlist-btn:focus { color: #dc3545; }
.cd-wishlist-btn.active { color: #dc3545; }
.cd-wishlist-btn.active i { animation: wishPop .3s ease; }
@keyframes wishPop { 0%{transform:scale(1)} 50%{transform:scale(1.3)} 100%{transform:scale(1)} }
.cd-share-btn:hover,
.cd-share-btn:focus { color: #198754; }

/* ── Course Info Grid ── */
.cd-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.cd-info-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.cd-info-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #f0f6ff;
    color: #066ac9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
}
.cd-info-item small { font-size: .72rem; }
.cd-info-item .fw-semibold { font-size: .82rem; }

/* ── LINE Button ── */
.cd-line-btn {
    border-color: #06c755 !important;
    color: #06c755 !important;
}
.cd-line-btn:hover {
    background: #06c755 !important;
    color: #fff !important;
}

/* Package selection in sidebar */
.cd-pkg-item { cursor: pointer; transition: border-color .2s, background .2s; }
.cd-pkg-item:hover { border-color: #066ac9 !important; }
.cd-pkg-item.selected { border-color: #066ac9 !important; background: #f0f7ff; }

/* ── Mobile bottom bar ── */
.cd-mobile-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,.08);
    transform: translateY(100%);
    transition: transform .3s ease;
}
.cd-mobile-bar.visible { transform: translateY(0); }
.cd-mobile-price { font-size: 1.2rem; font-weight: 700; color: #066ac9; }
.cd-mobile-badge { color: #555; }

/* ── Guest modal ── */
#guestBuyModal .form-control:focus { box-shadow: 0 0 0 .15rem rgba(6,106,201,.25); }

/* ── Responsive ── */
@media (max-width: 1199.98px) {
    .cd-nav-wrapper { top: 70px; }
    /* เพิ่ม padding-bottom สำหรับ mobile bar */
    .cd-page { padding-bottom: 80px !important; }
}

@media (max-width: 575.98px) {
    .cd-title { font-size: 1.25rem; }
    .cd-meta-item { font-size: .8rem; }
    .cd-nav-pill { padding: 8px 12px; font-size: .85rem; }
}

/* ── Copy link tooltip ── */
.cd-copied-toast {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 8px 20px;
    border-radius: 20px; font-size: .85rem;
    animation: cdFadeInOut 2s forwards;
    z-index: 9999;
}
@keyframes cdFadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Share dropdown on hover (desktop) ── */
@media (min-width: 992px) {
    .cd-share-wrap:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
    }
}
