/**
 * Related Course Section — related-course.css
 * Prefix: etrc- (Etinion Related Course)
 */

/* ══════════════════════════════════════════════════════
   1. SECTION CONTAINER
   ══════════════════════════════════════════════════════ */

.etrc-section {
    padding: 48px 0 56px;
    background: var(--bg-secondary, #F5F5F7);
}

/* T2 wrapper — inside sc-t2-section the etrc-section should blend in */
.sc-t2-section .etrc-section {
    padding: 0;
    background: transparent;
}

.sc-t2-section .etrc-section .etrc-container {
    max-width: 100%;
    padding: 0;
}

.etrc-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.etrc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.etrc-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #1A1D1F);
    margin: 0;
    line-height: 1.3;
}

/* ══════════════════════════════════════════════════════
   2. CAROUSEL VIEWPORT
   ══════════════════════════════════════════════════════ */

.etrc-viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
}

.etrc-section.is-dragging .etrc-viewport {
    cursor: grabbing !important;
}

.etrc-track {
    display: flex;
    align-items: stretch;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: var(--etrc-gap, 20px);
}

.etrc-section.is-dragging .etrc-track {
    transition: none !important;
}

.etrc-track img,
.etrc-track a {
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
}

.etrc-track a img {
    pointer-events: none;
}

.etrc-slide {
    flex: 0 0 auto;
    display: flex;
    height: auto;
    min-width: 0;
    width: var(--etrc-slide-w, 32%);
    max-width: var(--etrc-slide-w, 32%);
}

.etrc-slide > * {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* ══════════════════════════════════════════════════════
   3. GRID MODE
   ══════════════════════════════════════════════════════ */

.etrc-grid {
    display: grid;
    grid-template-columns: repeat(var(--etrc-cols, 3), 1fr);
    gap: var(--etrc-gap, 20px);
}

/* Horizontal scroll mode */
.etrc-grid.etrc-hscroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--etrc-gap, 20px);
    padding-bottom: 4px;
}

.etrc-grid.etrc-hscroll::-webkit-scrollbar {
    display: none;
}

.etrc-grid.etrc-hscroll .etrc-card-wrap {
    flex: 0 0 auto;
    width: var(--etrc-hscroll-w, 32%);
    scroll-snap-align: start;
}

/* ══════════════════════════════════════════════════════
   4. CARD
   ══════════════════════════════════════════════════════ */

.etrc-card {
    background: #fff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Thumbnail */
.etrc-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
}

.etrc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.etrc-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    line-height: 1.3;
}

/* Body */
.etrc-body {
    padding: 14px 16px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.etrc-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1A1D1F);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.etrc-card-title a {
    color: inherit;
    text-decoration: none;
}

/* Meta */
.etrc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 12.5px;
    color: var(--text-secondary, #6F767E);
}

.etrc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.etrc-meta-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Footer */
.etrc-footer {
    padding: 12px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.etrc-price-free {
    font-size: 15px;
    font-weight: 700;
    color: var(--success-color, #51CF66);
}

.etrc-price-subscription {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color, #6C5DD3);
}

.etrc-price-current {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #1A1D1F);
}

.etrc-price-original {
    font-size: 12.5px;
    color: var(--text-tertiary, #9A9FA5);
    text-decoration: line-through;
    margin-left: 6px;
}

.etrc-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #f5a623;
}

.etrc-rating svg {
    width: 14px;
    height: 14px;
    fill: #f5a623;
    flex-shrink: 0;
}

.etrc-rating-count {
    font-weight: 400;
    color: var(--text-secondary, #6F767E);
    font-size: 12px;
}

/* ══════════════════════════════════════════════════════
   5. NAVIGATION — ARROWS & DOTS
   ══════════════════════════════════════════════════════ */

.etrc-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.2s ease;
    padding: 0;
}

.etrc-nav-arrow:hover {
    background: var(--primary-color, #6C5DD3);
    border-color: var(--primary-color, #6C5DD3);
    color: #fff;
}

.etrc-nav-arrow:hover svg {
    stroke: #fff;
}

.etrc-nav-arrow svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-primary, #1A1D1F);
    fill: none;
    stroke-width: 2;
    transition: stroke 0.2s ease;
}

.etrc-nav-prev {
    left: -6px;
}

.etrc-nav-next {
    right: -6px;
}

.etrc-nav-arrow.is-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Dots */
.etrc-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.etrc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
}

.etrc-dot.is-active {
    background: var(--primary-color, #6C5DD3);
    width: 24px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════════════
   6. SKELETON LOADING
   ══════════════════════════════════════════════════════ */

.etrc-skeleton-wrap {
    display: flex;
    gap: var(--etrc-gap, 20px);
    overflow: hidden;
}

.etrc-skeleton-card {
    flex: 0 0 var(--etrc-slide-w, 32%);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.etrc-skeleton-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: etrc-shimmer 1.5s infinite ease-in-out;
}

.etrc-skeleton-body {
    padding: 14px 16px;
}

.etrc-skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: etrc-shimmer 1.5s infinite ease-in-out;
    border-radius: 6px;
    margin-bottom: 10px;
}

.etrc-skeleton-line.w70 {
    width: 70%;
}

.etrc-skeleton-line.w50 {
    width: 50%;
}

.etrc-skeleton-line.w40 {
    width: 40%;
}

.etrc-skeleton-line.w90 {
    width: 90%;
}

.etrc-skeleton-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.etrc-skeleton-meta-item {
    height: 10px;
    width: 60px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: etrc-shimmer 1.5s infinite ease-in-out;
    border-radius: 4px;
}

.etrc-skeleton-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.etrc-skeleton-price {
    height: 14px;
    width: 80px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: etrc-shimmer 1.5s infinite ease-in-out;
    border-radius: 4px;
}

@keyframes etrc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════
   7. RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media screen and (max-width: 1024px) {
    .etrc-section {
        padding: 36px 0 44px;
    }

    .etrc-title {
        font-size: 20px;
    }

    .etrc-nav-arrow {
        width: 34px;
        height: 34px;
    }

    .etrc-nav-arrow svg {
        width: 16px;
        height: 16px;
    }

    .etrc-nav-prev {
        left: -4px;
    }

    .etrc-nav-next {
        right: -4px;
    }
}

@media screen and (max-width: 768px) {
    .etrc-section {
        padding: 28px 0 36px;
    }

    .etrc-container {
        padding: 0 16px;
    }

    .etrc-title {
        font-size: 18px;
    }

    .etrc-header {
        margin-bottom: 16px;
    }

    .etrc-nav-arrow {
        display: none;
    }

    .etrc-card-title {
        font-size: 14px;
    }

    .etrc-meta {
        font-size: 11.5px;
        gap: 4px 10px;
    }

    .etrc-footer {
        padding: 10px 14px 12px;
    }

    .etrc-price-current {
        font-size: 14px;
    }

    .etrc-dots {
        margin-top: 16px;
    }
}
