/**
 * WP Arabic Article Rating — RTL layout, card, stars, distribution bars.
 *
 * @package WP_Arabic_Article_Rating
 */

.wp-aar-widget {
	box-sizing: border-box;
	margin: 2.5rem 0 1.5rem;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", "Noto Naskh Arabic", sans-serif;
}

.wp-aar-widget *,
.wp-aar-widget *::before,
.wp-aar-widget *::after {
	box-sizing: border-box;
}

/* White card, rounded, subtle shadow */
.wp-aar-card {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	direction: rtl;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
	padding: 1.5rem 1.75rem;
	gap: 0;
	max-width: 100%;
}

.wp-aar-col {
	flex: 1 1 50%;
	min-width: 0;
	padding: 0.25rem 0.5rem;
}

.wp-aar-col--submit {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.wp-aar-col--bars {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.65rem;
}

/* Vertical divider between columns */
.wp-aar-divider {
	flex: 0 0 1px;
	width: 1px;
	min-height: 100%;
	background: linear-gradient(
		to bottom,
		rgba(148, 163, 184, 0),
		rgba(148, 163, 184, 0.45) 15%,
		rgba(148, 163, 184, 0.45) 85%,
		rgba(148, 163, 184, 0)
	);
	margin: 0 0.5rem;
	align-self: stretch;
}

/* Right column: heading */
.wp-aar-heading {
	margin: 0 0 1rem;
	font-size: 1.125rem;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.5;
}

/* Stars */
.wp-aar-stars-wrap {
	width: 100%;
	margin-bottom: 1.25rem;
}

.wp-aar-stars {
	display: flex;
	flex-direction: row;
	justify-content: center;
	gap: 0.35rem;
	margin: 0 auto 0.5rem;
}

.wp-aar-stars--hidden {
	display: none;
}

.wp-aar-stars--loading .wp-aar-star-btn {
	visibility: hidden;
	pointer-events: none;
}

.wp-aar-stars--loading {
	position: relative;
	min-height: 2.5rem;
}

.wp-aar-star-btn {
	background: none;
	border: 0;
	padding: 0.2rem;
	cursor: pointer;
	line-height: 0;
	transition: transform 0.15s ease;
}

.wp-aar-star-btn:focus {
	outline: 2px solid #b45309;
	outline-offset: 2px;
}

.wp-aar-star-btn:hover:not(:disabled) {
	transform: scale(1.12);
}

.wp-aar-star-btn:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

/* Empty star icon (CSS shape + border) */
.wp-aar-star-icon {
	display: block;
	width: 2rem;
	height: 2rem;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	/* Star outline SVG */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='1.4'%3E%3Cpath d='M12 2.5l2.8 6.5 7 .6-5.3 4.5 1.7 6.8L12 17.8 5.8 20.9l1.7-6.8L2.2 9.6l7-.6L12 2.5z'/%3E%3C/svg%3E");
	transition: filter 0.15s ease, transform 0.15s ease;
}

.wp-aar-star-btn:hover:not(:disabled) .wp-aar-star-icon {
	filter: drop-shadow(0 0 4px rgba(234, 179, 8, 0.55));
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fde68a' stroke='%23ca8a04' stroke-width='1.2'%3E%3Cpath d='M12 2.5l2.8 6.5 7 .6-5.3 4.5 1.7 6.8L12 17.8 5.8 20.9l1.7-6.8L2.2 9.6l7-.6L12 2.5z'/%3E%3C/svg%3E");
}

.wp-aar-loading,
.wp-aar-thankyou {
	margin: 0.25rem 0 0;
	font-size: 0.95rem;
	color: #475569;
	text-align: center;
}

.wp-aar-thankyou {
	font-weight: 600;
	color: #0f172a;
}

/* Summary row: text + red circle */
.wp-aar-summary-row {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	width: 100%;
	margin-top: auto;
	padding-top: 0.5rem;
}

.wp-aar-summary-text {
	text-align: right;
	flex: 1 1 auto;
	min-width: 0;
}

.wp-aar-summary-label {
	margin: 0 0 0.25rem;
	font-size: 0.95rem;
	font-weight: 600;
	color: #1e293b;
}

.wp-aar-summary-count {
	margin: 0;
	font-size: 0.875rem;
	color: #64748b;
}

.wp-aar-average-circle {
	flex: 0 0 auto;
	width: 4.5rem;
	height: 4.5rem;
	border-radius: 50%;
	background: #991b1b;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(153, 27, 27, 0.35);
}

.wp-aar-average-num {
	font-size: 1.5rem;
	font-weight: 800;
	color: #fff;
	line-height: 1;
}

/* Left column: distribution rows (5 → 1) */
.wp-aar-bar-row {
	display: grid;
	grid-template-columns: 3rem 1fr 1.5rem;
	align-items: center;
	gap: 0.5rem;
	direction: rtl;
}

.wp-aar-bar-pct {
	font-size: 0.8125rem;
	font-weight: 600;
	color: #475569;
	text-align: center;
}

.wp-aar-bar-track {
	height: 10px;
	border-radius: 6px;
	background: #e8f0ef;
	overflow: hidden;
}

.wp-aar-bar-fill {
	height: 100%;
	border-radius: 6px;
	background: #eab308;
	transition: width 0.35s ease;
}

.wp-aar-bar-label {
	font-size: 0.875rem;
	font-weight: 700;
	color: #334155;
	text-align: center;
}

@media (max-width: 640px) {
	.wp-aar-card {
		flex-direction: column;
		padding: 1.25rem 1rem;
	}

	.wp-aar-divider {
		width: 100%;
		height: 1px;
		min-height: 0;
		margin: 1rem 0;
		background: linear-gradient(
			to right,
			rgba(148, 163, 184, 0),
			rgba(148, 163, 184, 0.45) 15%,
			rgba(148, 163, 184, 0.45) 85%,
			rgba(148, 163, 184, 0)
		);
	}

	.wp-aar-bar-row {
		grid-template-columns: 2.5rem 1fr 1.25rem;
	}
}
