/* ============================================================
   Edufen Course Widgets for Tutor LMS – Courses Grid Styles
   Covers both Style 1 (vertical) and Style 2 (horizontal)

   All class names are prefixed/scoped (.ecw-courses, .ecw-row,
   .ecw-col-*, .ecw-course-card, etc.) instead of reusing generic
   names like row / col-md-4 / card / btn / badge. Many themes
   and page builders ship their own version of exactly those
   class names (often Bootstrap 3/4, float-based) — sharing them
   causes silent layout collisions that are very hard to track
   down. Namespacing removes that risk entirely.
   ============================================================ */

/* ── Grid: row + columns ───────────────────────────────────── */
.ecw-courses .ecw-row {
	display: flex;
	flex-wrap: wrap;
	margin-right: calc(var(--ecw-gutter-x, 24px) * -0.5);
	margin-left: calc(var(--ecw-gutter-x, 24px) * -0.5);
	row-gap: var(--ecw-gutter-y, 24px);
}
.ecw-courses .ecw-row > * {
	box-sizing: border-box;
	flex-shrink: 0;
	width: 100%;
	max-width: 100%;
	padding-right: calc(var(--ecw-gutter-x, 24px) * 0.5);
	padding-left: calc(var(--ecw-gutter-x, 24px) * 0.5);
}
.ecw-courses .course-item { display: flex; }
.ecw-courses .ecw-col-full { width: 100% !important; }

.ecw-courses .ecw-col-sm-2  { width: 16.6666667% !important; }
.ecw-courses .ecw-col-sm-3  { width: 25% !important; }
.ecw-courses .ecw-col-sm-4  { width: 33.3333333% !important; }
.ecw-courses .ecw-col-sm-6  { width: 50% !important; }
.ecw-courses .ecw-col-sm-12 { width: 100% !important; }

@media (min-width: 768px) {
	.ecw-courses .ecw-col-md-2  { width: 16.6666667% !important; }
	.ecw-courses .ecw-col-md-3  { width: 25% !important; }
	.ecw-courses .ecw-col-md-4  { width: 33.3333333% !important; }
	.ecw-courses .ecw-col-md-6  { width: 50% !important; }
	.ecw-courses .ecw-col-md-12 { width: 100% !important; }
}
@media (min-width: 992px) {
	.ecw-courses .ecw-col-lg-2  { width: 16.6666667% !important; }
	.ecw-courses .ecw-col-lg-3  { width: 25% !important; }
	.ecw-courses .ecw-col-lg-4  { width: 33.3333333% !important; }
	.ecw-courses .ecw-col-lg-6  { width: 50% !important; }
	.ecw-courses .ecw-col-lg-12 { width: 100% !important; }
}
@media (min-width: 1200px) {
	.ecw-courses .ecw-col-xl-2  { width: 16.6666667% !important; }
	.ecw-courses .ecw-col-xl-3  { width: 25% !important; }
	.ecw-courses .ecw-col-xl-4  { width: 33.3333333% !important; }
	.ecw-courses .ecw-col-xl-6  { width: 50% !important; }
	.ecw-courses .ecw-col-xl-12 { width: 100% !important; }
}

.ecw-courses .ecw-empty-state {
	text-align: center;
	color: #6b7280;
	padding: 24px 0;
	margin: 0;
}

/* ── Card ───────────────────────────────────────────────────
   Border, radius, background, and the hover shadow/background
   all live directly on .ecw-course-card so they can't be
   knocked out by a missing/removed utility class.            */
.ecw-course-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	background-color: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
	transition: box-shadow .25s ease, transform .25s ease, background-color .25s ease, border-color .25s ease;
}
.ecw-course-card:hover {
	box-shadow: 0 10px 28px rgba(17, 24, 39, .12);
	transform: translateY(-3px);
	background-color: #fafafa;
	border-color: #d1d5db;
}

/* Padding inside the card body */
.ecw-courses .course-content {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	padding: 20px;
}

/* ── Thumbnail — sits in the same ordered flow as every other
   block; its own padding defaults to 0 since .course-content
   already provides the card's inset. Use the "Thumbnail" style
   section's Image Padding / Margin controls to add more.      */
