/* ========================================
   RESET & BASE
   ======================================== */
* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	font-family: Arial, sans-serif;
	padding-top: 56px; /* Spazio per header fisso */
}

/* ========================================
   FIXED HEADER
   ======================================== */
#fixed-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	background: linear-gradient(135deg, #1a5f2a 0%, #2d8a3e 100%);
	color: white;
	padding: 12px 20px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.3);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

#fixed-header .match-title {
	font-size: 1.2rem;
	font-weight: bold;
	margin: 0;
	text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

#fixed-header .logo-small {
	height: 28px;
	filter: brightness(0) invert(1);
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
#stats-container {
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 15px;
}

/* ========================================
   ROW LAYOUTS
   ======================================== */

.stats-row-full {
	width: 100%;
	margin-bottom: 20px;
}

.stats-row {
	display: flex;
	flex-wrap: wrap;
	width: 100%;
	margin-bottom: 20px;
	gap: 10px;
}

.stats-col {
	flex: 1 1 calc(50% - 5px);
	min-width: 0;
	display: flex;
	justify-content: center;
}

/* ========================================
   MAIN CHART - HORIZONTAL SCROLL (solo questo)
   ======================================== */
.chart-scroll-container {
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	background: #fafafa;
	border: 1px solid #ddd;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-scroll-container::-webkit-scrollbar {
	height: 14px;
}

.chart-scroll-container::-webkit-scrollbar-track {
	background: #e0e0e0;
	border-radius: 7px;
}

.chart-scroll-container::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, #888 0%, #666 100%);
	border-radius: 7px;
	border: 2px solid #e0e0e0;
}

.chart-scroll-container::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, #666 0%, #444 100%);
}

#r1c1 {
	min-width: 1000px;
	width: 100%;
	height: 600px;
	padding: 10px;
}

/* ========================================
   DATA TABLE - HORIZONTAL SCROLL
   ======================================== */
.table-scroll-container {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding: 10px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-scroll-container::-webkit-scrollbar {
	height: 12px;
}

.table-scroll-container::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 6px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
	background: #aaa;
	border-radius: 6px;
}

#r1c2 {
	min-width: 800px;
}

/* ========================================
   GAUGE & CHARTS GROUP
   ======================================== */
.gauge-label {
	font: bold 12px Arial, sans-serif;
	display: block;
	margin-bottom: 8px;
	color: #333;
}

.gauge-group {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: 15px;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
	text-align: center;
	padding: 25px 0;
	margin-top: 30px;
	border-top: 2px solid #eee;
}

/* ========================================
   POPUP VIDEO - IMPROVED
   ======================================== */
#overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	z-index: 999;
	backdrop-filter: blur(4px);
}

#popup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1000;
	width: 90%;
	max-width: 900px;
	background-color: #1a1a1a;
	border-radius: 12px;
	box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
	overflow: hidden;
}

#popup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 18px;
	background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
	border-bottom: 1px solid #444;
}

#popup-header .popup-title {
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	margin: 0;
}

#popup-header .popup-time {
	color: #4CAF50;
	font-size: 13px;
	font-weight: bold;
}

#close-btn {
	background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
	color: white;
	border: none;
	padding: 10px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	font-weight: bold;
	transition: all 0.2s;
	box-shadow: 0 2px 8px rgba(229,57,53,0.4);
}

#close-btn:hover {
	background: linear-gradient(135deg, #ef5350 0%, #e53935 100%);
	transform: translateY(-1px);
}

#popup .video-container {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 */
	background: #000;
}

#popup iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

/* ========================================
   GOOGLE VISUALIZATION TABLE OVERRIDES
   ======================================== */
.google-visualization-table-table {
	width: 100% !important;
}

.google-visualization-table-table th:nth-child(1),
.google-visualization-table-table td:nth-child(1) { width: 40px !important; }

.google-visualization-table-table th:nth-child(2),
.google-visualization-table-table td:nth-child(2) { width: 50px !important; }

.google-visualization-table-table th:nth-child(3),
.google-visualization-table-table td:nth-child(3) { width: 80px !important; text-align: left !important; white-space: nowrap; }

.google-visualization-table-table th:nth-child(4),
.google-visualization-table-table td:nth-child(4) { width: 120px !important; text-align: left !important; white-space: nowrap; }

.google-visualization-table-table th:nth-child(5),
.google-visualization-table-table td:nth-child(5) { width: 60px !important; }

.google-visualization-table-table th:nth-child(6),
.google-visualization-table-table td:nth-child(6) { width: 120px !important; text-align: left !important; white-space: nowrap; }

.google-visualization-table-table th:nth-child(7),
.google-visualization-table-table td:nth-child(7) { width: 100px !important; text-align: left !important; white-space: nowrap; }

.google-visualization-table-table th:nth-child(8),
.google-visualization-table-table td:nth-child(8) { min-width: 200px !important; text-align: left !important; }

/* ========================================
   MEDIA QUERIES - TABLET
   ======================================== */
@media screen and (max-width: 1024px) {
	body {
		padding-top: 52px;
	}
	
	#fixed-header {
		padding: 10px 15px;
	}
	
	#fixed-header .match-title {
		font-size: 1rem;
	}
	
	#stats-container {
		padding: 10px;
	}
	
	.stats-col {
		flex: 1 1 100%;
	}
	
	.gauge-group {
		justify-content: center;
	}
	
	.gauge-label {
		text-align: center;
	}
	
	#r1c1 {
		min-width: 900px;
		height: 550px;
	}
}

/* ========================================
   MEDIA QUERIES - MOBILE
   ======================================== */
@media screen and (max-width: 768px) {
	body {
		padding-top: 48px;
	}
	
	#fixed-header {
		padding: 8px 12px;
	}
	
	#fixed-header .match-title {
		font-size: 0.9rem;
	}
	
	#stats-container {
		padding: 8px;
	}
	
	.stats-row {
		gap: 25px;
	}
	
	.stats-col {
		flex: 1 1 100%;
		min-width: 100%;
	}
	
	#r1c1 {
		min-width: 800px;
		height: 450px;
	}
	
	#popup {
		width: 96%;
		border-radius: 10px;
	}
	
	#popup-header {
		padding: 10px 14px;
	}
	
	#close-btn {
		padding: 8px 14px;
		font-size: 12px;
	}
	
	.gauge-group {
		flex-direction: column;
		align-items: center;
	}
}

/* ========================================
   MEDIA QUERIES - SMALL MOBILE
   ======================================== */
@media screen and (max-width: 480px) {
	body {
		padding-top: 44px;
	}
	
	#fixed-header {
		padding: 6px 10px;
	}
	
	#fixed-header .match-title {
		font-size: 0.8rem;
	}
	
	#fixed-header .logo-small {
		height: 20px;
	}
	
	#r1c1 {
		min-width: 700px;
		height: 400px;
	}
	
	.footer img {
		height: 22px;
	}
}
