/**
 * Custom Reviews — Critical CSS: Product Reviews Page
 * Minimalny zestaw styli ładowany tylko na stronie produktu.
 * Zawiera WYŁĄCZNIE klasy używane przez product-reviews.php + review-item.php.
 */

/* === GLOBAL HOTFIX: horizontal overflow ===
 * Motyw Metamax ma elementy headera (woo-mini-count, site-search-wrapper, search-form)
 * które wystają o 2-3px poza viewport i powodują horizontal scroll całej strony.
 * `overflow-x: clip` clipuje to bez tworzenia nowego scroll container (sticky/fixed dalej działa).
 * Scope: tylko strona produktu (cr-product.css ładowany przez is_product()). */
html, body { overflow-x: clip; }

/* === RESET & BASE === */
.cr-reviews,
.cr-reviews *,
.cr-reviews *::before,
.cr-reviews *::after { box-sizing: border-box; }

.cr-reviews {
	max-width: 1170px;
	margin: 0 auto;
	scroll-margin-top: 120px;
	display: flex;
	flex-direction: column;
	gap: 28px;
	font-family: 'Inter', -apple-system, system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
	/* Zapobiega horizontal scroll od absolutnie pozycjonowanych tooltipów wychodzących poza krawędź karty na mobile. */
	overflow-x: hidden;
	min-width: 0;
}

/* === PREMIUM CARD (shared) === */
.cr-premium-card {
	background: #fff;
	border-radius: 32px;
	padding: 32px;
	border: 1px solid #e2e8f0;
	min-width: 0;
}

