/*
 * Phase 3 additions and block style definitions.
 */

.awp-filter-bar {
	display: grid;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
	padding: var(--space-2);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	background: var(--bg-card);
}

.awp-filter-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-1);
}

.awp-filter-pill {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-pill);
	background: var(--bg-elevated);
	color: var(--text-secondary);
	padding: 0.35rem 0.75rem;
	cursor: pointer;
}

.awp-filter-pill.is-active {
	border-color: var(--accent);
	color: var(--text-primary);
	box-shadow: var(--shadow-glow);
}

.awp-filter-group--sort select {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	color: var(--text-primary);
	padding: 0.35rem 0.55rem;
}

.awp-products-grid {
	position: relative;
}

.awp-products-grid.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: awp-spin 0.8s linear infinite;
}

@keyframes awp-spin {
	to {
		transform: rotate(360deg);
	}
}

.awp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: grid;
	place-items: center;
	background: rgba(3, 4, 10, 0.84);
	backdrop-filter: blur(10px);
	animation: awp-fade-in 0.2s ease;
}

.awp-lightbox.is-closing {
	animation: awp-fade-out 0.2s ease forwards;
}

@keyframes awp-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes awp-fade-out {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

.awp-lightbox__image {
	max-width: min(94vw, 1200px);
	max-height: 86vh;
	border-radius: var(--radius-md);
	transition: opacity 0.2s ease;
}

.awp-lightbox__image.is-loading {
	opacity: 0.4;
}

.awp-lightbox__close,
.awp-lightbox__nav {
	position: absolute;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-pill);
	background: rgba(20, 22, 34, 0.9);
	color: #fff;
	cursor: pointer;
}

.awp-lightbox__close {
	top: 16px;
	right: 16px;
	width: 42px;
	height: 42px;
	font-size: 1.5rem;
}

.awp-lightbox__nav {
	top: 50%;
	width: 44px;
	height: 44px;
	transform: translateY(-50%);
}

.awp-lightbox__nav--prev {
	left: 16px;
}

.awp-lightbox__nav--next {
	right: 16px;
}

.awp-pricing-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--space-3);
}

.awp-pricing-card {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	background: var(--bg-card);
	padding: var(--space-2);
	display: grid;
	gap: var(--space-2);
}

.awp-pricing-card__price {
	display: flex;
	gap: var(--space-1);
	align-items: baseline;
	font-family: var(--font-mono);
	color: var(--green);
}

.awp-pricing-card__price del {
	color: var(--text-muted);
}

.awp-pricing-bundle__card {
	border: 1px solid rgba(123, 111, 255, 0.6);
	border-radius: var(--radius-lg);
	background: linear-gradient(125deg, rgba(123, 111, 255, 0.14), rgba(0, 212, 255, 0.1));
	padding: var(--space-4);
}

.awp-pricing-bundle__price {
	font-size: 2rem;
	color: var(--green);
	font-family: var(--font-heading);
}

.awp-pricing-faq details {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	background: var(--bg-card);
	margin-bottom: var(--space-1);
	padding: var(--space-2);
}

.awp-pricing-faq summary {
	cursor: pointer;
	color: var(--text-primary);
	font-weight: 600;
}

.awp-global-changelog__month {
	margin-top: var(--space-4);
}

.awp-global-changelog__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--space-2);
}

.awp-global-changelog__item {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	background: var(--bg-card);
	padding: var(--space-2);
}

.awp-blank-canvas {
	min-height: 100vh;
}

/* Block style variants */
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	border: 1px solid var(--accent);
	color: var(--text-primary);
}

.wp-block-button.is-style-ghost .wp-block-button__link {
	background: transparent;
	border: 1px solid var(--border-color);
	color: var(--text-secondary);
}

.wp-block-group.is-style-card {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	background: #fff;
	color: #121520;
	padding: var(--space-3);
}

.wp-block-group.is-style-dark-card {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	background: var(--bg-card);
	padding: var(--space-3);
}

.wp-block-image.is-style-screenshot img {
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card);
}

/* === BBPRESS === */

/* Page layout */
.awp-forum-page {
	padding: var(--space-8) 0;
}
.awp-forum-page__header {
	margin-bottom: var(--space-6);
	padding-bottom: var(--space-4);
	border-bottom: 1px solid var(--border-color);
}
.awp-forum-page__title {
	font-family: var(--font-heading);
	font-size: 2rem;
	color: var(--text-primary);
	margin: 0 0 var(--space-1);
}
.awp-forum-page__desc {
	color: var(--text-secondary);
	margin: 0;
}

/* Toolbar */
.awp-forum-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--space-3);
}
.awp-forum-toolbar__count {
	color: var(--text-muted);
	font-size: 0.875rem;
}

