/*
 * Course detail page (/course/{slug}), Phase 144.
 *
 * Built to read as the next step after /courses/{category}: the same green band over a photo,
 * the same sideways card overlapping it, the same notice, "why choose" and call-to-action
 * bands. Every rule is scoped to .cd-page because the page still carries legacy class names
 * (.eBtn, .gradient, .ps-box, .g-title) that the rest of the LMS depends on, and the wishlist
 * script toggles .gradient and .learn-btn by name.
 */

/* ---------- Hero ---------- */
.cd-page .cd-hero {
    position: relative;
    padding: 30px 40px 72px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}
.cd-page .cd-hero.has-photo { background: none; }
/* The gradient stays over the photo at .88 so white text keeps its contrast on any banner. */
.cd-page .cd-hero.has-photo::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(135deg, rgba(0, 85, 42, .88) 0%, rgba(0, 58, 29, .88) 100%), var(--hero-photo);
    background-size: cover;
    background-position: center;
}
.cd-page .cd-hero > * { position: relative; z-index: 1; }
.cd-page .cd-hero .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 auto 12px;
    max-width: 900px;
    padding: 0;
    background: none;
    font-size: 14px;
}
.cd-page .cd-hero .breadcrumb-item,
.cd-page .cd-hero .breadcrumb-item a { color: #fff; text-decoration: none; }
.cd-page .cd-hero .breadcrumb-item a:hover { text-decoration: underline; }
.cd-page .cd-hero .breadcrumb-item.active { color: rgba(255, 255, 255, .8); }
.cd-page .cd-hero .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .6); }
.cd-page .cd-hero h1 {
    max-width: 1000px;
    margin: 0 auto 8px;
    color: #fff;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.5px;
}
.cd-page .cd-hero p {
    max-width: 760px;
    margin: 0 auto;
    color: #fff;
    font-size: 15.5px;
    line-height: 1.55;
    opacity: .9;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Sideways card overlapping the hero ---------- */
.cd-page .cd-showcase {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: -44px auto 30px;
    padding: 0 20px;
}
.cd-page .cd-card {
    display: grid;
    grid-template-columns: 42% 58%;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .1);
}
.cd-page .cd-card-img {
    position: relative;
    min-height: 320px;
    overflow: hidden;
    background: var(--section-bg);
}
.cd-page .cd-card-img picture { display: contents; }
.cd-page .cd-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cd-page .cd-card-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--cta-btn-bg);
    color: var(--cta-btn-text);
    font-size: 12px;
    font-weight: 700;
}
.cd-page .cd-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: var(--cta-btn-bg);
    color: var(--cta-btn-text);
    font-size: 20px;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .3);
}
.cd-page .cd-card-price {
    position: absolute;
    right: 14px;
    bottom: 14px;
    padding: 7px 15px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .78);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    text-align: right;
}
.cd-page .cd-card-price del { margin-left: 6px; font-size: 13px; font-weight: 500; opacity: .75; }
.cd-page .cd-card-price small { display: block; font-size: 11.5px; font-weight: 500; opacity: .85; }

