/**
 * DartsPress Frontend Styles
 *
 * Styles for front-end shortcode displays.
 *
 * @package    DartsPress
 * @since      0.2.0
 */

/* ==========================================
   SHARED SHORTCODE STYLES
   ========================================== */

.dp-shortcode,
.dp-result-container {
	margin: 20px 0;
	padding: 20px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dp-fixture-page {
	padding: 8px;
}

.dp-fixture-header {
	text-align: center;
	margin: 20px 0 40px;
}

.dp-fixture-header h1 {
	margin: 0 0 8px 0;
	font-size: 2rem;
}

.dp-fixture-header p {
	margin: 0;
	color: #646970;
	font-size: 14px;
}

.dp-shortcode h3,
.dp-result-container h3 {
	margin: 0 0 15px 0;
	padding: 0;
	font-size: 20px;
	font-weight: bold;
	color: #333;
	border-bottom: 2px solid #d4a017;
	padding-bottom: 10px;
}

.dp-shortcode h4,
.dp-result-container h4 {
	margin: 0 0 10px 0;
	padding: 0;
	font-size: 16px;
	font-weight: bold;
	color: #333;
}

.dp-result-meta {
	margin: 0;
	padding: 6px 12px;
	background: #6b6b6b;
	color: #fff;
	text-align: center;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.8px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0;
}

.dp-result-meta-item {
	white-space: nowrap;
}

.dp-result-meta-sep {
	margin: 0 10px;
}

.dp-result-container .dp-result-team-name {
	font-size: 2rem;
}

.dp-result-container .dp-result-stat-value {
	font-size: 12px;
	font-weight: 500;
}

.dp-error {
	color: #d63638;
	padding: 15px;
	background: #fef7f7;
	border-left: 4px solid #d63638;
	border-radius: 4px;
}

.dp-info {
	color: #646970;
	padding: 15px;
	background: #f6f7f7;
	border-left: 4px solid #646970;
	border-radius: 4px;
}

/* ==========================================
   MATCH SHORTCODE - TABLE DISPLAY
   ========================================== */

.dp-match-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	flex-wrap: wrap;
	gap: 10px;
	border-bottom: 2px solid #d4a017;
	padding-bottom: 10px;
	width: 100%;
}

.dp-match-header .dp-match-title {
	border-bottom: 0 !important;
	padding-bottom: 0;
	margin-bottom: 0;
}

.dp-toggle-all-stats[data-state="visible"] .dashicons {
	transform: rotate(180deg);
}

.dp-match-games {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin-top: 10px;
}