.ecw-courses .course-thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin-bottom: 14px;
	background-color: transparent;
	box-sizing: border-box;
}
.ecw-courses .course-thumb a {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: 8px;
	overflow: hidden;
	background-color: #f3f4f6;
}
.ecw-courses .course-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	object-fit: cover;
}

/* Category badge overlay on the thumbnail — inset to match the thumb padding */
.ecw-courses .category-badges {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 0;
	z-index: 2;
}

/* Category badge (also used inline above the title when no image) */
.ecw-courses .course-categories { margin-bottom: 8px; }
.ecw-courses .course-category-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	background-color: #4f46e5;
	color: #fff;
	text-decoration: none;
	transition: background-color .2s ease;
}
.ecw-courses .course-category-badge:hover {
	background-color: #4338ca;
	color: #fff;
}

/* Price */
.ecw-courses .course-price {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 6px;
}
.ecw-courses .ecw-price-free { color: #16a34a; }

/* Course title — margin-bottom is !important because heading
   elements (h2–h6) are extremely likely to have their own
   margin rules from the active theme's typography CSS, which
   would otherwise silently win over a plain margin-bottom.  */
.ecw-courses .course-title {
	margin: 0 0 10px !important;
	font-size: 18px;
	line-height: 1.35;
	font-weight: 700;
}
.ecw-courses .course-title a {
	text-decoration: none;
	color: inherit;
}
.ecw-courses .course-title a:hover { color: #4f46e5; }

/* Excerpt */
.ecw-courses .course-excerpt {
	color: #6b7280;
	margin: 0 0 10px !important;
	font-size: 14px;
	line-height: 1.5;
}
.ecw-courses .ecw-small { font-size: 13px; }

/* Rating stars */
.ecw-courses .course-rating {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 10px;
	font-size: 13px;
}
.ecw-courses .course-rating .star-filled { color: #f59e0b; }
.ecw-courses .course-rating .star-empty  { color: #d1d5db; }
.ecw-courses .course-rating .rating-count { color: #6b7280; font-size: 12px; }

/* Meta row (students / duration / lessons / level) */
.ecw-courses .course-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin: 4px 0 14px;
	padding: 0;
}
.ecw-courses .course-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	font-size: 13px;
	line-height: 1.3;
	color: #6b7280;
}
.ecw-courses .course-meta-item i {
	font-size: 13px;
}
.ecw-courses .course-level-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	background-color: #f3f4f6;
	color: #374151;
}

/* Author */
.ecw-courses .author-box {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 13px;
}
.ecw-courses .author-avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; }
.ecw-courses .author-name a { text-decoration: none; color: inherit; }
.ecw-courses .author-name a:hover { color: #4f46e5; }

/* Action / button */
.ecw-courses .course-action {
	padding-top: 8px;
	padding-bottom: 4px;
}
.ecw-courses .course-action--push {
	margin-top: auto;
	padding-top: 14px;
}
.ecw-courses .ecw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 22px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	background-color: #4f46e5;
	color: #fff;
	border: 2px solid #4f46e5;
	transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.ecw-courses .ecw-btn:hover {
	background-color: #4338ca;
	border-color: #4338ca;
	color: #fff;
}

/* ── Style 2: Horizontal card ──────────────────────────────── */
.ecw-courses-style-2 .ecw-course-card--horizontal {
	flex-direction: row;
}
.ecw-courses-style-2 .ecw-course-card--horizontal .course-thumb {
	width: 220px;
	min-width: 220px;
	padding: 12px;
	align-self: stretch;
}
.ecw-courses-style-2 .ecw-course-card--horizontal .course-thumb a {
	aspect-ratio: auto;
	height: 100%;
}
@media (max-width: 575.98px) {
	.ecw-courses-style-2 .ecw-course-card--horizontal { flex-direction: column; }
	.ecw-courses-style-2 .ecw-course-card--horizontal .course-thumb {
		width: 100%;
		min-width: 0;
		padding: 12px 12px 0;
	}
	.ecw-courses-style-2 .ecw-course-card--horizontal .course-thumb a {
		aspect-ratio: 16 / 10;
		height: auto;
	}
}

/* ── Sort Mode Badge ────────────────────────────────────────────────────── */
.ecw-sort-badge-wrap {
	z-index: 2;
}
.ecw-sort-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	background-color: #e53935;
	color: #fff;
	white-space: nowrap;
	letter-spacing: .3px;
}
