/* ============================================
   TOURNAMENT DETAIL PAGE
   Matches Section, Rankings Section
   ============================================ */

/* Tournament Detail Header */
.tournament-detail-header {
	padding: 20px;
	max-width: 100%;
}

.tournament-title-section {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	gap: 12px;
}

.tournament-detail-name {
	font-size: 1.3rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
	flex: 1;
}

.tournament-detail-meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 12px;
	border-top: 1px solid #f0f0f0;
}

/* ============================================
   MATCHES SECTION
   ============================================ */

.matches-section {
	padding: 20px;
	max-width: 100%;
}

.section-title {
	font-size: 1.1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 16px 0;
	text-align: center
}

/* Stage Tabs */
.stage-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 20px;
	border-bottom: 2px solid #e5e5e5;
}

.stage-tab {
	padding: 10px 20px;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	font-size: 0.9rem;
	font-weight: 600;
	color: #666;
	cursor: pointer;
	transition: all 0.2s;
	position: relative;
	bottom: -2px;
}

.stage-tab:hover {
	color: #3FAE7C;
}

.stage-tab.active {
	color: #3FAE7C;
	border-bottom-color: #3FAE7C;
}

/* Round Section (Collapsible) */
.round-section {
	margin-bottom: 10px;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	width: 100%;
}

.round-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	background: #fafafa;
	cursor: pointer;
	transition: background 0.2s;
}

.round-header:hover {
	background: #f0f0f0;
}

.round-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	color: #1a1a1a;
}

.round-label {
	font-size: 0.95rem;
}

.round-remaining {
	font-size: 0.85rem;
	color: #F08C1A;
	font-weight: 600;
}

.round-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: #666;
	transition: transform 0.2s;
}

.round-section.expanded .round-toggle .toggle-icon {
	transform: rotate(180deg);
	display: inline-block;
}

.round-section.collapsed .round-toggle .toggle-icon {
	transform: rotate(0deg);
	display: inline-block;
}

.toggle-icon {
	display: inline-block;
	transition: transform 0.2s;
	font-size: 0.8rem;
}

.round-content {
	display: block;
	padding: 12px;
}

.round-section.collapsed .round-content {
	display: none;
}

/* Wave Section */
.wave-section {
	margin-bottom: 14px;
	padding-bottom: 14px;
	border-bottom: 1px solid #f0f0f0;
}

.wave-section:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.wave-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.wave-indicator {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #e5e5e5;
	flex-shrink: 0;
}

.wave-label {
	font-size: 0.9rem;
	font-weight: 600;
	color: #666;
}

.wave-badge {
	font-size: 0.7rem;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.wave-completed {
	background: #e5e5e5;
	color: #666;
}

.wave-live {
	background: #10b981;
	color: white;
	animation: pulse 2s infinite;
}

/* Courts Grid */
.courts-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 12px;
}

/* Court Card */
.court-card {
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
}

.court-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	background: #f9f9f9;
	border-bottom: 1px solid #e5e5e5;
}

.court-icon {
	font-size: 1rem;
}

.court-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: #666;
	flex: 1;
	margin-left: 6px;
}

.court-score {
	font-size: 0.9rem;
	font-weight: 700;
	color: #1a1a1a;
}

/* Court Pairs */
.court-pairs {
	padding: 10px;
	display: flex;
	flex-direction: row;
	gap: 10px;
	align-items: center;
}

.pair-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.pair-players {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: stretch;
}

.player-item {
	display: flex;
	align-items: center;
	width: 100%;
}

.player-code {
	font-size: 0.85rem;
	font-weight: 700;
	color: #1a1a1a;
	width: 100%;
	text-align: center;
}

.player-code-m {
	color: #1a1a1a;
}

.player-code-f {
	color: #1a1a1a;
}

.vs-divider {
	text-align: center;
	font-size: 0.75rem;
	font-weight: 600;
	color: #999;
	padding: 0 8px;
	flex-shrink: 0;
}

/* BYEs Section */
.byes-section {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px;
	background: #f9f9f9;
	border-radius: 5px;
	margin-top: 10px;
}

.byes-label {
	font-size: 0.75rem;
	font-weight: 700;
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	flex-shrink: 0;
}

.byes-list {
	font-size: 0.85rem;
	color: #666;
	flex: 1;
}

/* ============================================
   RANKINGS SECTION
   ============================================ */

.rankings-section {
	padding: 20px;
	max-width: 100%;
}

.rankings-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
	border-bottom: 2px solid #e5e5e5;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
}

.rankings-tabs::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}

.ranking-tab {
	padding: 10px 20px;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	font-size: 0.9rem;
	font-weight: 600;
	color: #666;
	cursor: pointer;
	transition: all 0.2s;
	position: relative;
	bottom: -2px;
	white-space: nowrap;
	flex-shrink: 0;
}

.ranking-tab:hover {
	color: #3FAE7C;
}

.ranking-tab.active {
	color: #3FAE7C;
	border-bottom-color: #3FAE7C;
}

