/* ═══════════════════════════════════════════════
 *  Homepage — Course Sections & Card Styles
 *  File: assets/css/homepage.css
 *  Updated: 6 Jun 2026 — v4 Netflix arrows + equal height
 * ═══════════════════════════════════════════════ */

/* ── เว้นระยะ Counter ↔ Section แรก ── */
.course-sections-area {
    padding-top: 2.5rem;
}

/* ── Section Header ── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-left: 48px;
    padding-right: 48px;
}
.section-header h4 {
    font-weight: 600;
    margin-bottom: 0;
}
.section-header .section-view-all {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}
.section-header .section-view-all:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════
 *  Slider Layout — เว้นพื้นที่ซ้าย-ขวาให้ arrow
 *  arrow อยู่นอก card ไม่ทับ
 * ═══════════════════════════════════════════════ */
.course-slider-wrapper {
    position: relative;
    /* เว้นพื้นที่ซ้าย-ขวาสำหรับ arrow */
    padding-left: 48px;
    padding-right: 48px;
}

/* ── .tns-ovh: ป้องกัน shadow ถูกตัด ── */
.course-slider-wrapper .tns-ovh {
    padding: 4px 4px 14px 4px;
    margin: -4px -4px -14px -4px;
}

/* ═══════════════════════════════════════════════
 *  Equal Height Cards
 *  tiny-slider จัดการ item height เอง
 *  card ใช้ h-100 + flexbox ภายใน card body
 * ═══════════════════════════════════════════════ */
.course-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08),
                0 1px 3px rgba(0, 0, 0, 0.06);
    background: #fff;
}

/* ── Card Body flex ── */
.course-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Thumbnail ── */
.course-card-thumb {
    position: relative;
    /* overflow: hidden; */
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
    border-radius: 0.75rem 0.75rem 0 0;
    flex-shrink: 0;
}
.course-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ═══════════════════════════════════════════════
 *  จุดที่ 5: Certificate Ribbon — มุมขวาล่าง thumbnail
 *  (vertical card ใน section ปกติ)
 * ═══════════════════════════════════════════════ */
.course-badge-cert {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #fd7e14;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 15px 0px 0px 15px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    transform: translateY(50%);
    box-shadow: 0 2px 6px rgba(253, 126, 20, 0.3);
}

/* ── Free Badge (bottom-left) ── */
.course-badge-free {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #198754;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    z-index: 2;
    letter-spacing: 0.3px;
}

/* ── Wishlist Heart (top-right) ── */
.course-btn-wish {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    z-index: 3;
    transition: all 0.2s ease;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.course-btn-wish:hover {
    color: #dc3545;
    transform: scale(1.1);
}
.course-btn-wish.active {
    color: #dc3545;
    background: none;
}
.course-btn-wish.active i {
    animation: wishPop 0.3s ease;
}
@keyframes wishPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ── Title ── */
.course-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.05em;
}
.course-card-title a {
    text-decoration: none;
}
.course-card-title a:hover {
    color: var(--bs-primary) !important;
}

/* ── Avatar ── */
.course-card-avatar {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

/* ── Instructor Name & Tagline ── */
.course-card-instructor {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--bs-body-color);
    line-height: 1.3;
}
.course-card-tagline {
    font-size: 0.73rem;
    color: #6c757d;
    line-height: 1.3;
}

/* ── Instructor block: fixed height สำหรับ equal card ── */
.course-card-instructor-block {
    min-height: 48px;
}

/* ── Price (ดัน mt-auto ลงล่าง card เสมอ) ── */
.course-card-price-block {
    margin-top: auto;
    padding-top: 0.5rem;
}
.course-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.course-price-current {
    font-size: 1.05rem;
    font-weight: 700;
    color: #dc3545;
}
.course-price-current.text-success {
    color: #198754 !important;
}
.course-price-original {
    font-size: 0.82rem;
    color: #adb5bd;
    text-decoration: line-through;
}
.course-card-meta-inline {
    font-size: 0.78rem;
    color: #6c757d;
    margin-left: auto;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
 *  Personal Section (Continue Learning / Wishlist)
 * ═══════════════════════════════════════════════ */
.personal-section-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.personal-section-header h4 {
    margin-bottom: 0;
}
.personal-section-header i {
    font-size: 1.2rem;
}

/* ═══════════════════════════════════════════════
 *  Netflix-style Arrows
 *  แถบสูงเท่า card อยู่ริมซ้าย-ขวา ไม่ทับ card
 * ═══════════════════════════════════════════════ */
.course-slider-wrapper .tns-controls {
    z-index: 5;
}
/* บังคับให้ button อ้างอิงตำแหน่งจาก .course-slider-wrapper (ไม่ใช่ .tns-outer) */
.course-slider-wrapper .tns-outer {
    position: static !important;
}
.course-slider-wrapper .tns-controls button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 120px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.04);
    color: #555;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.25s ease, color 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}
/* ── ตำแหน่ง: อยู่ใน padding area ── */
.course-slider-wrapper .tns-controls button:first-child {
    left: -15px;
}
.course-slider-wrapper .tns-controls button:last-child {
    right: -15px;
}

