/* ============================================================
   courses.css — Courses listing page
   Place at: public/assets/hft/courses.css
   Full LTR + RTL direction-aware
   ============================================================ */

:root {
    --blue: #006aa3;
    --blue-dark: #004f7a;
    --blue-light: #e8f4fb;
    --blue-mid: #0080c4;
    --text: #0f1923;
    --muted: #64748b;
    --border: #e2eaf2;
    --bg: #f4f7fb;
    --white: #ffffff;
    --gold: #f59e0b;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 106, 163, 0.07);
    --shadow-hover: 0 12px 40px rgba(0, 106, 163, 0.14);
}

.courses-page {
    background: var(--bg);
    min-height: 100vh;
}

/* ============================================================
   HERO
   ============================================================ */
.courses-hero {
    position: relative;
    height: 300px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.courses-hero-bg {
    position: absolute;
    inset: 0;
}

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

.courses-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,79,122,0.88) 0%, rgba(0,106,163,0.75) 100%);
}

.courses-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

.courses-hero-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.courses-hero-title {
    font-size: clamp(22px, 4vw, 40px);
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.25;
}

.courses-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 16px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.courses-count-num {
    font-weight: 800;
    font-size: 16px;
}

/* Search bar */
.courses-search-form {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.courses-search-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 6px 6px 6px 16px;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

[dir="rtl"] .courses-search-inner {
    padding: 6px 16px 6px 6px;
}

.courses-search-icon {
    width: 18px;
    height: 18px;
    stroke: var(--muted);
    flex-shrink: 0;
}

.courses-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text);
    background: transparent;
    font-family: inherit;
    min-width: 0;
}

.courses-search-input::placeholder { color: #b0bec5; }

.courses-search-btn {
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.courses-search-btn:hover { background: var(--blue-dark); }

/* ============================================================
   BODY LAYOUT
   ============================================================ */
.courses-body {
    padding: 36px 0 64px;
}

.courses-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    align-items: start;
}

[dir="rtl"] .courses-layout {
    grid-template-columns: 280px 1fr;
}

@media (max-width: 991px) {
    .courses-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.courses-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 24px;
}

.sidebar-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sidebar-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: #fafcfe;
}

.sidebar-card-header svg {
    width: 18px;
    height: 18px;
    stroke: var(--blue);
    flex-shrink: 0;
}

.sidebar-card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

/* Filter list */
.filter-list {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    position: relative;
    user-select: none;
}

.category-filter-item {
    align-items: center;
}

.filter-category-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    border-radius: 8px;
    background: #eef8fb;
}

.filter-category-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.filter-item:hover {
    background: var(--blue-light);
}

.filter-item.active {
    background: var(--blue-light);
    color: var(--blue);
}

.filter-item.active .filter-count {
    background: var(--blue);
    color: #fff;
}

/* Hide native inputs */
.filter-item input[type="radio"],
.filter-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.filter-item-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    gap: 8px;
}

.filter-item.active .filter-item-text {
    color: var(--blue);
    font-weight: 600;
}

.filter-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--border);
    color: var(--muted);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.18s ease, color 0.18s ease;
}

/* Arrow toggle */
.filter-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--border);
    flex-shrink: 0;
    transition: transform 0.25s ease, background 0.2s ease;
    cursor: pointer;
    z-index: 1;
}

.filter-arrow svg { stroke: var(--muted); transition: stroke 0.2s ease; }
.filter-arrow.open { transform: rotate(180deg); background: var(--blue-light); }
.filter-arrow.open svg { stroke: var(--blue); }

/* Subcategory list */
.subcategory-list {
    padding: 4px 8px 8px;
    border-top: 1px dashed var(--border);
    background: #fafcfe;
    display: none;
}

.filter-subitem {
    padding: 7px 8px 7px 20px;
    font-size: 12.5px;
}

[dir="rtl"] .filter-subitem {
    padding: 7px 20px 7px 8px;
}

.filter-subitem .filter-item-text {
    font-size: 12.5px;
}

/* Rating */
.filter-stars {
    display: flex;
    align-items: center;
    gap: 2px;
}

.filter-rating-text {
    font-size: 12px;
    color: var(--muted);
    margin-inline-start: 4px;
}

.filter-item.active .filter-rating-text {
    color: var(--blue);
}

/* Reset button */
.sidebar-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    background: #fff;
    border: 1.5px solid #fca5a5;
    border-radius: var(--radius);
    color: #ef4444;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
}

.sidebar-reset-btn:hover {
    background: #fff5f5;
    color: #dc2626;
}

.sidebar-reset-btn svg { stroke: currentColor; flex-shrink: 0; }

/* ============================================================
   COURSES MAIN
   ============================================================ */