/* === 1. HEADING === */
.cr-heading-wrap { display: flex; flex-direction: column; gap: 4px; }
.cr-heading-title { font-size: 28px; font-weight: 800; color: #1f2937; margin: 0 0 6px; }
.cr-heading-animated {
	display: inline-block;
	background: linear-gradient(90deg, #1E5ABC, #38bdf8, #1E5ABC);
	background-size: 200% auto;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: cr-shine 3s linear infinite;
}
@keyframes cr-shine { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }
.cr-heading-sub { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.5; }

/* === 2. SUMMARY CARD === */
.cr-summary-card { display: flex; gap: 60px; align-items: center; }
.cr-summary-left { display: flex; flex-direction: column; align-items: center; min-width: 150px; }
.cr-rating-huge { font-size: 56px; font-weight: 800; color: #1f2937; line-height: 1; }
.cr-rating-huge span { font-size: 24px; color: #6b7280; }
.cr-summary-stars { font-size: 22px; margin: 10px 0; color: #FFE27A; }
.cr-rating-count { font-size: 13px; color: #94a3b8; font-weight: 500; }

.cr-summary-right { flex-grow: 1; display: flex; flex-direction: column; gap: 10px; }
.cr-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; color: #94a3b8; text-decoration: none; padding: 2px 0; }
a.cr-bar-row.cr-bar-clickable:hover { opacity: .8; }
.cr-bar-label { width: 20px; text-align: right; }
.cr-bar-track { flex-grow: 1; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.cr-bar-fill { height: 100%; border-radius: 3px; }
.cr-bar-count { width: 16px; }

/* === STAR (shared) === */
.cr-star { line-height: 1; }
.cr-star-full { color: #FFE27A; }
.cr-star-half { color: #FFE27A; }
.cr-star-off { color: #e5e7eb; }

/* === 3. INFO BANNER (Omnibus) === */
.cr-info-banner {
	background: #fff;
	border-radius: 20px;
	padding: 18px 24px;
	display: flex;
	align-items: center;
	gap: 18px;
	border: 1px solid #e2e8f0;
}
.cr-info-banner-icon {
	width: 40px; height: 40px; border-radius: 12px;
	background: #f0fdf4; border: 1px solid #bbf7d0;
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cr-info-banner-icon svg { width: 20px; height: 20px; fill: #16a34a; }
.cr-info-banner-body { flex-grow: 1; }
.cr-info-banner-title { font-size: 14px; font-weight: 700; color: #1f2937; display: block; margin-bottom: 2px; }
.cr-info-banner-sub { font-size: 13px; color: #6b7280; }
.cr-info-banner-link { display: block; margin-top: 6px; font-size: 13px; font-weight: 700; color: #1E5ABC; text-decoration: none; }
.cr-info-banner-link:hover { text-decoration: underline; }

/* === 4. AI DARK CARD === */
.cr-ai-dark { border-radius: 32px; padding: 28px 32px; background: #1E5ABC; border: 1px solid #e2e8f0; }
.cr-ai-dark-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cr-ai-dark-header svg { color: rgba(255,255,255,.45); }
.cr-ai-dark-title { font-size: 13px; font-weight: 700; letter-spacing: .3px; color: rgba(255,255,255,.55); }
.cr-ai-dark-text { font-size: 15px; line-height: 1.65; margin: 0 0 18px; color: #fff; }
.cr-ai-dark-text p { margin: 0 0 8px; }
.cr-ai-dark-text p:last-child { margin-bottom: 0; }
.cr-ai-dark-footer { font-size: 12px; font-weight: 500; color: rgba(255,255,255,.3); }

/* === 5. FILTERS === */
.cr-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.cr-filter-btn {
	padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 700;
	border: 1px solid #e2e8f0; background: #fff; color: #1f2937;
	cursor: pointer; display: flex; align-items: center; gap: 8px;
	text-decoration: none; transition: all .2s;
}
.cr-filter-btn.cr-filter-active { background: #1f2937; color: #fff; border-color: #1f2937; }
.cr-filter-btn:hover:not(.cr-filter-active) { background: #f8fafc; transform: translateY(-1px); }

/* Active filter bar */
.cr-active-filter-bar {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 10px 16px; background: #f0f2ff; border: 1px solid rgba(14,40,104,.08); border-radius: 10px; font-size: 13px;
}
.cr-active-filter-info { color: #0E2868; font-weight: 600; }
.cr-clear-filter-btn {
	display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px;
	background: #fff; border: 1px solid rgba(0,0,0,.1); border-radius: 999px;
	color: #6b7280; font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.cr-clear-filter-btn:hover { background: #fef2f2; color: #ef4444; border-color: #fca5a5; }

/* === 6. REVIEWS LIST === */
.cr-reviews-list-heading { margin: 0; font-size: 22px; font-weight: 800; color: #1f2937; }
.cr-reviews .cr-reviews-list { display: flex; flex-direction: column; gap: 28px; margin: 0; }
.cr-reviews-empty { padding: 48px 24px; text-align: center; color: #6b7280; background: #fff; border: 2px dashed rgba(0,0,0,.06); border-radius: 20px; }

/* === 7. REVIEW CARD === */
.cr-review-card { display: flex; flex-direction: column; }

/* Header */
.cr-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.cr-user-block { display: flex; gap: 14px; align-items: center; }

.cr-avatar {
	display: flex; align-items: center; justify-content: center;
	color: #fff; font-weight: 700; flex-shrink: 0; line-height: 1;
}
.cr-avatar-square { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }

.cr-user-details { display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.cr-name-row { display: flex; align-items: center; gap: 10px; }
.cr-user-name { font-weight: 700; font-size: 15px; color: #1f2937; }
.cr-name-censored { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; position: relative; }
.cr-name-censored[data-tooltip]::after {
	content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 0; transform: translateY(4px);
	background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 12px;
	font-size: 12px; font-weight: 500; line-height: 1.55; white-space: normal; width: 240px;
	opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none;
}
.cr-name-censored[data-tooltip]:hover::after { opacity: 1; visibility: visible; transform: translateY(0); }

.cr-verified-badge { font-size: 12px; color: #10b981; font-weight: 600; }
.cr-meta-row { font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.cr-variant-meta { font-size: 13px; font-weight: 600; color: #64748b; }
.cr-date-main { font-size: 13px; color: #94a3b8; white-space: nowrap; }

/* Stars */
.cr-review-stars { color: #FFE27A; font-size: 18px; letter-spacing: 1px; margin-bottom: 10px; }
.cr-review-stars .cr-star-off { color: #e5e7eb; }

/* Title */
.cr-review-card .cr-review-title { font-size: 19px; font-weight: 800; color: #1f2937; margin-bottom: 8px; display: block; overflow-wrap: anywhere; word-break: break-all; }

/* Content + show more */
.cr-review-content-wrapper { position: relative; overflow: visible; }
.cr-review-card .cr-review-text { font-size: 15px; line-height: 1.6; color: #4b5563; margin: 0; overflow: visible; transition: max-height .4s ease; overflow-wrap: anywhere; word-break: break-all; }
.cr-review-card .cr-review-text p { margin: 0 0 8px; }
.cr-review-card .cr-review-text p:last-child { margin-bottom: 0; }
.cr-review-card .cr-text-collapsed { max-height: 120px; position: relative; overflow: hidden; }
.cr-review-card .cr-text-collapsed::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 50px; background: linear-gradient(transparent, #fff); }
.cr-review-card .cr-text-expanded { max-height: 2000px; }
.cr-review-card .cr-text-short { max-height: none; overflow: visible; }

.cr-show-more-btn, button.cr-show-more-btn { background: none; border: none; color: #1E5ABC; font-weight: 700; font-size: 14px; padding: 8px 0; cursor: pointer; display: block; margin-top: 4px; font-family: inherit; text-transform: none; line-height: 1; }
.cr-show-more-btn:hover { text-decoration: underline; }

/* Censored content inline */
/* Censored inline word */
.cr-content-censored {
	display: inline;
	padding: 2px 8px;
	background: #ECF3FF;
	color: #1E5ABC;
	border-radius: 4px;
	font-size: 0.85em;
	font-style: italic;
	font-weight: 500;
	cursor: help;
	position: relative;
}
.cr-content-censored[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 6px);
	left: 0;
	background: #1f2937;
	color: #fff;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 11px;
	font-style: normal;
	font-weight: 400;
	line-height: 1.4;
	width: 220px;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	transition: opacity .15s;
	z-index: 200;
	pointer-events: none;
}
.cr-content-censored[data-tooltip]:hover::after {
	opacity: 1;
	visibility: visible;
}

/* Reply thread */
.cr-reply-thread { margin-top: 20px; padding-left: 32px; position: relative; }
.cr-reply-thread::before {
	content: ""; position: absolute; left: 10px; top: -12px;
	width: 14px; height: 32px;
	border-left: 2px solid #e5e7eb; border-bottom: 2px solid #e5e7eb; border-bottom-left-radius: 12px;
}
.cr-reply-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cr-shop-logo {
	width: 26px; height: 26px; background-color: #1E5ABC; border-radius: 8px;
	display: flex; align-items: center; justify-content: center;
	font-size: 12px; font-weight: 900; color: #fff;
}
.cr-shop-name { font-size: 14px; font-weight: 700; color: #1f2937; }
.cr-reply-bubble {
	background: #f8fafc; padding: 12px 18px; border-radius: 4px 18px 18px 18px;
	font-size: 15px; color: #374151; display: inline-block; border: 1px solid #f1f5f9; line-height: 1.5;
}
.cr-reply-bubble p { margin: 0 0 6px; }
.cr-reply-bubble p:last-child { margin-bottom: 0; }

/* Footer */
.cr-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; border-top: 1px solid #f8fafc; margin-top: 24px; }
.cr-user-stats { display: flex; gap: 16px; }
.cr-stat-item {
	position: relative; display: flex; align-items: center; gap: 6px;
	font-size: 13px; color: #94a3b8; font-weight: 600; cursor: help;
}
.cr-stat-item::after {
	content: attr(data-tooltip); position: absolute; bottom: 140%; left: 50%;
	transform: translateX(-50%) translateY(5px); background: #1f2937; color: #fff;
	padding: 8px 12px; border-radius: 10px; font-size: 11px; white-space: nowrap;
	opacity: 0; visibility: hidden; transition: all .2s; z-index: 10; pointer-events: none;
}
.cr-stat-item:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* Like pill */
button.cr-like-pill, .cr-like-pill {
	background: #fff1f2; color: #e11d48; padding: 8px 18px; border-radius: 14px;
	font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px;
	border: none; cursor: pointer; transition: .2s; flex-shrink: 0;
	font-family: inherit; text-transform: none; vertical-align: middle; margin-top: 0; line-height: 1;
}
button.cr-like-pill:hover, .cr-like-pill:hover { background: #ffe4e6; transform: translateY(-1px); }

/* === TOOLTIP (general) === */
.cr-tip { position: relative; cursor: help; }
.cr-tip::after {
	content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 0; transform: translateY(4px);
	background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 12px;
	font-size: 12px; font-weight: 500; line-height: 1.55; white-space: normal; width: 260px; text-align: left;
	opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none;
}
.cr-tip:hover::after { opacity: 1; visibility: visible; transform: translateY(0); }

/* === PAGINATION === */
.cr-pagination {
	display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px;
	padding-top: 20px; border-top: 1px solid rgba(0,0,0,.04);
}
.cr-pagination a, .cr-pagination .page-numbers {
	min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex;
	align-items: center; justify-content: center; border-radius: 10px;
	font-size: 14px; font-weight: 600; text-decoration: none; color: #1f2937;
	background: #fff; border: 1px solid #e2e8f0; transition: all .15s;
}
.cr-pagination a:hover { background: #f0f2ff; border-color: rgba(14,40,104,.15); }
.cr-pagination .page-numbers.current { background: #1f2937; color: #fff; border-color: #1f2937; }
.cr-pagination-info { font-size: 13px; color: #94a3b8; margin-left: 8px; }

/* === CTA === */
.cr-add-review-wrap { text-align: center; padding: 40px 32px; background: #fff; border-radius: 32px; border: 1px solid #e2e8f0; }
.cr-add-review-heading { display: block; margin-bottom: 16px; font-size: 18px; font-weight: 800; color: #1f2937; }
.cr-add-review-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	padding: 16px 40px; background: linear-gradient(135deg, #0a1a3f, #1e4080);
	color: #fff; text-decoration: none; border-radius: 999px; font-size: 16px; font-weight: 700; transition: all .2s;
}
.cr-add-review-btn:hover { transform: translateY(-1px); }

/* === SUMMARY PILL (shortcode) === */
.cr-summary-simple {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 16px;
	text-decoration: none;
	color: inherit;
	line-height: 1;
	margin: 0 auto;
	width: fit-content;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
	.cr-summary-card { flex-direction: column; gap: 30px; }
	.cr-summary-right { width: 100%; }
	.cr-card-header { flex-direction: column; gap: 12px; }
	.cr-card-footer { flex-direction: column; align-items: flex-start; gap: 16px; }
	.cr-heading-title { font-size: 22px; }
	.cr-premium-card { padding: 24px; border-radius: 24px; }
	.cr-info-banner { flex-direction: column; text-align: center; }
	.cr-filters { justify-content: center; }
	.cr-add-review-wrap { padding: 28px 20px; border-radius: 24px; }
}
