/**
 * EVD Spielplan Widget - Klassische Spielplan-Anzeige
 * Traditionelles Design wie bei Sportvereinen üblich
 */

/* =======================
   CSS Variablen - EVD Rot verwenden
   ======================= */
:root {
	--evd-primary: #DF0914;
	--evd-primary-light: #ff4f5f;
	--evd-primary-dark: #c8080f;
	--evd-secondary: #2c3e50;
	--evd-green: #27ae60;
	--evd-blue: #3498db;
	--evd-white: #ffffff;
	--evd-light-bg: #f8f9fa;
	--evd-lighter-bg: #fcfcfc;
	--evd-dark-bg: #2c3e50;
	--evd-border: #e0e0e0;
	--evd-text: #333;
	--evd-text-light: #666;
	--evd-shadow: rgba(0, 0, 0, 0.08);
}

/* =======================
   Widget Container
   ======================= */
.evd-elementor-spielplan {
	font-family: 'Poppins', Arial, sans-serif;
	margin: 1.5rem 0;
	max-width: 100%;
}

.evd-no-matches {
	text-align: center;
	padding: 3rem 2rem;
	color: var(--evd-text-light);
	background: var(--evd-white);
	border: 1px solid var(--evd-border);
	border-radius: 8px;
	font-size: 1.1rem;
}

/* =======================
   Spielplan Header (Optional)
   ======================= */
.evd-spielplan-header {
	background: linear-gradient(135deg, var(--evd-primary) 0%, var(--evd-primary-dark) 100%);
	color: var(--evd-white);
	padding: 1.25rem 1.5rem;
	text-align: center;
	border-radius: 8px 8px 0 0;
	margin-bottom: 1rem;
}

.evd-spielplan-title {
	font-size: 1.3rem;
	font-weight: 700;
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 1px;
}

/* =======================
   Match Items Container
   ======================= */
.evd-spielplan-cards {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* =======================
   Einzelne Spielplan-Zeile
   ======================= */
.evd-match-card {
	background: var(--evd-white);
	border: 1px solid var(--evd-border);
	border-radius: 8px;
	border-left: 3px solid var(--evd-primary);
	box-shadow: 0 2px 8px rgba(233, 78, 61, 0.08);
	transition: all 0.3s ease;
	overflow: hidden;
	position: relative;
	min-height: 100px;
	display: flex;
	align-items: center;
}

.evd-match-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 15px rgba(233, 78, 61, 0.15);
	border-color: var(--evd-primary);
	border-left-color: var(--evd-primary-dark);
}

/* =======================
   Match Content Layout
   ======================= */
.evd-match-content {
	display: grid;
	/* Mehr Platz für Teamnamen, etwas schlankere Score/Info/Actions */
	grid-template-columns: 120px 1.2fr 140px 1.2fr 130px 150px;
	align-items: center;
	gap: 1rem;
	width: 100%;
	padding: 1.5rem 2rem;
	background: #2b2b2b;
}

/* Bessere Anordnung für Teams */
.evd-teams-vs-section {
	display: contents; /* Macht die Teams zu Grid-Items */
}

.evd-team-section.home {
	grid-column: 2;
	justify-self: end;
	text-align: right;
}

.evd-score-section {
	grid-column: 3;
	justify-self: center;
	align-self: center;
}

.evd-team-section.away {
	grid-column: 4;
	justify-self: start;
	text-align: left;
}

.evd-match-info-actions {
	display: contents; /* Macht Info und Actions zu Grid-Items */
}

.evd-match-info {
	grid-column: 5;
}

.evd-match-actions {
	grid-column: 6;
	min-width: 140px;
}

/* =======================
   Datum Bereich
   ======================= */
.evd-match-date {
	text-align: center;
	min-width: 140px;
}

.evd-date-day {
	font-size: 0.8rem;
	font-weight: 600;
	color: #ffffff;
	text-transform: uppercase;
	display: block;
	margin-bottom: 0.375rem;
	letter-spacing: 0.5px;
}

.evd-date-main {
	font-size: 1.1rem;
	font-weight: 700;
	color: #ffffff;
	display: block;
	margin-bottom: 0.375rem;
}

.evd-date-time {
	font-size: 1rem;
	color: #ffffff;
	font-weight: 600;
	display: block;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	border: 1px solid rgba(223, 9, 20, 0.3);
}

/* =======================
   Team Bereiche
   ======================= */