/* Topic rows */
.awp-topics-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}
.awp-topic-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-3);
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	transition: border-color 0.2s ease;
}
.awp-topic-row:hover {
	border-color: var(--accent);
}
.awp-topic-row.is-closed {
	opacity: 0.6;
}
.awp-topic-row__main {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex: 1;
	min-width: 0;
}
.awp-topic-row__title {
	color: var(--text-primary);
	text-decoration: none;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.awp-topic-row__title:hover { color: var(--accent); }
.awp-topic-row__meta {
	font-size: 0.8rem;
	color: var(--text-muted);
	white-space: nowrap;
}
.awp-topic-row__counts {
	display: flex;
	gap: var(--space-3);
	font-size: 0.8rem;
	color: var(--text-muted);
	flex-shrink: 0;
	margin-left: var(--space-4);
}

/* Topic type + resolved badges */
.awp-topic-badge {
	font-size: 0.7rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: var(--radius-pill);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	flex-shrink: 0;
}
.awp-topic-badge--bug      { background: rgba(255,77,109,0.15); color: var(--red); }
.awp-topic-badge--feature  { background: rgba(123,111,255,0.15); color: var(--accent); }
.awp-topic-badge--question { background: rgba(0,212,255,0.15); color: var(--accent-2); }
.awp-topic-badge--resolved { background: rgba(0,200,150,0.15); color: var(--green); }

/* Reply cards */
.awp-reply {
	display: grid;
	grid-template-columns: 180px 1fr;
	gap: var(--space-4);
	padding: var(--space-4);
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-3);
}
.awp-reply__author {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-1);
}
.awp-reply__author img {
	border-radius: var(--radius-md);
}
.awp-reply__author-name {
	font-weight: 600;
	color: var(--text-primary);
	font-size: 0.9rem;
}
.awp-reply__date {
	font-size: 0.75rem;
	color: var(--text-muted);
}
.awp-reply__content {
	color: var(--text-secondary);
	line-height: 1.7;
}
.awp-reply__actions {
	margin-top: var(--space-2);
	font-size: 0.8rem;
}
.awp-reply__actions a {
	color: var(--text-muted);
	text-decoration: none;
	margin-right: var(--space-2);
}
.awp-reply__actions a:hover { color: var(--accent); }

/* Forum forms */
.awp-forum-form {
	margin-top: var(--space-6);
	padding: var(--space-4);
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
}

/* Override bbPress default form inputs to match theme */
#bbpress-forums input[type="text"],
#bbpress-forums input[type="email"],
#bbpress-forums textarea,
#bbpress-forums select {
	background: var(--bg-elevated) !important;
	border: 1px solid var(--border-color) !important;
	color: var(--text-primary) !important;
	border-radius: var(--radius-md) !important;
	padding: var(--space-2) !important;
	font-family: var(--font-body) !important;
	width: 100% !important;
	margin-bottom: var(--space-2) !important;
}
#bbpress-forums input[type="text"]:focus,
#bbpress-forums textarea:focus {
	border-color: var(--accent) !important;
	outline: none !important;
	box-shadow: 0 0 0 3px var(--accent-glow) !important;
}
#bbpress-forums input[type="submit"],
#bbpress-forums button[type="submit"] {
	background: var(--accent) !important;
	color: #fff !important;
	border: none !important;
	border-radius: var(--radius-md) !important;
	padding: var(--space-2) var(--space-4) !important;
	font-family: var(--font-body) !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: background 0.2s ease !important;
}
#bbpress-forums input[type="submit"]:hover,
#bbpress-forums button[type="submit"]:hover {
	background: var(--accent-hover) !important;
}
#bbpress-forums label {
	color: var(--text-secondary) !important;
	font-size: 0.875rem !important;
	margin-bottom: var(--space-1) !important;
	display: block !important;
}

/* Topic type selector (our custom field) */
.awp-topic-type-field {
	margin-bottom: var(--space-3);
}
.awp-topic-type-field label {
	color: var(--text-secondary);
	font-size: 0.875rem;
	display: block;
	margin-bottom: var(--space-1);
}

/* Resolve button */
.awp-resolve-btn {
	background: transparent;
	border: 1px solid var(--green);
	color: var(--green);
	border-radius: var(--radius-md);
	padding: var(--space-1) var(--space-3);
	font-size: 0.8rem;
	cursor: pointer;
	transition: all 0.2s ease;
}
.awp-resolve-btn:hover {
	background: var(--green);
	color: #000;
}

/* Forum link block on product sidebar */
.awp-forum-link-block {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-3);
	background: var(--bg-elevated);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	margin-top: var(--space-3);
}
.awp-forum-link-block__label {
	font-weight: 600;
	color: var(--text-primary);
	font-size: 0.9rem;
	display: block;
}
.awp-forum-link-block__stats {
	font-size: 0.8rem;
	color: var(--text-muted);
}