/* Ranking Views */
.ranking-view {
	display: none;
}

.ranking-view.active {
	display: block;
}

.ranking-gender-section {
	margin-bottom: 24px;
}

.ranking-gender-section:last-child {
	margin-bottom: 0;
}

.gender-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 12px 0;
}

.gender-icon {
	font-size: 1.1rem;
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
}

.gender-icon.gender-m {
	background: #e3f2fd;
	color: #1976d2;
}

.gender-icon.gender-f {
	background: #fce4ec;
	color: #c2185b;
}

/* Ranking Table */
.ranking-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.ranking-table thead {
	background: #f9f9f9;
}

.ranking-table th {
	text-align: left;
	padding: 10px 8px;
	font-weight: 600;
	color: #666;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 2px solid #e5e5e5;
}

.ranking-table th:first-child {
	padding-left: 12px;
}

.ranking-table td {
	padding: 10px 8px;
	border-bottom: 1px solid #f0f0f0;
	color: #1a1a1a;
}

.ranking-table td:first-child {
	padding-left: 12px;
}

.ranking-table tbody tr:hover {
	background: #fafafa;
}

.rank-cell {
	font-weight: 400;
	color: #999;
}

.player-cell {
	font-weight: 400;
	display: flex;
	align-items: center;
	gap: 6px;
}

.stat-ps {
	color: #1976d2;
	font-weight: 400;
}

.stat-md {
	font-weight: 400;
}

.stat-pd {
	font-weight: 400;
}

/* Luck Code Styling */
.luck-cell {
	text-align: center;
	font-weight: 400;
	color: #F08C1A;
}

.luck-purple,
.luck-blue,
.luck-orange,
.luck-default {
	color: #F08C1A;
	text-align: center;
	font-weight: 400;
}

/* Center "Luck Number" and "Luck" column headers */
.ranking-table th:last-child {
	text-align: center;
}

/* ============================================
   LUCK OF THE DRAW SECTION
   ============================================ */

.luck-of-the-draw-section {
	padding: 20px;
}

.luck-draw-section {
	margin-bottom: 32px;
}

.luck-draw-section:last-child {
	margin-bottom: 0;
}

.luck-draw-title {
	font-size: 1.1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 16px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.luck-draw-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

.luck-draw-card {
	background: #fff;
	border: 2px solid #e5e5e5;
	border-radius: 8px;
	padding: 20px;
	text-align: center;
	transition: all 0.2s ease;
}

.luck-draw-card:hover {
	border-color: #3FAE7C;
	box-shadow: 0 4px 12px rgba(63, 174, 124, 0.15);
	transform: translateY(-2px);
}

.luck-draw-label {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #999;
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.luck-draw-names {
	font-size: 1.3rem;
	font-weight: 700;
	color: #1a1a1a;
	margin-bottom: 12px;
	min-height: 1.5em;
}

.luck-draw-stats {
	display: flex;
	justify-content: center;
	gap: 16px;
	flex-wrap: wrap;
}

.luck-draw-stats .stat-item {
	font-size: 0.85rem;
	color: #666;
	font-weight: 500;
}

/* Empty Message */
.empty-message {
	text-align: center;
	padding: 2rem;
	color: #999;
}

.empty-message p {
	margin: 0;
	font-size: 0.95rem;
}

/* Auto-refresh Indicator */
.auto-refresh-indicator {
	position: fixed;
	bottom: 20px;
	right: 20px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid #e5e5e5;
	border-radius: 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	font-size: 0.8rem;
	color: #666;
	z-index: 100;
}

.refresh-icon {
	animation: rotate 2s linear infinite;
}

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

.refresh-text {
	font-weight: 500;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 600px) {
	.tournament-detail-header {
		padding: 16px;
	}
	
	.tournament-detail-name {
		font-size: 1.15rem;
	}
	
	.matches-section,
	.rankings-section {
		padding: 16px;
	}
	
	.courts-grid {
		grid-template-columns: 1fr;
	}
	
	.luck-draw-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}
	
	.luck-draw-card {
		padding: 16px;
	}
	
	.luck-draw-names {
		font-size: 1.1rem;
	}
	
	.player-avatar {
		width: 38px;
		height: 38px;
	}
	
	.player-name {
		font-size: 0.8rem;
	}
	
	.ranking-table {
		font-size: 0.85rem;
	}
	
	.ranking-table th,
	.ranking-table td {
		padding: 8px 6px;
	}
	
	.auto-refresh-indicator {
		bottom: 10px;
		right: 10px;
		font-size: 0.75rem;
		padding: 8px 12px;
	}
}

@media (min-width: 900px) {
	.tournament-detail-name {
		font-size: 1.6rem;
	}
	
	/* Constrain tournament sections to reasonable width on desktop */
	.tournament-detail-header,
	.matches-section,
	.rankings-section,
	.luck-of-the-draw-section {
		max-width: 900px;
		margin-left: auto;
		margin-right: auto;
	}
}
