/**
 * ReadyLaunch Blog Styles.
 *
 * Styles for the ReadyLaunch blog single post and archive templates.
 * Uses BuddyBoss RL CSS custom properties where available.
 *
 * @package BuddyBoss\MemberBlogs
 * @since 1.0.0
 */

/* === LAYOUT === */
.bb-rl-blog-wrap {
	width: 100%;
}

.bb-rl-blog-archive .bb-rl-content-wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.bb-rl-blog-archive .bb-rl-blog-page {
	padding-top: 32px;
	padding-bottom: 40px;
}

/* === POST TAXONOMY (Categories/Tags) — shared by archive cards === */
.bb-rl-blog-post-taxonomy {
	margin-bottom: 32px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bb-rl-blog-categories,
.bb-rl-blog-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bb-rl-blog-category-badge {
	display: inline-block;
	padding: 4px 12px;
	background: var(--bb-primary-color, #007CFF);
	color: #fff;
	border-radius: 20px;
	font-size: 13px;
	text-decoration: none;
	transition: opacity 0.2s;
}

.bb-rl-blog-category-badge:hover {
	opacity: 0.85;
	color: #fff;
}

.bb-rl-blog-tag-badge {
	display: inline-block;
	padding: 4px 12px;
	background: var(--bb-content-background-color, #f7fafc);
	color: var(--bb-body-text-color, #4a5568);
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 20px;
	font-size: 13px;
	text-decoration: none;
	transition: background 0.2s;
}

.bb-rl-blog-tag-badge:hover {
	background: var(--bb-content-border-color, #e2e8f0);
}

/* === ARCHIVE === */
.bb-rl-blog-archive-title {
	font-size: 28px;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--bb-heading-text-color, #1a202c);
}

.bb-rl-blog-archive-desc {
	font-size: 15px;
	color: var(--bb-alternate-text-color, #718096);
	margin-bottom: 24px;
	line-height: 1.5;
}

.bb-rl-blog-post-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	margin-bottom: 32px;
}

/* ============================================================
   ARCHIVE PAGE — Toolbar, Cards, Grid/List, Infinite Scroll
   ============================================================ */

/* === ARCHIVE TOOLBAR === */
.bb-rl-archive-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
	flex-wrap: wrap;
}

.bb-rl-archive-toolbar__title {
	font-size: 24px;
	font-weight: 700;
	margin: 0;
	color: var(--bb-heading-text-color, #1a202c);
	white-space: nowrap;
}

.bb-rl-archive-toolbar__count {
	font-weight: 400;
	color: var(--bb-alternate-text-color, #718096);
}

.bb-rl-archive-toolbar__controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* View Toggle */
.bb-rl-archive-toolbar__view-toggle {
	display: flex;
	gap: 2px;
}

.bb-rl-archive-toolbar__view-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--bb-alternate-text-color, #a0aec0);
	cursor: pointer;
	transition: all 0.15s;
}

.bb-rl-archive-toolbar__view-btn:hover {
	color: var(--bb-body-text-color, #4a5568);
	background: var(--bb-content-background-color, #f7fafc);
}

.bb-rl-archive-toolbar__view-btn.is-active {
	color: var(--bb-heading-text-color, #1a202c);
	background: var(--bb-content-background-color, #f7fafc);
}

/* Separator */
.bb-rl-archive-toolbar__sep {
	width: 1px;
	height: 24px;
	background: var(--bb-content-border-color, #e2e8f0);
	margin: 0 4px;
}

/* Filter Groups */
.bb-rl-archive-toolbar__filter {
	display: flex;
	align-items: center;
	gap: 4px;
}

.bb-rl-archive-toolbar__filter-label {
	font-size: 14px;
	color: var(--bb-alternate-text-color, #718096);
	white-space: nowrap;
}

/* Dropdowns */
.bb-rl-archive-toolbar__dropdown {
	position: relative;
}

.bb-rl-archive-toolbar__dropdown-toggle {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 8px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--bb-heading-text-color, #1a202c);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	white-space: nowrap;
}

.bb-rl-archive-toolbar__dropdown-toggle:hover {
	background: var(--bb-content-background-color, #f7fafc);
}

.bb-rl-archive-toolbar__dropdown-toggle svg {
	color: var(--bb-alternate-text-color, #a0aec0);
	flex-shrink: 0;
}

.bb-rl-archive-toolbar__dropdown-menu {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 100;
	min-width: 160px;
	max-height: 260px;
	overflow-y: auto;
	margin-top: 4px;
	padding: 4px;
	background: var(--bb-content-background-color, #fff);
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bb-rl-archive-toolbar__dropdown-item {
	display: block;
	padding: 8px 12px;
	font-size: 14px;
	color: var(--bb-body-text-color, #4a5568);
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.15s;
	white-space: nowrap;
}

.bb-rl-archive-toolbar__dropdown-item:hover {
	background: var(--bb-content-background-color, #f7fafc);
	color: var(--bb-heading-text-color, #1a202c);
}

.bb-rl-archive-toolbar__dropdown-item.is-active {
	color: var(--bb-primary-color, #007CFF);
	font-weight: 600;
}

/* Subscribe Button */
.bb-rl-archive-toolbar__subscribe-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 8px;
	background: var(--bb-content-background-color, #fff);
	color: var(--bb-heading-text-color, #1a202c);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
	white-space: nowrap;
}

.bb-rl-archive-toolbar__subscribe-btn:hover {
	border-color: var(--bb-alternate-text-color, #a0aec0);
	background: var(--bb-content-background-color, #f7fafc);
}

.bb-rl-archive-toolbar__subscribe-btn svg {
	flex-shrink: 0;
}

/* Create New Button */
.bb-rl-archive-toolbar__create-btn {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 8px 16px;
	border: none;
	border-radius: 8px;
	background: var(--bb-primary-color, #007CFF);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.15s;
	white-space: nowrap;
}

.bb-rl-archive-toolbar__create-btn:hover {
	opacity: 0.9;
	color: #fff;
}

.bb-rl-archive-toolbar__create-icon {
	font-size: 16px;
	line-height: 1;
}

/* === ARCHIVE POSTS CONTAINER === */
.bb-rl-archive-posts {
	margin-bottom: 32px;
	transition: opacity 0.2s;
}

.bb-rl-archive-posts.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

/* Grid Layout */
.bb-rl-archive-posts--grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

/* List Layout */
.bb-rl-archive-posts--list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* === ARCHIVE CARD — Base === */
.bb-rl-archive-card {
	background: var(--bb-content-background-color, #fff);
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 12px;
	overflow: hidden;
	transition: transform 0.2s, box-shadow 0.2s;
}

.bb-rl-archive-card:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Card Image */
.bb-rl-archive-card__image {
	position: relative;
	overflow: hidden;
	background: var(--bb-content-background-color, #f0f0f0);
}

.bb-rl-archive-card__image a {
	display: block;
}

.bb-rl-archive-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bb-rl-archive-card__no-thumb {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
	color: var(--bb-alternate-text-color, #a0aec0);
}

/* Bookmark Icon Overlay */
.bb-rl-archive-card__bookmark {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.85);
	color: var(--bb-alternate-text-color, #718096);
	cursor: pointer;
	transition: all 0.15s;
	backdrop-filter: blur(4px);
}

.bb-rl-archive-card__bookmark:hover {
	background: rgba(255, 255, 255, 1);
	color: var(--bb-heading-text-color, #1a202c);
}

.bb-rl-archive-card__bookmark.is-bookmarked {
	background: var(--bb-primary-color, #007CFF);
	color: #fff;
}

.bb-rl-archive-card__bookmark.is-bookmarked:hover {
	opacity: 0.9;
}

.bb-rl-archive-card__bookmark.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.bb-rl-archive-card__bookmark-icon {
	display: block;
}

.bb-rl-archive-card__bookmark.is-bookmarked .bb-rl-archive-card__bookmark-icon path {
	fill: currentColor;
}

/* Card Body */
.bb-rl-archive-card__body {
	display: flex;
	flex-direction: column;
}

.bb-rl-archive-card__title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.bb-rl-archive-card__title a {
	color: var(--bb-heading-text-color, #1a202c);
	text-decoration: none;
}

.bb-rl-archive-card__title a:hover {
	color: var(--bb-primary-color, #007CFF);
}

/* Meta: Date + Category */
.bb-rl-archive-card__meta {
	font-size: 13px;
	color: var(--bb-alternate-text-color, #718096);
	margin-bottom: 8px;
}

.bb-rl-archive-card__meta-sep {
	margin: 0 4px;
}

/* Author */
.bb-rl-archive-card__author {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--bb-body-text-color, #4a5568);
	margin-bottom: 8px;
}

.bb-rl-archive-card__author-avatar img {
	border-radius: 50%;
	display: block;
}

.bb-rl-archive-card__author-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Excerpt */
.bb-rl-archive-card__excerpt {
	font-size: 14px;
	color: var(--bb-body-text-color, #4a5568);
	line-height: 1.5;
	margin: 0 0 12px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Footer */
.bb-rl-archive-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
}

/* View Post Link */
.bb-rl-archive-card__view-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	color: var(--bb-heading-text-color, #1a202c);
	text-decoration: none;
	transition: all 0.15s;
}

.bb-rl-archive-card__view-link:hover {
	border-color: var(--bb-alternate-text-color, #a0aec0);
	background: var(--bb-content-background-color, #f7fafc);
}

/* Comments */
.bb-rl-archive-card__comments {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: var(--bb-alternate-text-color, #718096);
}

.bb-rl-archive-card__comments svg {
	flex-shrink: 0;
}

/* === GRID LAYOUT SPECIFICS === */
.bb-rl-archive-posts--grid .bb-rl-archive-card {
	display: flex;
	flex-direction: column;
}

.bb-rl-archive-posts--grid .bb-rl-archive-card__image {
	height: 200px;
}

.bb-rl-archive-posts--grid .bb-rl-archive-card__body {
	padding: 16px;
	flex: 1;
}

/* In grid: hide View Post link, show author in footer */
.bb-rl-archive-posts--grid .bb-rl-archive-card__view-link {
	display: none;
}

.bb-rl-archive-posts--grid .bb-rl-archive-card__footer {
	padding-top: 8px;
	border-top: none;
}

/* === LIST LAYOUT SPECIFICS === */
.bb-rl-archive-posts--list .bb-rl-archive-card {
	display: flex;
	flex-direction: row;
}

.bb-rl-archive-posts--list .bb-rl-archive-card__image {
	width: 280px;
	min-width: 280px;
	height: auto;
	min-height: 200px;
}

.bb-rl-archive-posts--list .bb-rl-archive-card__body {
	flex: 1;
	padding: 20px 24px;
}

.bb-rl-archive-posts--list .bb-rl-archive-card__title {
	font-size: 18px;
	-webkit-line-clamp: 1;
}

.bb-rl-archive-posts--list .bb-rl-archive-card__excerpt {
	-webkit-line-clamp: 3;
}

/* === INFINITE SCROLL === */
.bb-rl-archive-load-more {
	display: flex;
	justify-content: center;
	padding: 32px 0;
}

.bb-rl-archive-load-more__spinner {
	display: flex;
	align-items: center;
	justify-content: center;
}

@keyframes bb-rl-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.bb-rl-archive-spinner {
	animation: bb-rl-spin 1s linear infinite;
	color: var(--bb-primary-color, #007CFF);
}

.bb-rl-archive-load-more__end {
	color: var(--bb-alternate-text-color, #718096);
	font-size: 14px;
}

/* === ARCHIVE EMPTY STATE === */
.bb-rl-archive-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 80px 20px;
}

.bb-rl-archive-empty__icon {
	color: var(--bb-content-border-color, #cbd5e0);
	margin-bottom: 16px;
}

.bb-rl-archive-empty__text {
	color: var(--bb-alternate-text-color, #718096);
	font-size: 16px;
	margin: 0;
}

/* === POST CARD === */
.bb-rl-blog-post-card {
	background: var(--bb-content-background-color, #fff);
	border: 1px solid var(--bb-content-border-color, #e2e8f0);
	border-radius: 12px;
	overflow: hidden;
	transition: transform 0.2s, box-shadow 0.2s;
}

.bb-rl-blog-post-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.bb-rl-blog-post-card-thumb-link {
	display: block;
	text-decoration: none;
}

.bb-rl-blog-post-card-thumb {
	height: 200px;
	overflow: hidden;
	background: #f0f0f0;
}

.bb-rl-blog-post-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bb-rl-blog-post-card-no-thumb {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
}

.bb-rl-blog-post-card-body {
	padding: 20px;
}

.bb-rl-blog-post-card-categories {
	margin-bottom: 8px;
	display: flex;
	gap: 4px;
}

.bb-rl-blog-post-card-categories .bb-rl-blog-category-badge {
	font-size: 11px;
	padding: 2px 8px;
}

.bb-rl-blog-post-card-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 8px;
	line-height: 1.3;
}

.bb-rl-blog-post-card-title a {
	color: var(--bb-heading-text-color, #1a202c);
	text-decoration: none;
}

.bb-rl-blog-post-card-title a:hover {
	color: var(--bb-primary-color, #007CFF);
}

.bb-rl-blog-post-card-excerpt {
	font-size: 14px;
	color: var(--bb-body-text-color, #4a5568);
	margin: 0 0 12px;
	line-height: 1.5;
}

.bb-rl-blog-post-card-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13px;
	color: var(--bb-alternate-text-color, #718096);
	flex-wrap: wrap;
}

.bb-rl-blog-post-card-author {
	display: flex;
	align-items: center;
	gap: 6px;
}

.bb-rl-blog-post-card-author img {
	border-radius: 50%;
}

/* === EMPTY STATE === */
.bb-rl-blog-empty {
	text-align: center;
	padding: 80px 20px;
	color: var(--bb-alternate-text-color, #718096);
	font-size: 16px;
}

/* === PAGINATION === */
.bb-rl-blog-pagination {
	margin-bottom: 32px;
}

.bb-rl-blog-pagination .nav-links {
	display: flex;
	justify-content: center;
	gap: 4px;
}

.bb-rl-blog-pagination .page-numbers {
	padding: 8px 14px;
	border-radius: 6px;
	text-decoration: none;
	color: var(--bb-body-text-color, #4a5568);
	background: var(--bb-content-background-color, #f7fafc);
	font-size: 14px;
	transition: all 0.2s;
}

.bb-rl-blog-pagination .page-numbers:hover {
	background: var(--bb-content-border-color, #e2e8f0);
}

.bb-rl-blog-pagination .page-numbers.current {
	background: var(--bb-primary-color, #007CFF);
	color: #fff;
}

/* === DARK MODE === */
.bb-dark-theme .bb-rl-blog-post-card {
	background: var(--bb-content-background-color);
	border-color: var(--bb-content-border-color);
}

.bb-dark-theme .bb-rl-blog-post-card-no-thumb {
	background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

/* Archive dark mode */
.bb-dark-theme .bb-rl-archive-card {
	background: var(--bb-content-background-color);
	border-color: var(--bb-content-border-color);
}

.bb-dark-theme .bb-rl-archive-card__no-thumb {
	background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.bb-dark-theme .bb-rl-archive-card__bookmark {
	background: rgba(45, 55, 72, 0.85);
	color: var(--bb-body-text-color);
}

.bb-dark-theme .bb-rl-archive-card__bookmark:hover {
	background: rgba(45, 55, 72, 1);
}

.bb-dark-theme .bb-rl-archive-card__bookmark.is-bookmarked {
	background: var(--bb-primary-color, #007CFF);
	color: #fff;
}

.bb-dark-theme .bb-rl-archive-toolbar__dropdown-menu {
	background: var(--bb-content-background-color);
	border-color: var(--bb-content-border-color);
}

.bb-dark-theme .bb-rl-archive-toolbar__subscribe-btn {
	background: var(--bb-content-background-color);
	border-color: var(--bb-content-border-color);
	color: var(--bb-body-text-color);
}

.bb-dark-theme .bb-rl-archive-toolbar__view-btn {
	color: var(--bb-alternate-text-color);
}

.bb-dark-theme .bb-rl-archive-toolbar__view-btn:hover,
.bb-dark-theme .bb-rl-archive-toolbar__view-btn.is-active {
	background: var(--bb-content-background-color);
	color: var(--bb-heading-text-color);
}

.bb-dark-theme .bb-rl-archive-toolbar__dropdown-toggle:hover {
	background: var(--bb-content-background-color);
}

.bb-dark-theme .bb-rl-archive-toolbar__dropdown-item:hover {
	background: var(--bb-content-background-color);
}

/* === RESPONSIVE === */
@media (max-width: 992px) {
	.bb-rl-blog-post-list {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Archive grid: 2 columns on tablet */
	.bb-rl-archive-posts--grid {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Archive list: narrower image */
	.bb-rl-archive-posts--list .bb-rl-archive-card__image {
		width: 220px;
		min-width: 220px;
	}
}

@media (max-width: 768px) {
	/* Toolbar: stack title above controls */
	.bb-rl-archive-toolbar {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.bb-rl-archive-toolbar__controls {
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Archive list: stack card vertically on small tablet */
	.bb-rl-archive-posts--list .bb-rl-archive-card {
		flex-direction: column;
	}

	.bb-rl-archive-posts--list .bb-rl-archive-card__image {
		width: 100%;
		min-width: 0;
		height: 200px;
	}
}

@media (max-width: 600px) {
	.bb-rl-blog-post-list {
		grid-template-columns: 1fr;
	}

	.bb-rl-blog-archive-title {
		font-size: 24px;
	}

	/* Archive: single column on mobile */
	.bb-rl-archive-posts--grid {
		grid-template-columns: 1fr;
	}

	.bb-rl-archive-toolbar__title {
		font-size: 20px;
	}

	/* Adjust subscribe and create on very small screens */
	.bb-rl-archive-toolbar__subscribe-btn,
	.bb-rl-archive-toolbar__create-btn {
		padding: 6px 12px;
		font-size: 13px;
	}
}

/* === RTL === */
[dir="rtl"] .bb-rl-blog-post-card-author {
	flex-direction: row-reverse;
}

/* RTL — Archive */
[dir="rtl"] .bb-rl-archive-toolbar__dropdown-menu {
	right: auto;
	left: 0;
}

[dir="rtl"] .bb-rl-archive-card__bookmark {
	right: auto;
	left: 12px;
}

[dir="rtl"] .bb-rl-archive-posts--list .bb-rl-archive-card {
	flex-direction: row-reverse;
}

[dir="rtl"] .bb-rl-archive-card__meta-sep {
	margin: 0 4px;
}

[dir="rtl"] .bb-rl-archive-card__author {
	flex-direction: row-reverse;
}

[dir="rtl"] .bb-rl-archive-card__view-link {
	flex-direction: row-reverse;
}

@media (max-width: 768px) {
	[dir="rtl"] .bb-rl-archive-toolbar {
		align-items: flex-end;
	}

	[dir="rtl"] .bb-rl-archive-posts--list .bb-rl-archive-card {
		flex-direction: column;
	}
}

/* ── Archive load error ──────────────────────────────────────── */

.bb-rl-archive-load-error {
	text-align: center;
	padding: 12px 16px;
	margin: 12px 0;
	color: var(--bb-heading-text-color, #1a202c);
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	font-size: 14px;
}

.bb-dark-theme .bb-rl-archive-load-error {
	background: rgba(254, 202, 202, 0.1);
	border-color: rgba(254, 202, 202, 0.2);
}