.dp-match-game-card {
	background: #f6f7f7;
	border-radius: 8px;
	padding: 10px;
	border: 1px solid #e0e0e0;
	box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.dp-match-game-card--gallon {
	margin-bottom: 20px;
}

.dp-match-game-main {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.dp-game-label {
	text-align: left;
	font-weight: 600;
	font-size: 13px;
	color: #222222;
	text-transform: uppercase;
	background: #e0e0e0;
	border: 0;
	border-bottom: 1px solid #dcdcde;
	border-radius: 8px 8px 0 0;
	margin: -10px -10px 0;
	padding: 6px 10px 6px 12px;
}

.dp-game-columns {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 12px;
}

.dp-game-col {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dp-game-side {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 8px 10px;
}

.dp-result-side {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 12px;
	align-items: center;
}

.dp-result-details {
	min-width: 0;
}

.dp-result-score-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	min-height: 2.5rem;
	padding: 0 0.4rem;
	border-radius: 8px;
	font-size: 2rem;
	font-weight: 700;
	color: #1d2327;
	background: #ffffff;
	border: 1px solid #dcdcde;
	white-space: nowrap;
}

.dp-stats-col {
	display: block;
}
.dp-toggle-all-stats {
	display: inline-flex !important;
	flex-direction: row !important;
	align-items: center;
	gap: 4px;
	padding: 2px 5px;
	background: #b3870f;
	color: #fff;
	border: 1px solid #b3870f;
	border-radius: 4px;
	font-size: 9px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	line-height: 1;
}

.dp-toggle-all-stats:hover {
	background: #d4a017;
	border-color: #d4a017;
}

.dp-toggle-all-stats .dashicons {
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	font-size: 10px;
	line-height: 1;
	transition: transform 0.3s ease;
}

.dp-toggle-all-stats.dashicons,
.dp-toggle-all-stats .dashicons {
	width: auto !important;
	height: auto !important;
	font-size: 10px !important;
	line-height: 1 !important;
}

.dp-toggle-all-stats .dp-toggle-text {
	display: inline-block;
	white-space: nowrap;
}

.dp-result-indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-left: 6px;
	border-radius: 50%;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	line-height: 1;
}

.dp-result-indicator.dp-result-win {
	background: #2ea043;
}

.dp-result-indicator.dp-result-loss {
	background: #d63638;
}

.dp-venue-map {
	border-radius: 8px;
	overflow: hidden;
	height: 300px;
}

.dp-venue-map iframe {
	border: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.dp-previous-meetings-table-wrap {
	overflow-x: auto;
}

.dp-previous-meetings-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
}

.dp-previous-meetings-table th {
	text-align: left;
	padding: 10px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background: #d4a017;
	border-bottom: 2px solid #b3870f;
}

.dp-previous-meetings-table td {
	padding: 10px;
	border-bottom: 1px solid #f0f0f1;
	font-size: 14px;
	color: #1d2327;
}

.dp-previous-meetings-table tr:hover td {
	background: #f6f7f7;
}

.dp-previous-date {
	color: #646970;
	font-size: 12px;
}

.dp-season-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	color: #1d2327;
	background: #eef2f6;
	border: 1px solid #d0d7de;
	white-space: nowrap;
}

.dp-previous-team {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.dp-previous-vs {
	margin: 0 8px;
	color: #646970;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.dp-competition-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	color: #1d2327;
	background: #f1f1f1;
	border: 1px solid #dcdcde;
	white-space: nowrap;
}

.dp-score-box {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
}

.dp-score-box.dp-score-win {
	background: #2ea043;
}

.dp-score-box.dp-score-loss {
	background: #d63638;
}

.dp-score-box.dp-score-draw {
	background: #646970;
}

.dp-match-table-wrapper {
	overflow-x: auto;
	padding: 6px 8px 8px;
	border-radius: 8px;
	background: #fff;
}

.dp-match-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
}

.dp-match-table thead {
	background: #d4a017;
	border-bottom: 2px solid #b3870f;
}

.dp-match-table th {
	padding: 12px 10px;
	text-align: left;
	font-weight: 600;
	font-size: 14px;
	color: #ffffff !important;
	background-color: #d4a017 !important;
}

.dp-match-table th.dp-game-number {
	width: 60px;
	text-align: center;
}

.dp-match-table th.dp-score {
	width: 100px;
	text-align: center;
}

.dp-match-table tbody tr {
	border-bottom: 1px solid #f0f0f1;
	transition: background-color 0.2s ease;
}

.dp-match-table tbody tr.dp-game-row,
.dp-match-table tbody tr.dp-stats-row {
	border-bottom: 0;
}

.dp-match-table tbody tr:hover {
	background: #f6f7f7;
}

.dp-match-table td {
	padding: 12px 10px;
	font-size: 14px;
	color: #50575e;
}

.dp-match-table .dp-game-row td,
.dp-match-table .dp-stats-row td {
	background: #f6f7f7;
	box-shadow: 0 1px 2px rgba(0,0,0,0.06);
	background-clip: padding-box;
}

.dp-match-table .dp-game-row td:first-child {
	border-top-left-radius: 8px;
}

.dp-match-table .dp-game-row td:last-child {
	border-top-right-radius: 8px;
}

.dp-match-table .dp-stats-row td:first-child {
	border-bottom-left-radius: 8px;
}

.dp-match-table .dp-stats-row td:last-child {
	border-bottom-right-radius: 8px;
}

