@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Montserrat:wght@400;500;700&display=swap');

/**
 * css/journalMetricsBlock.css
 *
 * Journal Metrics — sidebar block styles.
 * Redesigned card layout matching the reference image:
 * blue left border, header + View All button, 4-column metric grid,
 * and author-origin country flags section.
 */

/* ── Card container ── */
.jmx-block {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
}

.jmx-block .title {
	/* hide the default OJS block title — we render our own in the card header */
	display: none !important;
}

.jmx-block-card {
	background: transparent; /* Remove background to blend with theme card */
	border-left: 4px solid #1565C0; /* Keep only the blue accent line */
	padding: 0;
	margin: 5px 0; /* Slight margin to pull it away from theme borders */
}

/* ── Header row ── */
.jmx-block-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	gap: 10px;
	flex-wrap: nowrap;
}

.jmx-block-title {
	font-family: "Montserrat", "Segoe UI", Roboto, sans-serif;
	font-size: 16px;
	font-weight: 700;
	color: #1a3353;
	margin: 0;
	padding: 0;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.jmx-block-btn {
	display: inline-block;
	font-family: "Montserrat", "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: #ffffff;
	background: #1565C0;
	border: none;
	border-radius: 4px;
	padding: 6px 14px;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.2s ease, transform 0.15s ease;
}

.jmx-block-btn:hover {
	background: #0f4a90;
	text-decoration: none;
	color: #ffffff;
	transform: translateY(-1px);
}

.jmx-block-sep {
	height: 1px;
	background: #e2e8f0;
	margin: 0 20px;
}

/* ── Grid of 4 items ── */
.jmx-block-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	padding: 20px 5px;
	text-align: center;
}

.jmx-block-metric {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.jmx-block-metric-value {
	font-family: "Montserrat", "Segoe UI", Roboto, sans-serif;
	font-size: 22px;
	font-weight: 700;
	color: #1565C0;
	line-height: 1;
}

.jmx-block-metric-label {
	font-family: "Merriweather", "Georgia", "Times New Roman", serif;
	font-size: 13px;
	font-weight: 400;
	color: #334155;
	line-height: 1.3;
	text-align: center;
	max-width: 100%;
	word-wrap: break-word;
}

/* ── Author Origins ── */
.jmx-block-origins {
	padding: 5px 20px 20px 20px;
}

.jmx-block-origins-title {
	display: flex;
	align-items: center;
	font-family: "Merriweather", "Georgia", "Times New Roman", serif;
	font-size: 13px;
	font-weight: 400;
	color: #334155;
	text-align: center;
	margin-bottom: 15px;
}

.jmx-block-origins-title::before,
.jmx-block-origins-title::after {
	content: "";
	flex: 1;
	border-bottom: 1px solid #e2e8f0;
}

.jmx-block-origins-title::before {
	margin-right: 15px;
}

.jmx-block-origins-title::after {
	margin-left: 15px;
}

.jmx-block-origins-title strong {
	font-family: "Montserrat", "Segoe UI", Roboto, sans-serif;
	color: #1565C0;
	font-weight: 700;
	margin-left: 4px;
}

.jmx-block-flags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 14px;
	align-items: center;
}

.jmx-block-flag-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.jmx-block-flag-img {
	display: inline-block;
	vertical-align: middle;
	border-radius: 2px;
	box-shadow: 0 0 2px rgba(0,0,0,0.15);
	flex-shrink: 0;
}

.jmx-block-flag-fallback {
	font-size: 11px;
	font-weight: 700;
	color: #64748b;
	background: #f1f5f9;
	padding: 1px 4px;
	border-radius: 2px;
}

.jmx-block-globe {
	font-size: 18px;
	line-height: 1;
}

.jmx-block-flag-pct {
	font-size: 13px;
	font-weight: 700;
	color: #334155;
}

/* ── Responsive: 2-column grid on very narrow sidebars ── */
@media (max-width: 220px) {
	.jmx-block-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
	.jmx-block-metric-value {
		font-size: 18px;
	}
	.jmx-block-header {
		flex-direction: column;
		align-items: flex-start;
	}
}
