/**
 * Club Profile single template styles
 * RTL layout: biography on the right, info box on the left
 */

/* Container */
.astra-club-single .club-single-wrapper {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	align-items: flex-start;
	direction: rtl;
	max-width: 1200px;
	margin: 0 auto;
	padding: 1.5rem 1rem;
}

/* Right column: Biography (60–70% in RTL this is the first flex item) */
.club-bio-column {
	flex: 1 1 0;
	min-width: 0;
	min-height: 0;
}

.club-bio-column .club-title {
	margin-top: 0;
	margin-bottom: 1rem;
}

.club-bio-content {
	line-height: 1.7;
}

.club-bio-content p {
	margin-bottom: 1em;
}

/* Left column: Info Box (30–40%) */
.club-info-box-column {
	flex: 0 0 auto;
	width: 35%;
	min-width: 280px;
}

/* Wikipedia-style Info Box */
.club-info-box {
	background-color: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	padding: 1rem 1.25rem;
	position: sticky;
	top: 2rem;
}

.club-info-box-logo {
	text-align: center;
	margin-bottom: 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid #dee2e6;
}

.club-info-box .club-logo-img {
	max-width: 140px;
	max-height: 140px;
	width: auto;
	height: auto;
	display: block;
	margin: 0 auto;
	object-fit: contain;
}

/* Info table */
.club-info-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.club-info-table tr {
	border-bottom: 1px solid #e9ecef;
}

.club-info-table tr:last-child {
	border-bottom: none;
}

.club-info-table th {
	text-align: right;
	padding: 0.5rem 0 0.5rem 0.75rem;
	font-weight: 700;
	color: #343a40;
	vertical-align: top;
	width: 38%;
}

.club-info-table td {
	text-align: right;
	padding: 0.5rem 0;
	color: #212529;
}

.club-info-table a {
	color: #0d6efd;
	word-break: break-all;
}

.club-info-table a:hover {
	text-decoration: underline;
}

/* RTL: ensure main content area is RTL */
.astra-club-single [dir="rtl"] .club-bio-content,
.astra-club-single [dir="rtl"] .club-info-table {
	text-align: right;
}

/* Responsive: stack on small screens */
@media (max-width: 768px) {
	.astra-club-single .club-single-wrapper {
		flex-direction: column;
		gap: 1.5rem;
		padding: 1rem 0.75rem;
	}

	.club-info-box-column {
		width: 100%;
		min-width: 0;
		order: -1; /* Info box first on mobile for RTL (visually on top) */
	}

	.club-info-box {
		position: static;
	}

	.club-info-box .club-logo-img {
		max-width: 100px;
		max-height: 100px;
	}

	.club-info-table th,
	.club-info-table td {
		font-size: 0.9rem;
		padding: 0.35rem 0;
	}

	.club-info-table th {
		width: 42%;
	}
}

@media (max-width: 480px) {
	.club-info-table th {
		width: 45%;
	}
}

.season-results-section {
	margin: 2rem auto 0;
	max-width: 1200px;
	padding: 0 1rem;
	direction: rtl;
}
.season-results-title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}
.matches-accordion {
	display: grid;
	gap: 1rem;
}
.match-item {
	background: #fff;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
	overflow: hidden;
	position: relative;
	transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}