.dp-match-table .dp-game-row--solo td:first-child {
	border-bottom-left-radius: 8px;
}

.dp-match-table .dp-game-row--solo td:last-child {
	border-bottom-right-radius: 8px;
}

.dp-match-table .dp-game-row--solo td {
	border-bottom: 12px solid #fff;
}

.dp-match-table .dp-stats-row td {
	border-bottom: 12px solid #fff;
}

.dp-player-name {
	font-size: 16px;
	font-weight: 700;
	color: #222222;
}

.dp-player-team {
	display: block;
	font-size: 10px;
	font-weight: 600;
	color: #7a7a7a;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-top: 0;
}

.dp-player-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.dp-player-meta {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 10px;
	align-items: center;
	min-width: 0;
}

.dp-result-indicator {
	grid-row: 1 / span 2;
}

.dp-player-score-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	min-height: 2.5rem;
	padding: 0 0.4rem;
	border-radius: 8px;
	font-size: 2rem;
	font-weight: 700;
	color: #1d2327;
	background: #ffffff;
	border: 1px solid #dcdcde;
	white-space: nowrap;
}

.dp-match-table td.dp-game-number {
	text-align: center;
	font-weight: 600;
	color: #1d2327;
}

.dp-match-table td.dp-score {
	text-align: center;
	font-weight: bold;
	font-size: 16px;
}

.dp-match-table th.dp-score,
.dp-match-table td.dp-score,
.dp-stats-cell.dartspress-stats-score-col {
	display: none;
}

/* Winner/Loser coloring for match table */
.dp-game-row.dp-home-won td.dp-home-player {
	background-color: #e7f5e7;
	font-weight: 600;
}

.dp-game-row.dp-home-won td.dp-away-player {
	background-color: #f5e7e7;
}

.dp-game-row.dp-away-won td.dp-home-player {
	background-color: #f5e7e7;
}

.dp-game-row.dp-away-won td.dp-away-player {
	background-color: #e7f5e7;
	font-weight: 600;
}

/* Stats row */
.dp-stats-row {
	background: #f6f7f7 !important;
	border-top: 0;
}

.dp-stats-row:hover {
	background: #f6f7f7 !important;
}

.dp-stats-cell {
	padding: 8px !important;
	vertical-align: top;
}

.dp-stats-game-col {
	/* Empty cell for game number column */
}

.dp-stats-home-col,
.dp-stats-away-col {
	/* Cells that contain stats */
}

.dp-stats-score-col {
	/* Empty cell for score column */
}

.dp-player-stats {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 10px;
}

.dp-player-stats-home {
	border-left: 3px solid #84c584;
}

.dp-player-stats-away {
	border-left: 3px solid #e57373;
}

.dp-player-stats.dp-stats-win {
	background: #fff;
	border-color: #dcdcde;
	border-bottom: 4px solid #2ea043;
}

.dp-player-stats.dp-stats-loss {
	background: #fff;
	border-color: #dcdcde;
	border-bottom: 4px solid #d63638;
}

.dp-stats-grid {
	display: flex;
	gap: 6px;
	justify-content: space-between;
	flex-wrap: nowrap;
}

.dp-stat-box {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 6px;
	background: #f6f7f7;
	border-radius: 4px;
	text-align: center;
	flex: 1 1 0;
	min-width: 0;
}

.dp-stat-label {
	font-size: 9px;
	font-weight: 600;
	color: #646970;
	text-transform: uppercase;
	white-space: nowrap;
}