.cd-page .cd-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 26px 30px;
}
.cd-page .cd-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 10px;
    color: #888;
    font-size: 13px;
}
.cd-page .cd-card-meta i { margin-right: 5px; color: var(--accent); }
.cd-page .cd-card-meta .cd-star { color: var(--star-color); }
.cd-page .cd-card-meta .cd-star-empty { color: #cfd3da; }
.cd-page .cd-card-title {
    margin: 0 0 16px;
    color: var(--accent);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.3px;
}
.cd-page .cd-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
.cd-page .cd-facts li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(0, 150, 57, .2);
    border-radius: 10px;
    background: var(--section-bg);
}
.cd-page .cd-facts i { flex: 0 0 auto; width: 18px; color: var(--accent); text-align: center; }
.cd-page .cd-fact-label { display: block; color: #888; font-size: 11.5px; line-height: 1.3; }
.cd-page .cd-fact-value {
    display: block;
    overflow-wrap: anywhere;
    color: var(--heading-color);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}
.cd-page .cd-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}
.cd-page .cd-instructor {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
}
.cd-page .cd-instructor img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.cd-page .cd-actions { display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.cd-page .cd-share {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 14px;
    color: #888;
    font-size: 13px;
}
.cd-page .cd-share a { color: var(--accent); font-size: 18px; }
.cd-page .cd-share a:hover { color: var(--accent-dark); }

/* ---------- Buttons: .gradient is the legacy purple, .learn-btn the legacy secondary ---------- */
.cd-page .eBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 26px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all .3s ease;
}
.cd-page .eBtn.gradient,
.cd-page input.eBtn.gradient {
    border: 0;
    background: var(--cta-btn-bg);
    background-image: none;
    color: var(--cta-btn-text);
    box-shadow: 0 4px 15px rgba(255, 192, 0, .35);
}
.cd-page .eBtn.gradient:hover {
    background: var(--cta-btn-hover);
    color: var(--cta-btn-text);
    transform: translateY(-2px);
}
.cd-page .eBtn.learn-btn,
.cd-page .eBtn.cd-btn-sub.gradient {
    border: 2px solid var(--cta-btn-bg);
    background: transparent;
    color: var(--cta-btn-text);
    box-shadow: none;
    font-weight: 600;
}
.cd-page .eBtn.learn-btn:hover,
.cd-page .eBtn.cd-btn-sub.gradient:hover {
    background: var(--cta-btn-bg);
    color: var(--cta-btn-text);
    transform: translateY(-2px);
}

/* ---------- Tabbed content ---------- */
.cd-page .cd-body {
    max-width: 1200px;
    margin: 0 auto 50px;
    padding: 0 20px;
}
.cd-page .cd-tabs {
    padding: 8px 30px 34px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .08);
}
.cd-page #pills-tab {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
    overflow-x: auto;
    border-bottom: 2px solid #eef0f4;
    scrollbar-width: none;
}
.cd-page #pills-tab .nav-item { flex: 0 0 auto; margin: 0; }
.cd-page #pills-tab .nav-item::before,
.cd-page #pills-tab .nav-item::after { display: none; }
.cd-page #pills-tab .nav-link {
    margin-bottom: -2px;
    padding: 14px 18px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: none;
    color: #666;
    font-size: 15px;
    font-weight: 600;
}
.cd-page #pills-tab .nav-link:hover { color: var(--accent); }
.cd-page #pills-tab .nav-link.active {
    border-bottom-color: var(--accent);
    background: none;
    color: var(--accent);
}
.cd-page .ps-box {
    margin-top: 26px;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
}
.cd-page .g-title {
    padding: 0;
    margin: 0 0 16px;
    border: 0;
    background: none;
    color: var(--accent);
    -webkit-text-fill-color: currentColor;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.3px;
}
.cd-page .editor-content,
.cd-page .editor-content p,
.cd-page .editor-content li { color: var(--body-text); font-size: 15.5px; line-height: 1.7; }
.cd-page .s_stext { margin-top: 14px; color: var(--accent); font-weight: 600; text-decoration: none; }
.cd-page .s_stext:hover { color: var(--accent-dark); }

.cd-page .accordion-item {
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid rgba(36, 47, 103, .08);
    border-radius: 10px;
}
.cd-page .accordion-button {
    padding: 14px 18px;
    background: #fff;
    color: var(--heading-color);
    font-size: 15.5px;
    font-weight: 600;
    box-shadow: none;
}
.cd-page .accordion-button:not(.collapsed) { background: var(--section-bg); color: var(--accent); box-shadow: none; }
.cd-page .accordion-button:focus { box-shadow: inset 0 0 0 2px rgba(0, 150, 57, .25); }
/* The shared minus.svg is blue, so it is used as a mask to take the green accent. */
.cd-page .accordion-button:not(.collapsed)::after {
    background: var(--accent);
    -webkit-mask: url(../image/minus.svg) center / 17px no-repeat;
    mask: url(../image/minus.svg) center / 17px no-repeat;
}
.cd-page .accordion-body { padding-top: 14px; }
.cd-page .lesson-list li a,
.cd-page .lesson-list li a p { color: var(--body-text); }
.cd-page .requirment ul li i { background: none; color: var(--accent); }
.cd-page .re-star i { color: var(--star-color); }
.cd-page #remove-stars {
    background: none;
    box-shadow: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}