.evd-team-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	min-width: 200px; /* etwas breiter für längere Namen */
	text-align: center;
}

.evd-team-section.home {
	justify-self: end;
}

.evd-team-section.away {
	justify-self: start;
}

.evd-team-name {
	font-weight: 600;
	color: #ffffff !important;
	font-size: 0.98rem;
	line-height: 1.25;
	max-width: 220px; /* mehr Platz für Teamnamen */
	margin-bottom: 0.5rem;
	order: -1;
	white-space: normal; /* umbrüche erlauben */
	overflow: visible;
	text-overflow: unset;
	word-break: normal;
	overflow-wrap: anywhere; /* bricht sehr lange Worte */
	hyphens: auto; /* wo möglich Silbentrennung */
}
 

.evd-team-logo:hover {
	transform: scale(1.08);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.evd-team-logo {
	width: 58px; /* mehr Umgebung für roten BG */
	height: 58px;
	background: rgba(223, 9, 20, 0.1);
	border: 1px solid rgba(223, 9, 20, 0.3);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.evd-team-logo img {
	max-width: 42px; /* Logo-Größe zurück auf kompakt */
	max-height: 42px;
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: center;
	border-radius: 10px;
	display: block;
	margin: auto;
}

.evd-team-logo .logo-placeholder {
	width: 42px;
	height: 42px;
	background: var(--evd-primary);
	color: var(--evd-white);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px; /* stärker abgerundet */
	font-weight: 700;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.evd-team-name {
	font-weight: 600;
	color: #ffffff !important;
	font-size: 0.98rem;
	line-height: 1.25;
	max-width: 220px;
	white-space: normal;
	overflow: visible;
	text-overflow: unset;
	overflow-wrap: anywhere;
	hyphens: auto;
	margin-bottom: 0.5rem;
	order: -1;
	white-space: nowrap;
	overflow: hidden;	text-overflow: ellipsis;
}

/* =======================
   Score/VS Bereich
   ======================= */
.evd-score-section {
	text-align: center;
	min-width: 140px; /* schmaler, schafft Platz für Namen */
	padding: 0 0.75rem;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: nowrap;
	gap: 0.25rem;
}

.evd-score-result {
	font-size: 1.5rem;
	font-weight: 800;
	color: #ffffff !important;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.5rem 1rem; /* kompakter */
	border-radius: 8px;
	border: 1px solid rgba(223, 9, 20, 0.3);
	display: inline-block;
	min-width: 48px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	margin: 0 0.25rem;
}

.evd-score-vs {
	font-size: 1.3rem;
	font-weight: 600;
	color: #ffffff;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.625rem 1.25rem;
	border-radius: 8px;
	border: 1px solid rgba(223, 9, 20, 0.3);
	display: inline-block;
	min-width: 70px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* =======================
   Status & Info Bereich
   ======================= */
.evd-match-info {
	text-align: center;
	min-width: 140px;
}

.evd-status-badge {
	display: inline-block;
	padding: 0.5rem 1rem;
	border-radius: 25px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	margin-bottom: 0.625rem;
	letter-spacing: 0.5px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.evd-status-badge.fuechse-heim {
	font-size: 0.8rem;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	border: 1px solid rgba(223, 9, 20, 0.3);
}

.evd-status-badge.fuechse-gast {
	font-size: 0.8rem;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	border: 1px solid rgba(223, 9, 20, 0.3);
}

.evd-status-badge.neutral {
	background: var(--evd-text-light);
	color: var(--evd-white);
}

/* Fallback für alte Klassen */
.evd-status-badge.heimspiel {
	background: var(--evd-primary);
	color: var(--evd-white);
}

.evd-status-badge.auswaerts {
	background: var(--evd-secondary);
	color: var(--evd-white);
}

.evd-venue-info {
	font-size: 0.8rem;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: rgba(223, 9, 20, 0.1);
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	border: 1px solid rgba(223, 9, 20, 0.3);
	font-weight: 500;
}

.evd-venue-info i {
	color: #ffffff;
	font-size: 0.8rem;
	flex-shrink: 0;
}

.evd-venue-info .venue-text {
	font-weight: 600;
	color: #ffffff;
	text-align: center;
	line-height: 1.3;
}

/* =======================
   Action Buttons - Exakt wie Website-Buttons
   ======================= */
.evd-match-actions {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 110px;
	width: 100%;
}

.evd-btn {
	background-color: var(--bg-transparent-rot) !important;
	color: var(--text-weiss) !important;
	border: 2px solid var(--fuechse-rot) !important;
	text-decoration: none !important;
	padding: 15px 25px !important;
	border-radius: 4px !important;
	margin-right: 10px !important;
	font-family: 'Redzone BlackReg', sans-serif !important;
	font-size: 17px !important;
	transition: all 0.3s ease !important;
	white-space: nowrap !important;
	overflow: visible !important;
	text-overflow: initial !important;
	flex-shrink: 0 !important;
	height: 55px !important;
	display: inline-flex !important;
	align-items: center !important;	justify-content: center !important;
	width: 100% !important;
	min-width: 100% !important;
	margin: 2px 0 !important;
	letter-spacing: 0.5px !important;
	text-transform: uppercase !important;
}

/* Spielbericht-Button etwas breiter wirken lassen */
.evd-btn-report {
	padding-left: 30px !important;
	padding-right: 30px !important;
}

.evd-btn:hover {
	background-color: var(--fuechse-rot) !important;
	color: var(--text-weiss) !important;
	text-decoration: none !important;
}

/* Alle evd-buttons sind jetzt einheitlich CI-konform rot */

/* =======================
   Responsive Design
   ======================= */
@media (max-width: 1200px) {
	.evd-match-content {
		/* kompaktere Mitte, mehr Platz für Teamnamen */
		grid-template-columns: 110px 1.2fr auto 1.2fr 110px auto;
		gap: 1.1rem;
		padding: 1.25rem 1.25rem;
	}
    
	.evd-team-logo {
		width: 50px;
		height: 50px;
	}
    
	.evd-team-logo img,
	.evd-team-logo .logo-placeholder {
		max-width: 38px;
		max-height: 38px;
		width: 38px;
		height: 38px;
		font-size: 0.8rem;
	}
    
	.evd-team-name {
		font-size: 0.98rem;
		max-width: 180px; /* vorher 120px -> mehr Platz */
		white-space: normal;
		overflow: visible;
		text-overflow: unset;
	}
	.evd-score-section {
		min-width: 120px;
		padding: 0 0.5rem;
	}
}
@media (max-width: 768px) {
	.evd-elementor-spielplan {
		margin: 1rem 0;
	}
	
	.evd-match-card {
		min-height: 120px;
		border-radius: 8px;
	}
	
	.evd-match-content {
		display: flex;
		flex-direction: column;
		gap: 1rem;
		padding: 1.25rem;
		text-align: center;
	}
	
	/* Mobile: Stack Layout */
	.evd-match-date {
		order: 1;
		border-bottom: 1px solid var(--evd-border);
		padding-bottom: 1rem;
		margin-bottom: 0;
		min-width: auto;
	}
	
	.evd-teams-vs-section {
		order: 2;
		display: grid;
		grid-template-columns: 1fr auto 1fr;
		align-items: center;
		gap: 1.25rem;
		margin-bottom: 0;
	}
	
	.evd-team-section.home {
		grid-column: 1;
		justify-self: center;
		text-align: center;
	}
	
	.evd-score-section {
		grid-column: 2;
		justify-self: center;
	}
	
	.evd-team-section.away {
		grid-column: 3;
		justify-self: center;
		text-align: center;
	}
	
	.evd-match-info-actions {
		order: 3;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-top: 1px solid var(--evd-border);
		padding-top: 1rem;
		gap: 1rem;
	}
	
	.evd-team-section {
		min-width: auto;
		flex-direction: column;
		gap: 0.75rem;
		justify-content: center;
		text-align: center;
	}
		.evd-team-logo {
		width: 45px;
		height: 45px;
		border-radius: 6px;
	}
	
	.evd-team-logo img,
	.evd-team-logo .logo-placeholder {
		max-width: 35px;
		max-height: 35px;
		width: 35px;
		height: 35px;
		font-size: 0.75rem;
		border-radius: 3px;
	}
	
	.evd-team-name {
		font-size: 0.95rem;		max-width: none;
	}
	
	.evd-score-result,
	.evd-score-vs {
		font-size: 1.3rem;
		padding: 0.5rem 1rem;
		min-width: 60px;
	}
	
	.evd-match-actions {
		flex-direction: row;
		gap: 0.5rem;
		min-width: auto;
		flex-wrap: wrap;
		width: 100%;
	}
	.evd-btn {
		padding: 10px 16px;
		font-size: 14px;
		min-height: 36px;
		min-width: 60px;
		width: auto;
		flex: 1 1 45%;
	}
	
	.evd-status-badge {
		padding: 0.375rem 0.75rem;
		font-size: 0.7rem;
		margin-bottom: 0.5rem;
	}
	
	.evd-venue-info {
		font-size: 0.75rem;
		padding: 0.25rem 0.5rem;
	}
	
	.evd-match-info {
		min-width: auto;
		flex: 1;
	}
}

@media (max-width: 480px) {
	.evd-spielplan-cards {
		padding: 0.75rem;
		gap: 0.75rem;
	}
	
	.evd-match-content {
		padding: 1rem;
		gap: 0.75rem;
	}
	
	.evd-spielplan-title {
		font-size: 1.1rem;
	}
	
	.evd-spielplan-header {
		padding: 1rem;
	}
	
	.evd-date-main {
		font-size: 1rem;
	}
		.evd-date-time {
		font-size: 0.9rem;		font-weight: 600;
	}
	
	.evd-team-name {
		font-size: 0.9rem;
		white-space: normal;		overflow: visible;
		text-overflow: unset;
	}
	
	.evd-teams-vs-section {
		gap: 1rem;
	}
		.evd-team-logo {
		width: 40px;
		height: 40px;
		border-radius: 5px;
	}
	
	.evd-team-logo img,
	.evd-team-logo .logo-placeholder {
		max-width: 30px;
		max-height: 30px;
		width: 30px;
		height: 30px;
		font-size: 0.7rem;
		border-radius: 3px;
	}
	
	.evd-score-result,
	.evd-score-vs {
		font-size: 1.2rem;
		padding: 0.375rem 0.75rem;
	}
	
	.evd-match-info-actions {
		flex-direction: column;
		gap: 0.75rem;
		align-items: center;
	}
	
	.evd-match-actions {
		width: 100%;
		justify-content: center;
	}
	.evd-btn {
		min-width: 70px;
		padding: 8px 12px;
		font-size: 13px;
		min-height: 34px;
	}
}

/* =======================
   Print Styles
   ======================= */
@media print {
	.evd-elementor-spielplan {
		box-shadow: none;
		border: 1px solid #000;
		background: white;
	}
	
	.evd-match-card {
		box-shadow: none;
		border: 1px solid #ccc;
		margin-bottom: 0.5rem;
		break-inside: avoid;
		background: white;
	}
	
	.evd-match-card:hover {
		transform: none;
		box-shadow: none;
	}
	
	.evd-btn {
		display: none;
	}
	
	.evd-team-logo {
		box-shadow: none;
	}
	.evd-spielplan-header {
		background: #e94e3d !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* =======================
   Responsive Design für Cards
   ======================= */
@media (max-width: 1200px) {
	.evd-spielplan-cards {
		grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
		gap: 1.25rem;
	}
}

@media (max-width: 768px) {
	.evd-spielplan-cards {
		grid-template-columns: 1fr;
		gap: 1rem;
		margin: 0 -0.5rem;
	}
	
	.evd-match-card {
		min-height: 240px;
		border-radius: 12px;
	}
	
	.evd-card-header {
		padding: 1.25rem 1.25rem 0;
	}
	
	.evd-card-body {
		padding: 1.25rem;
	}
	
	.evd-card-footer {
		padding: 0 1.25rem 1.25rem;
	}
	
	.evd-teams-container {
		gap: 1rem;
		margin-bottom: 1.25rem;
	}
	
	.evd-team-logo {
		width: 54px; /* mehr Umgebung */
		height: 54px;
	}
    
	.evd-team-logo img {
		max-width: 38px; /* Logo kompakt halten */
		max-height: 38px;
	}
	
	.evd-team-logo .logo-placeholder {
		width: 38px;
		height: 38px;
		font-size: 0.75rem;
	}
	.evd-score-result {
		font-size: 1.75rem;
		padding: 0.625rem 1.25rem;
		color: #ffffff !important;
	}
	
	.evd-score-vs {
		font-size: 1.25rem;
		padding: 0.625rem 1.25rem;
	}
}

@media (max-width: 480px) {
	.evd-spielplan-cards {
		margin: 0 -1rem;
	}
	
	.evd-match-card {
		min-height: 220px;
		border-radius: 10px;
		margin: 0 0.5rem;
	}
	
	.evd-card-header {
		padding: 1rem 1rem 0;
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}
	
	.evd-card-body {
		padding: 1rem;
	}
	
	.evd-card-footer {
		padding: 0 1rem 1rem;
	}
	
	.evd-teams-container {
		gap: 0.75rem;
		margin-bottom: 1rem;
	}
	
	.evd-team-logo {
		width: 50px; /* mehr Umgebung */
		height: 50px;
	}
    
	.evd-team-logo img {
		max-width: 34px; /* Logo kompakt halten */
		max-height: 34px;
	}
	
	.evd-team-logo .logo-placeholder {
		width: 32px;
		height: 32px;
		font-size: 0.7rem;
	}
	
	.evd-team-name {
		font-size: 0.9rem;
	}
		.evd-score-result {
		font-size: 1.5rem;
		padding: 0.5rem 1rem;
		color: #ffffff !important;
	}
	
	.evd-score-vs {
		font-size: 1.1rem;
		padding: 0.5rem 1rem;
		letter-spacing: 2px;
	}
	
	.evd-card-actions {
		flex-direction: column;
		gap: 0.375rem;
	}
	
	.evd-btn {
		padding: 0.75rem 1rem;
		font-size: 0.75rem;
		flex: none;
		width: 100%;
	}
	
	.evd-status-badge {
		padding: 0.5rem 0.875rem;
		font-size: 0.65rem;
	}
	
	.evd-card-date .date-main {
		font-size: 1.1rem;
	}
	
	.evd-card-date .date-time {
		font-size: 0.8rem;
	}
}

/* =======================
   Loading & Animation States
   ======================= */
.evd-spielplan-loading {
	text-align: center;
	padding: 3rem;
	color: var(--evd-text-muted);
}

.evd-spielplan-loading::before {
	content: "";
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid var(--evd-border);
	border-radius: 50%;
	border-top-color: var(--evd-primary);
	animation: spin 1s ease-in-out infinite;
	margin-bottom: 1rem;
}

@keyframes spin {
	to { 
		transform: rotate(360deg); 
	}
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.8;
	}
}

/* Card animations */
.evd-match-card {
	animation: fadeInUp 0.6s ease-out;
}

.evd-match-card:nth-child(even) {
	animation-delay: 0.15s;
}

.evd-match-card:nth-child(3n) {
	animation-delay: 0.3s;
}

.evd-score-result {
	animation: pulse 4s infinite;
}

/* =======================
   Dark Mode Support
   ======================= */
@media (prefers-color-scheme: dark) {
	:root {
		--evd-light-bg: #2c3e50;
		--evd-white: #34495e;
		--evd-border: #4a5568;
		--evd-border-light: #4a5568;
		--evd-text: #e2e8f0;
		--evd-text-muted: #a0aec0;
		--evd-shadow: rgba(0, 0, 0, 0.3);
	}
	
	.evd-match-card {
		background: var(--evd-white);
		border-color: var(--evd-border);
	}

	/* Team-Logo Hervorhebung im Dark Mode */
	.evd-team-logo {
		background: rgba(223, 9, 20, 0.1);
		border: 1px solid rgba(223, 9, 20, 0.3);
		border-radius: 12px;
	}
	
	.evd-btn {
		background: var(--evd-white);
		border-color: var(--evd-primary);
	}
}

/* =======================
   Accessibility Improvements
   ======================= */
.evd-btn:focus,
.evd-team-logo:focus {
	outline: 3px solid var(--evd-primary);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px rgba(233, 78, 61, 0.2);
}

@media (prefers-reduced-motion: reduce) {
	.evd-match-card,
	.evd-team-logo,
	.evd-btn,
	.evd-score-result {
		animation: none;
		transition: none;
	}
	
	.evd-team-logo::before,
	.evd-btn::before {
		transition: none;
	}
	
	.evd-match-card:hover {
		transform: none;
	}
	
	.evd-team-logo:hover {
		transform: none;
	}
}

/* =======================
   High Contrast Mode
   ======================= */
@media (prefers-contrast: high) {
	.evd-match-card {
		border-width: 3px;
	}
	
	.evd-status-badge,
	.evd-btn {
		border-width: 3px;
	}
	
	.evd-team-logo {
		border-width: 3px;
	}
	
	.evd-score-result {
		border-width: 3px;
	}
}