/* Forum stats inline */
.awp-forum-stats {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: 0.8rem;
	color: var(--text-muted);
}
.awp-forum-stats a {
	color: var(--accent);
	text-decoration: none;
}
.awp-forum-stats a:hover {
	text-decoration: underline;
}

/* Forum row (forum list) */
.awp-forum-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-3);
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-2);
	transition: border-color 0.2s ease;
}
.awp-forum-row:hover {
	border-color: var(--accent);
}
.awp-forum-row__title {
	color: var(--text-primary);
	text-decoration: none;
	font-weight: 600;
}
.awp-forum-row__title:hover { color: var(--accent); }
.awp-forum-row__desc {
	color: var(--text-secondary);
	font-size: 0.875rem;
	margin: var(--space-1) 0 0;
}
.awp-forum-row__counts {
	display: flex;
	gap: var(--space-3);
	font-size: 0.8rem;
	color: var(--text-muted);
	flex-shrink: 0;
	margin-left: var(--space-4);
}

/* Forum empty state */
.awp-forum-empty {
	padding: var(--space-8) var(--space-4);
	text-align: center;
	color: var(--text-muted);
	background: var(--bg-card);
	border: 1px dashed var(--border-color);
	border-radius: var(--radius-md);
}

/* Responsive */
@media (max-width: 768px) {
	.awp-topic-row {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-2);
	}
	.awp-topic-row__counts {
		margin-left: 0;
	}
	.awp-reply {
		grid-template-columns: 1fr;
	}
	.awp-forum-row {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-2);
	}
	.awp-forum-row__counts {
		margin-left: 0;
	}
}

.wp-block-quote.is-style-highlight {
	border-left: 4px solid var(--accent);
	background: rgba(123, 111, 255, 0.08);
	padding: var(--space-2);
}

.wp-block-separator.is-style-gradient {
	border: 0;
	height: 2px;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

@media (max-width: 768px) {
	.awp-filter-group--sort {
		width: 100%;
	}
}

/* Download counter badge (hero) */
.awp-badge--downloads {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
}

.awp-badge--downloads .dashicons {
	font-size: 1em;
	width: 1em;
	height: 1em;
	line-height: 1;
}

/* Download counter row (details sidebar) */
.awp-details-list__downloads span {
	font-variant-numeric: tabular-nums;
}

/* ── Live Search Dropdown ── */
.awp-live-search {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	margin-top: 4px;
	max-height: 420px;
	overflow-y: auto;
	display: none;
}
.awp-live-search.is-open {
	display: block;
}
.awp-live-search__item {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2);
	text-decoration: none;
	color: var(--text-primary);
	border-bottom: 1px solid var(--border-color);
	transition: background 0.15s ease;
}
.awp-live-search__item:last-child {
	border-bottom: none;
}
.awp-live-search__item:hover,
.awp-live-search__item:focus {
	background: var(--bg-elevated);
	outline: none;
}

/* ── License Section (product sidebar) ── */
.awp-product-sidebar__licenses {
	margin-top: var(--space-4);
	padding-top: var(--space-4);
	border-top: 1px solid var(--border-color);
}

.awp-product-sidebar__licenses h3 {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-muted);
	margin: 0 0 var(--space-2);
	font-weight: 600;
}

.awp-license-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.awp-license-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	padding: 0.35em 0.75em 0.35em 0.55em;
	border-radius: 999px;
	background: color-mix(in srgb, var(--accent) 10%, transparent);
	border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
	color: var(--accent);
	text-decoration: none;
	font-size: 0.8125rem;
	line-height: 1.3;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	width: fit-content;
}

.awp-license-badge:hover,
.awp-license-badge:focus {
	background: color-mix(in srgb, var(--accent) 18%, transparent);
	border-color: var(--accent);
	color: var(--accent);
	outline: none;
}

.awp-license-badge__icon {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	opacity: 0.8;
}

.awp-license-badge__label {
	font-weight: 600;
}

.awp-license-badge__spdx {
	font-family: var(--font-mono, 'JetBrains Mono', Consolas, monospace);
	font-size: 0.7em;
	opacity: 0.7;
	font-weight: 400;
	background: none;
	padding: 0;
	border: none;
}
.awp-live-search__thumb {
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: var(--radius-sm);
	overflow: hidden;
	background: var(--bg-elevated);
}
.awp-live-search__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.awp-live-search__nothumb {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--bg-elevated);
}
.awp-live-search__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.awp-live-search__title {
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.awp-live-search__meta {
	display: flex;
	gap: var(--space-2);
	font-size: 0.78rem;
	color: var(--text-muted);
}
.awp-live-search__type {
	background: var(--bg-elevated);
	padding: 1px 6px;
	border-radius: var(--radius-sm);
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.awp-live-search__price {
	color: var(--accent);
	font-weight: 600;
}
.awp-live-search__empty,
.awp-live-search__loading {
	padding: var(--space-3);
	text-align: center;
	color: var(--text-muted);
	font-size: 0.85rem;
}