.courses-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Training package cards */
.category-showcase {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.category-showcase-card {
    min-height: 104px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.category-showcase-card:hover,
.category-showcase-card.active {
    border-color: var(--blue);
    box-shadow: var(--shadow-hover);
    color: var(--text);
    transform: translateY(-2px);
}

.category-showcase-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 106, 163, 0.1), rgba(0, 166, 166, 0.14));
}

.category-showcase-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.category-showcase-icon-all {
    color: var(--blue);
}

.category-showcase-icon-all svg {
    stroke: currentColor;
}

.category-showcase-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-showcase-body strong {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    color: var(--text);
}

.category-showcase-body small {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.category-showcase-card.active .category-showcase-body strong,
.category-showcase-card:hover .category-showcase-body strong {
    color: var(--blue);
}

/* Results bar */
.courses-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px 18px;
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    gap: 16px;
    flex-wrap: wrap;
}

.results-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.results-in {
    color: var(--blue);
    margin-inline-start: 4px;
}

.results-view-toggle {
    display: flex;
    gap: 4px;
}

.view-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.view-btn:hover, .view-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.view-btn svg { stroke: currentColor; }

/* Courses grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .courses-grid { grid-template-columns: repeat(2, 1fr); }
    .category-showcase { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 575px) {
    .courses-grid { grid-template-columns: 1fr; }
    .category-showcase { grid-template-columns: 1fr; }
    .category-showcase-card { min-height: 86px; }
}

.course-grid-item {
    animation: cardFadeIn 0.35s ease both;
}

.course-grid-item:nth-child(1) { animation-delay: 0.05s; }
.course-grid-item:nth-child(2) { animation-delay: 0.10s; }
.course-grid-item:nth-child(3) { animation-delay: 0.15s; }
.course-grid-item:nth-child(4) { animation-delay: 0.20s; }
.course-grid-item:nth-child(5) { animation-delay: 0.25s; }
.course-grid-item:nth-child(6) { animation-delay: 0.30s; }

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Course list */
.courses-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Empty state */
.courses-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
    background: var(--white);
    border-radius: var(--radius);
    border: 1.5px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.courses-empty svg { stroke: var(--border); }
.courses-empty p { font-size: 15px; font-weight: 600; margin: 0; }

/* Pagination */
.courses-pagination {
    padding-top: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
    .courses-sidebar {
        position: static;
    }

    .courses-hero { height: 240px; }

    .courses-results-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .category-showcase {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .courses-hero { height: 200px; }
    .courses-hero-title { font-size: 20px; }
    .courses-search-inner { border-radius: 14px; }
    .category-showcase { grid-template-columns: 1fr; }
}

/* ============================================================
   LTR SPECIFIC FIXES
   ============================================================ */
[dir="ltr"] .courses-hero-content { text-align: center; }
[dir="ltr"] .filter-subitem { padding-left: 20px; padding-right: 8px; }
[dir="ltr"] .results-in { margin-left: 4px; margin-right: 0; }
/* ── Tab active state fix ── */
.csd-tab-link {
    /* Remove Bootstrap's default active bg that conflicts */
    background: transparent !important;
}

.csd-tab-link.active {
    color: var(--blue) !important;
    border-bottom-color: var(--blue) !important;
    background: transparent !important;
}

.csd-tab-link:not(.active) {
    color: var(--muted) !important;
    border-bottom-color: transparent !important;
}

/* ============================================================
   HFT TEMPLATE REFRESH
   ============================================================ */
:root {
    --blue: #2f9f98;
    --blue-dark: #135d58;
    --blue-light: #e7f7f5;
    --blue-mid: #49b4ae;
    --text: #12312f;
    --muted: #64706f;
    --border: #dbe8e6;
    --bg: #f5f8f7;
    --gold: #d99a2b;
    --shadow: 0 10px 30px rgba(19, 93, 88, 0.08);
    --shadow-hover: 0 18px 42px rgba(19, 93, 88, 0.14);
}

.courses-page {
    background:
        linear-gradient(180deg, #eef7f5 0, #f7faf9 380px, #f5f8f7 100%);
}

.courses-hero {
    min-height: 430px;
    height: auto;
    padding: 74px 0 48px;
    background:
        radial-gradient(circle at 12% 24%, rgba(217, 154, 43, 0.18), transparent 28%),
        radial-gradient(circle at 85% 16%, rgba(73, 180, 174, 0.2), transparent 32%),
        linear-gradient(135deg, #12312f 0%, #1a6b65 54%, #49b4ae 100%);
    isolation: isolate;
}

.courses-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
    opacity: 0.42;
    z-index: -1;
}

.courses-hero-inner {
    position: relative;
}

.courses-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 34px;
    align-items: center;
}

.courses-hero-content {
    max-width: 760px;
    margin: 0;
    text-align: start;
}

.courses-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    color: #e4fffb;
    font-size: 13px;
    font-weight: 800;
}

.courses-hero-title {
    max-width: 700px;
    margin: 18px 0 14px;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.12;
    font-weight: 900;
    color: #fff;
}