.match-item:hover {
	box-shadow: 0 6px 16px rgba(0,0,0,0.08);
	background-color: #fcfcfd;
}
.match-toggle {
	all: unset;
	display: block;
	width: 100%;
	cursor: pointer;
}
.match-row-compact {
	display: grid;
	grid-template-columns: 1fr 120px 1fr;
	justify-items: center;
	align-items: center;
	width: 100%;
	gap: 12px;
	padding: 1rem 1.25rem;
	min-height: 72px;
}
.col-right, .col-center, .col-left { min-width: 0; width: 100%; }
.col-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.col-center { display: flex; align-items: center; justify-content: center; }
.col-left { display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
.col-left .date { white-space: nowrap; margin-right: auto; text-align: left; }
.stack-date {
	width: 100%;
	text-align: center;
	color: #6c757d;
	font-size: 0.95rem;
	display: none;
}
.stack-score {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 15px;
	width: 100%;
}
.stack-names {
	width: 100%;
	text-align: center;
	font-weight: 700;
	font-size: 1.2rem;
	line-height: 1.4;
	color: #212529;
	display: none;
}
.mobile-header,
.mobile-names,
.mobile-date { display: none; }
/* deprecated desktop structures are no longer used */
.central-trio, #match-date-anchor { display: none; }
.team { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.team-logo {
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	display: block;
	border-radius: 50%;
	object-fit: contain;
	background: #f1f3f5;
	border: 1px solid #e9ecef;
}
.team-name {
	font-weight: 700;
	color: #212529;
	font-size: 1.1rem;
	white-space: normal; /* allow wrap to second line if needed */
	overflow: visible;
	text-overflow: initial;
	max-width: 100%;
	flex-shrink: 1;
}
.home-group {
	flex-direction: row;
	justify-content: flex-end;
	text-align: right;
	flex: 2 1 auto;
	min-width: 0;
}
.away-group {
	flex-direction: row;
	justify-content: flex-start;
	text-align: left;
	flex: 2 1 auto;
	min-width: 0;
}
.home-group .team-logo {
	margin-inline-start: 15px; /* space between home logo and score */
}
.away-group .team-logo {
	margin-inline-end: 15px; /* space between score and away logo */
}
.score-badge {
	display: inline-block;
	padding: 0.35rem 0.75rem;
	border-radius: 10px;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	font-weight: 800;
	color: #0d6efd;
	font-size: 1.2rem;
	min-width: 5ch; /* avoid fixed pixel width */
	text-align: center;
	margin-inline: 15px; /* breathing space from both logos */
}
.date { color: #6c757d; white-space: nowrap; font-size: 0.9rem; text-align: left; }
.date-balancer { display: none; }

/* Slightly reduce team name size on very narrow screens to keep single line */
@media (max-width: 420px) {
	.team-name {
		font-size: 0.85rem; /* further reduce if extremely narrow */
	}
}

/* Mobile layout: stack elements clearly */
@media (max-width: 767px) {
	.match-row-compact {
		flex-direction: column;
		align-items: center;
		width: 98%;
		margin-inline: auto;
		row-gap: 10px;
	}
	/* Show vertical stack rows on mobile, hide desktop rows */
	.stack-date,
	.stack-score,
	.stack-names { display: flex; }
	.stack-score { display: inline-flex; }
	.col-right, .col-center, .col-left { display: none; }
}

/* Outcome colors */
.match-item.result-win {
	background-color: rgba(40, 167, 69, 0.05); /* #28a745 @ 5% */
}
.match-item.result-loss {
	background-color: rgba(220, 53, 69, 0.05); /* #dc3545 @ 5% */
}
.match-item.result-draw {
	background-color: rgba(108, 117, 125, 0.05); /* #6c757d @ 5% */
}
.match-item.result-win::before,
.match-item.result-loss::before,
.match-item.result-draw::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 0;
	width: 6px;
	height: 100%;
}
.match-item.result-win::before { background-color: #28a745; }
.match-item.result-loss::before { background-color: #dc3545; }
.match-item.result-draw::before { background-color: #6c757d; }
.match-details {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
	border-top: 1px solid #f1f3f5;
}
.match-item.open .match-details {
	max-height: 200px;
}
.detail {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	color: #343a40;
}
.detail + .detail {
	border-top: 1px dashed #e9ecef;
}
.detail-label {
	font-weight: 600;
	color: #495057;
}
.detail-value {
	color: #212529;
}
.icon {
	width: 16px;
	height: 16px;
	display: inline-block;
	background-size: 16px 16px;
	background-repeat: no-repeat;
	background-position: center;
	flex: 0 0 16px;
	filter: grayscale(10%);
}
.icon-stadium {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23595057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M3 5v6c0 1.7 4 3 9 3s9-1.3 9-3V5'/%3E%3Cpath d='M3 11v4c0 1.7 4 3 9 3s9-1.3 9-3v-4'/%3E%3C/svg%3E");
}
.icon-time {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23595057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 3'/%3E%3C/svg%3E");
}
.matches-empty {
	text-align: center;
	padding: 1.25rem 1rem;
	color: #6c757d;
	border: 1px dashed #dee2e6;
	border-radius: 6px;
	background: #f8f9fa;
}
.matches-loading {
	display: grid;
	gap: 1rem;
}
.skeleton-card {
	border: 1px solid #eee;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}
.skeleton-row {
	height: 64px;
	background: linear-gradient(90deg, #f3f4f6 25%, #eceef1 37%, #f3f4f6 63%);
	background-size: 400% 100%;
	animation: shimmer 1.2s ease-in-out infinite;
	border-radius: 8px;
}
@keyframes shimmer {
	0% { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

.club-stats-section {
	margin: 2rem auto 0;
	max-width: 1200px;
	padding: 0 1rem;
	direction: rtl;
}
.club-stats-title {
	margin: 1.5rem 0 1rem;
	font-size: 1.25rem;
}
.club-stats-card {
	background: #fff;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
	padding: 1rem 1.25rem;
}
.stats-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: center;
	gap: 1.25rem;
}
.stats-chart {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
}
.stats-pie {
	width: 180px;
	height: 180px;
	border-radius: 50%;
	position: relative;
	background: conic-gradient(#e9ecef 0 100%);
}
.stats-pie-hole {
	position: absolute;
	inset: 20%;
	background: #fff;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px #f1f3f5;
	z-index: 1;
}
.stats-pie-center {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	text-align: center;
	z-index: 2;
}
.stats-total {
	font-weight: 800;
	color: #212529;
	font-size: clamp(0.9rem, 1.8vw, 1.1rem);
	line-height: 1.1;
}
.stats-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	justify-content: center;
}
.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.25rem 0.6rem;
	border: 1px solid #e9ecef;
	border-radius: 999px;
	background: #f8f9fa;
	color: #495057;
	font-size: 0.9rem;
}
.legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
}
.stats-table-wrap {
	width: 100%;
}
.club-stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}
.club-stats-table tr {
	border-bottom: 1px solid #e9ecef;
}
.club-stats-table tr:last-child {
	border-bottom: none;
}
.club-stats-table th {
	text-align: right;
	padding: 0.5rem 0 0.5rem 0.75rem;
	font-weight: 700;
	color: #343a40;
	vertical-align: top;
	width: 45%;
}
.club-stats-table td {
	text-align: center;
	padding: 0.5rem 0;
	color: #212529;
	font-weight: 600;
}
.stats-legend { direction: rtl; }
.legend-text .legend-num {
	direction: ltr;
	display: inline-block;
	font-weight: 700;
}
.stats-pie svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}
.stats-pie .segment {
	transition: transform 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
	transform-origin: 50% 50%;
	cursor: pointer;
}
.stats-pie .segment:hover {
	transform: scale(1.05);
	filter: brightness(1.05);
}

@media (max-width: 768px) {
	.match-row-compact {
		grid-template-columns: 1fr auto;
		gap: 0.5rem 0.75rem;
	}
	.team-name {
		max-width: none;
	}
	.date {
		width: 100%;
		text-align: center;
		order: 4;
	}
	.stats-layout {
		grid-template-columns: 1fr;
	}
	.stats-pie {
		width: 140px;
		height: 140px;
	}
	.club-stats-title {
		margin-top: 1rem;
	}
}