.dp-stat-value {
	font-size: 13px;
	font-weight: bold;
	color: #1d2327;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ==========================================
   MATCH RESULT (INTEGRATED IN SINGLES)
   ========================================== */

.dp-match-result {
	margin-top: 20px;
	padding: 20px;
	background: #f6f7f7;
	border-radius: 6px;
	border: 1px solid #dcdcde;
}

.dp-match-result-title {
	margin: 0 0 15px 0;
	padding: 0 0 10px 0;
	font-size: 18px;
	font-weight: bold;
	color: #1d2327;
	border-bottom: 2px solid #dcdcde;
	text-align: center;
}

.dp-result-grid {
	display: flex;
	gap: 15px;
	align-items: center;
	margin-bottom: 15px;
}

.dp-result-game-col {
	flex: 0 0 60px;
	/* Matches game number column width from table */
}

.dp-result-team {
	flex: 1;
	background: #fff;
	border: 2px solid #dcdcde;
	border-radius: 6px;
	padding: 15px;
}

.dp-result-team.dp-winner {
	border-bottom: 4px solid #2ea043;
}

.dp-result-team.dp-loser {
	border-bottom: 4px solid #d63638;
}

.dp-result-team-name {
	font-size: 14px;
	font-weight: bold;
	color: #1d2327;
	text-align: center;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid #dcdcde;
}

.dp-result-stats-horizontal {
	display: flex;
	gap: 6px;
	justify-content: space-between;
	flex-wrap: nowrap;
}

.dp-result-stat-box {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 4px;
	background: #f6f7f7;
	border-radius: 4px;
	text-align: center;
	flex: 1 1 0;
	min-width: 0;
}


.dp-result-stat-label {
	font-size: 9px;
	font-weight: 600;
	color: #646970;
	text-transform: uppercase;
	white-space: nowrap;
}

.dp-result-stat-value {
	font-size: 13px;
	font-weight: bold;
	color: #1d2327;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dp-result-score-box {
	flex: 0 0 auto;
	min-width: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 10px;
}

.dp-result-final-score {
	font-size: 16px;
	font-weight: bold;
	color: #2271b1;
	white-space: nowrap;
}

.dp-result-note {
	margin: 0;
	padding: 10px;
	background: #fff;
	border-radius: 4px;
	font-size: 11px;
	color: #646970;
	font-style: italic;
	text-align: center;
}

/* ==========================================
   GALLON SHORTCODE - FLEX LAYOUT
   ========================================== */

.dp-gallon-description {
	margin: 5px 0 6px 0;
	font-size: 14px;
	color: #646970;
}

.dp-gallon-content {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 20px;
	background: #f6f7f7;
	border-radius: 6px;
}

.dp-gallon-team {
	flex: 1;
	text-align: center;
	padding: 15px;
	background: #fff;
	border-radius: 6px;
	border: 1px solid #dcdcde;
}

.dp-gallon-team-name {
	margin: 0 0 10px 0;
	font-size: 16px;
	font-weight: bold;
	color: #1d2327;
}

.dp-gallon-players {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.dp-gallon-player {
	display: block;
	font-size: 14px;
	color: #50575e;
}

.dp-gallon-score {
	flex: 0 0 auto;
	min-width: 100px;
	text-align: center;
}

.dp-gallon-score-display {
	display: block;
	font-size: 32px;
	font-weight: bold;
	color: #111111;
}

/* Winner/Loser coloring for gallon */
.dp-gallon-content.dp-home-won .dp-gallon-home {
	background-color: #e7f5e7;
	border-color: #84c584;
}

.dp-gallon-content.dp-home-won .dp-gallon-away {
	background-color: #f5e7e7;
	border-color: #e57373;
}

.dp-gallon-content.dp-away-won .dp-gallon-home {
	background-color: #f5e7e7;
	border-color: #e57373;
}

.dp-gallon-content.dp-away-won .dp-gallon-away {
	background-color: #e7f5e7;
	border-color: #84c584;
}

/* Winner/Loser highlight bar for gallon */
.dp-gallon-content.dartspress-home-won .dartspress-gallon-home {
	border-bottom: 4px solid #2ea043;
}

.dp-gallon-content.dartspress-home-won .dartspress-gallon-away {
	border-bottom: 4px solid #d63638;
}

.dp-gallon-content.dartspress-away-won .dartspress-gallon-away {
	border-bottom: 4px solid #2ea043;
}

.dp-gallon-content.dartspress-away-won .dartspress-gallon-home {
	border-bottom: 4px solid #d63638;
}

/* ==========================================
   RESULT SHORTCODE - GRID LAYOUT
   ========================================== */

.dp-result-content {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: stretch;
	gap: 20px;
	margin-top: 15px;
}

.dp-result-team {
	display: flex;
	align-items: stretch;
	gap: 16px;
	padding: 20px;
	background: #f6f7f7;
	border-radius: 6px;
	border: 2px solid #dcdcde;
}

.dp-result-team--home {
	flex-direction: row;
}

.dp-result-team--away {
	flex-direction: row;
}

.dp-result-details {
	flex: 1 1 auto;
	min-width: 0;
}

.dp-result-team-name {
	margin: 0 0 12px 0;
	padding-bottom: 10px;
	border-bottom: 2px solid #dcdcde;
	text-align: left;
	font-size: 18px;
	font-weight: bold;
	color: #1d2327;
}

.dp-result-stats {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 1.5fr);
	gap: 6px;
}

.dp-result-stat {
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding: 8px;
	background: #fff;
	border-radius: 4px;
	text-align: center;
}

.dp-result-stat-label {
	font-size: 10px;
	font-weight: 600;
	color: #646970;
	text-transform: uppercase;
}

.dp-result-stat-value {
	font-size: 16px;
	font-weight: bold;
	color: #1d2327;
}

.dp-result-score {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 60px;
	max-width: 110px;
	padding: 8px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
}

.dp-result-score--stack {
	flex-direction: column;
	gap: 4px;
}

.dp-result-score-display {
	display: block;
	font-size: 36px;
	font-weight: bold;
	color: #111111;
	text-align: center;
}

.dp-result-score-gallon {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #50575e;
	line-height: 1;
	padding-top: 4px;
	border-top: 1px solid #b5b5b5;
}

.dp-result-footer {
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid #dcdcde;
	font-size: 12px;
	color: #646970;
	font-style: italic;
}

/* Winner/Loser coloring for result */
.dp-result-team.dp-winner {
	border-bottom: 4px solid #2ea043;
}

.dp-result-team.dp-loser {
	border-bottom: 4px solid #d63638;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
	.dp-result-content {
		grid-template-columns: 1fr;
	}

	.dp-result-team--away {
		flex-direction: row;
	}

	.dp-result-score-display {
		font-size: 30px;
	}

	.dp-match-table {
		font-size: 13px;
	}

	.dp-match-table th,
	.dp-match-table td {
		padding: 8px 6px;
	}

	.dp-match-header {
		flex-direction: column;
		align-items: stretch;
	}

	.dp-match-title {
		text-align: center;
	}

	.dp-toggle-all-stats {
		width: 100%;
		justify-content: center;
	}

	/* Stack stats row on mobile - show in single column spanning full width */
	.dp-stats-row td {
		display: block;
		width: 100%;
	}

	.dp-stats-game-col,
	.dp-stats-score-col {
		display: none;
	}


	.dp-stats-grid {
		flex-wrap: nowrap;
		gap: 6px;
	}

	.dp-stat-box {
		flex: 1 1 0;
		min-width: 0;
	}

	/* Match result responsive */
	.dp-result-grid {
		flex-direction: column;
		gap: 12px;
	}

	.dp-result-game-col {
		display: none;
	}

	.dp-result-score-box {
		order: -1;
		min-width: auto;
		padding: 15px 0;
	}

	.dp-result-final-score {
		font-size: 16px;
	}

	.dp-result-team-name {
		font-size: 14px;
	}

	.dp-result-stats-horizontal {
		flex-wrap: wrap;
		gap: 6px;
	}

	.dp-result-stat-box {
		flex: 1 1 calc(25% - 6px);
		min-width: 50px;
	}

}

@media (max-width: 800px) {
	.dp-match-game-card .dp-game-columns {
		grid-template-columns: 1fr;
	}

	.dp-result-content {
		grid-template-columns: 1fr;
	}

	.dp-result-team--away {
		flex-direction: row;
	}

	.dp-result-container .dp-result-team-name {
		font-size: 1.6rem;
	}
}