/* ── Hover: เด่นขึ้น ── */
.course-slider-wrapper .tns-controls button:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
    color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── Active: กดลง ── */
.course-slider-wrapper .tns-controls button:active {
    background: rgba(0, 0, 0, 0.12);
    color: #111;
}

/* ── Disabled: ซ่อน ── */
.course-slider-wrapper .tns-controls button[disabled] {
    opacity: 0 !important;
    pointer-events: none;
    visibility: hidden;
}

/* ── ซ่อน dots ── */
.course-slider-wrapper .tns-nav {
    display: none !important;
}

/* ═══════════════════════════════════════════════
 *  Dark Mode
 * ═══════════════════════════════════════════════ */
[data-bs-theme="dark"] .course-card {
    background: var(--bs-body-bg);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25),
                0 1px 3px rgba(0, 0, 0, 0.15);
}
[data-bs-theme="dark"] .course-card-thumb {
    background: #1a1a2e;
}
[data-bs-theme="dark"] .course-badge-cert {
    background: rgba(25, 135, 84, 0.85);
}
[data-bs-theme="dark"] .course-btn-wish {
    background: rgba(33, 37, 41, 0.85);
    color: #adb5bd;
}
[data-bs-theme="dark"] .course-btn-wish.active {
    color: #dc3545;
    background: rgba(33, 37, 41, 0.9);
}
[data-bs-theme="dark"] .course-card-limits span {
    background: rgba(255,255,255,0.06);
    color: #adb5bd;
}
[data-bs-theme="dark"] .course-card-avatar {
    border-color: rgba(255,255,255,0.1);
}
[data-bs-theme="dark"] .personal-section-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.06) 100%);
}
[data-bs-theme="dark"] .course-slider-wrapper .tns-controls button {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.1);
    color: #ccc;
}
[data-bs-theme="dark"] .course-slider-wrapper .tns-controls button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ═══════════════════════════════════════════════
 *  Horizontal Card (คอร์สที่เรียนล่าสุด / ถูกใจ)
 *  Card: 348x112 (+4px progress), Thumb: 156x96
 * ═══════════════════════════════════════════════ */
.course-h-card {
    width: 348px;
    height: 112px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fff;
    flex-shrink: 0;
}
.course-h-card.has-progress {
    height: 112px;
}
.course-h-inner {
    display: flex;
    height: 112px;
    padding: 8px;
    gap: 10px;
}

/* ── Thumbnail + Overlay ── */
.course-h-thumb {
    width: 156px;
    min-width: 156px;
    height: 96px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    display: block;
    position: relative;
}
.course-h-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.course-h-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.course-h-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
}
.course-h-icon-circle i {
    font-size: 1.4rem;
}
.course-h-icon-circle .bi-play-fill {
    color: #d6293e;
    margin-left: 3px;
}
.course-h-icon-circle .bi-cart-plus-fill {
    color: #198754;
}

/* ── Info body ── */
.course-h-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ── Title ── */
.course-h-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 4px;
}
.course-h-title a:hover { color: var(--bs-primary) !important; }

/* ── Meta ── */
.course-h-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: #6c757d;
    margin-bottom: 2px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.course-h-meta i { font-size: 0.65rem; }
.course-h-cert-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Instructor ── */
.course-h-instructor {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}
.course-h-instructor img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e9ecef;
}
.course-h-instructor span {
    font-size: 0.72rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Wishlist: X remove (มุมขวาบน) ── */
.course-h-remove {
    position: absolute;
    right: 0px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}
.course-h-remove:hover {
    background: rgba(220, 53, 69, 0.25);
}

/* ── Wishlist: ราคา + ชม. + อายุ ── */
.course-h-price {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.course-h-price-now {
    font-size: 0.78rem;
    font-weight: 700;
    color: #dc3545;
    white-space: nowrap;
}
.course-h-price-old {
    font-size: 0.68rem;
    color: #adb5bd;
    text-decoration: line-through;
    white-space: nowrap;
}
.course-h-price-meta {
    font-size: 0.68rem;
    color: #6c757d;
    white-space: nowrap;
}

/* ── Progress bar ── */
.course-h-progress {
    height: 4px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}
.course-h-progress-bar {
    height: 100%;
    background: #066ac9;
    border-radius: 4px;
    transition: width 0.4s ease;
    /*min-width: 2px;/*
}

/* ── Responsive ── */
@media (max-width: 575.98px) {
    .course-h-card { width: 310px; height: 104px; }
    .course-h-card.has-progress { height: 108px; }
    .course-h-inner { height: 104px; padding: 6px; gap: 8px; }
    .course-h-thumb { width: 130px; min-width: 130px; height: 92px; }
    .course-h-title { font-size: 0.78rem; }
    .course-h-meta { font-size: 0.65rem; }
}

/* ── Navbar Sticky ── */
.navbar-sticky-top {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Bell/Avatar spacing ── */
.navbar-nav.ms-3 { gap: 10px !important; }