.courses-hero-lead {
    max-width: 640px;
    margin: 0;
    color: rgba(255,255,255,0.82);
    font-size: 17px;
    line-height: 1.9;
    font-weight: 500;
}

.courses-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
    max-width: 560px;
}

.courses-stat-pill {
    min-height: 84px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.12);
    color: #fff;
    backdrop-filter: blur(10px);
}

.courses-stat-pill strong {
    display: block;
    font-size: 24px;
    line-height: 1;
    font-weight: 900;
}

.courses-stat-pill small {
    display: block;
    margin-top: 8px;
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    font-weight: 800;
}

.courses-hero-panel {
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.96);
    padding: 22px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.courses-hero-panel-head {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.courses-hero-panel-head span {
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
}

.courses-hero-panel-head small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.courses-search-form {
    max-width: none;
}

.courses-search-inner {
    border-radius: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    box-shadow: none;
    gap: 8px;
}

[dir="rtl"] .courses-search-inner {
    padding: 8px;
}

.courses-search-icon {
    margin-inline-start: 6px;
    stroke: var(--blue);
}

.courses-search-btn {
    border-radius: 8px;
    background: var(--blue-dark);
    padding: 11px 22px;
}

.courses-search-btn:hover {
    background: #0f4f4a;
}

.courses-hero-quick {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.courses-hero-quick a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--blue-light);
    color: var(--blue-dark);
    text-decoration: none;
    font-size: 12px;
    font-weight: 900;
}

.courses-body {
    padding: 30px 0 70px;
}

.courses-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.88);
    box-shadow: var(--shadow);
}

.courses-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid var(--blue);
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

.courses-filter-label b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 8px;
    background: #fff;
    color: var(--blue-dark);
    font-size: 12px;
}

.courses-filter-summary {
    flex: 1;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.courses-filter-summary strong {
    color: var(--blue-dark);
    margin-inline-start: 6px;
}

.courses-filter-reset-inline {
    color: #b45309;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.courses-layout {
    grid-template-columns: 1fr;
    gap: 20px;
}

.sidebar-card {
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.sidebar-card-header {
    padding: 15px 16px;
    background: linear-gradient(135deg, #ffffff, #f1fbf9);
}

.filter-list {
    padding: 12px;
    gap: 6px;
}

.filter-item {
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #fff;
}

.filter-item:hover,
.filter-item.active {
    border-color: rgba(73, 180, 174, 0.32);
    background: #f1fbf9;
}

.filter-category-icon {
    border-radius: 8px;
    background: #edf8f6;
}

.filter-count {
    background: #edf2f1;
}

.subcategory-list {
    margin: 2px 0 8px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #fbfdfd;
}

.sidebar-reset-btn {
    border-radius: 8px;
}

.category-showcase {
    gap: 10px;
}

.courses-horizontal-filters {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,0.92);
    box-shadow: var(--shadow);
}

.courses-horizontal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.courses-horizontal-head span,
.courses-horizontal-head small {
    display: block;
}

.courses-horizontal-head span {
    color: var(--text);
    font-size: 16px;
    font-weight: 900;
}

.courses-horizontal-head small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.courses-horizontal-head a {
    flex-shrink: 0;
    color: #b45309;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.category-showcase-card {
    min-height: 92px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: none;
}

.category-showcase-card:hover,
.category-showcase-card.active {
    border-color: var(--blue);
    box-shadow: var(--shadow-hover);
}

.category-showcase-icon {
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(73, 180, 174, 0.14), rgba(217, 154, 43, 0.12));
}

.courses-results-bar {
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: none;
}

.view-btn {
    border-radius: 8px;
}

.view-btn:hover,
.view-btn.active {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

@media (max-width: 991px) {
    .courses-hero {
        min-height: 0;
        padding: 48px 0 34px;
    }

    .courses-hero-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .courses-hero-title {
        font-size: 34px;
    }

    .courses-hero-stats {
        max-width: none;
    }

    .courses-layout {
        grid-template-columns: 1fr;
    }

    .category-showcase {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .courses-hero {
        padding: 38px 0 28px;
    }

    .courses-hero-title {
        font-size: 28px;
    }

    .courses-hero-lead {
        font-size: 14px;
        line-height: 1.8;
    }

    .courses-hero-stats {
        grid-template-columns: 1fr;
    }

    .courses-stat-pill {
        min-height: 66px;
    }

    .courses-hero-panel {
        padding: 16px;
    }

    .courses-search-inner {
        flex-wrap: wrap;
    }

    .courses-search-input {
        flex-basis: calc(100% - 34px);
    }

    .courses-search-btn {
        width: 100%;
    }

    .courses-filter-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .courses-filter-label,
    .courses-filter-summary,
    .courses-filter-reset-inline {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .courses-horizontal-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