.cd-page .write-review .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 150, 57, .12); }

/* ---------- Same closing bands as the category page ---------- */
.cd-page .cd-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto 50px;
    padding: 18px 22px;
    border-left: 4px solid var(--notice-border);
    border-radius: 8px;
    background: var(--notice-bg);
}
.cd-page .cd-notice i { margin-top: 3px; color: var(--notice-border); font-size: 18px; }
.cd-page .cd-notice p { margin: 0; color: var(--body-text); font-size: 14px; line-height: 1.6; }
.cd-page .cd-notice strong { color: var(--heading-color); }
.cd-page .cd-info { padding: 55px 40px; background: var(--section-bg); text-align: center; }
.cd-page .cd-info-inner { max-width: 1100px; margin: 0 auto; }
.cd-page .cd-info h2 { margin: 0 0 10px; color: var(--accent); font-size: 28px; font-weight: 800; }
.cd-page .cd-info-inner > p { max-width: 700px; margin: 0 auto 30px; color: #666; font-size: 16px; line-height: 1.6; }
.cd-page .cd-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cd-page .cd-feature {
    padding: 28px 22px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--card-shadow);
}
.cd-page .cd-feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 21px;
}
.cd-page .cd-feature h3 { margin: 0 0 8px; color: var(--heading-color); font-size: 17px; font-weight: 700; }
.cd-page .cd-feature p { margin: 0; color: #666; font-size: 14px; line-height: 1.6; }
.cd-page .cd-cta {
    padding: 50px 40px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    text-align: center;
}
.cd-page .cd-cta h2 { margin: 0 0 10px; color: #fff; font-size: 28px; font-weight: 800; }
.cd-page .cd-cta p { margin: 0 0 22px; color: #fff; font-size: 16px; opacity: .9; }
.cd-page .cd-cta-btn {
    display: inline-block;
    padding: 14px 35px;
    border-radius: 8px;
    background: var(--cta-btn-bg);
    color: var(--cta-btn-text);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all .3s ease;
}
.cd-page .cd-cta-btn:hover { background: var(--cta-btn-hover); color: var(--cta-btn-text); transform: translateY(-2px); }

@media (max-width: 991px) {
    .cd-page .cd-card { grid-template-columns: 1fr; }
    .cd-page .cd-card-img { min-height: 0; aspect-ratio: 16 / 9; }
}
@media (max-width: 768px) {
    .cd-page .cd-hero { padding: 22px 16px 66px; }
    /* The long course title is the h1 right below, so the crumb trail stops at Courses on phones. */
    .cd-page .cd-hero .breadcrumb-item.active { display: none; }
    .cd-page .cd-hero h1 { font-size: 23px; }
    .cd-page .cd-hero p { font-size: 14.5px; }
    .cd-page .cd-showcase, .cd-page .cd-body { padding: 0 12px; }
    .cd-page .cd-card-body { padding: 20px 16px; }
    .cd-page .cd-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cd-page .cd-actions { flex-basis: 100%; }
    .cd-page .cd-actions .eBtn { width: 100%; }
    .cd-page .cd-share { justify-content: center; }
    .cd-page .cd-tabs { padding: 4px 16px 24px; }
    .cd-page .cd-notice { margin: 0 12px 36px; }
    .cd-page .cd-info, .cd-page .cd-cta { padding: 40px 16px; }
    .cd-page .cd-info h2, .cd-page .cd-cta h2 { font-size: 23px; }
    .cd-page .cd-features { grid-template-columns: 1fr; gap: 16px; }
}
