/* Modern CSS Variables for Color Scheme */
:root {
	--primary-color: #2563eb;
	--primary-hover: #1d4ed8;
	--success-color: #10b981;
	--error-color: #ef4444;
	--bg-color: #ffffff;
	--surface-color: #f9fafb;
	--border-color: #e5e7eb;
	--text-primary: #111827;
	--text-secondary: #6b7280;
	--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 12px;
}

/* Reset and Base Styles */
[hidden] {
	display: none;
}

* {
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-primary);
	background-color: var(--surface-color);
	margin: 0;
	padding: 20px;
}

h4 {
	color: var(--text-primary);
	font-size: 24px;
	font-weight: 600;
	margin: 0 0 24px 0;
	letter-spacing: -0.025em;
	text-align: center;
}

/* Wrapper Container */
#wrapper {
	max-width: 1400px;
	width: 100%;
	margin: 0 auto;
	background-color: var(--bg-color);
	padding: 32px;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}

/* Checkbox and Label Styles */
p {
	margin: 12px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: var(--primary-color);
}

label {
	font-size: 14px;
	color: var(--text-secondary);
	cursor: pointer;
	user-select: none;
	transition: color 0.2s ease;
}

label:hover {
	color: var(--text-primary);
}

/* Button Styles */
#starttestbutton {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
	border: none;
	color: white;
	padding: 14px 32px;
	font-size: 16px;
	font-weight: 500;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-md);
	margin: 20px 0;
	display: inline-block;
	text-align: center;
}

#starttestbutton:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

#starttestbutton:active:not(:disabled) {
	transform: translateY(0);
}

#starttestbutton:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Table Styles */
#datatable {
	border-collapse: separate;
	border-spacing: 0;
	width: 100%;
	margin: 24px 0;
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	border: 1px solid var(--border-color);
}

#datatable th {
	background: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 100%);
	color: var(--text-primary);
	font-weight: 600;
	font-size: 14px;
	text-align: left;
	padding: 14px 16px;
	border-bottom: 2px solid var(--border-color);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 12px;
}

#datatable th:first-child {
	text-align: center;
	width: 5%;
}

#datatable th:nth-child(3) {
	text-align: center;
}

#datatable th:last-child {
	text-align: center;
}

td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border-color);
	background-color: var(--bg-color);
	transition: background-color 0.2s ease;
	font-size: 14px;
}

#datatable tr:hover td {
	background-color: var(--surface-color);
}

#datatable tr:last-child td {
	border-bottom: none;
}

/* First column (number) */
#datatable td:first-child {
	text-align: center;
	font-weight: 500;
	color: var(--text-secondary);
}

/* Last column (status) */
#datatable td[data-status] {
	text-align: center;
	font-size: 13px;
	color: var(--text-secondary);
	min-width: 120px;
}

/* Second column (test name) */
#datatable td:nth-child(2) {
	font-family: 'Segoe UI', system-ui, sans-serif;
	color: var(--text-primary);
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Progress Bar Container */
#datatable [data-progress-url],
#datatable [data-progress-file] {
	margin: 0;
	padding: 0;
	height: 24px;
	background-color: var(--surface-color);
	border-radius: var(--radius-sm);
	overflow: hidden;
	position: relative;
}

/* Progress Bar Fill */
#datatable [data-progress] {
	margin: 0;
	padding: 0;
	background: linear-gradient(90deg, var(--success-color) 0%, #059669 100%);
	height: 100%;
	width: 0;
	transition: width 0.3s ease, background-color 0.3s ease;
	border-radius: var(--radius-sm);
	position: relative;
	overflow: hidden;
}

/* Progress bar animation removed - was distracting */

/* Result Display */
#result {
	margin: 20px 0;
	padding: 16px;
	background-color: var(--surface-color);
	border-radius: var(--radius-md);
	border-left: 4px solid var(--primary-color);
	font-family: 'Courier New', monospace;
	font-size: 13px;
	line-height: 1.5;
	min-height: 40px;
	box-shadow: var(--shadow-sm);
}

#result:empty {
	display: none;
}

#result pre {
	margin: 0;
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* Timer Display */
#timer {
	font-weight: 600;
	color: var(--primary-color);
	font-size: 16px;
	font-variant-numeric: tabular-nums;
}

/* Textarea Styles */
textarea {
	width: 100%;
	min-height: 200px;
	padding: 16px;
	margin: 16px 0;
	font-family: 'Courier New', Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	background-color: var(--surface-color);
	resize: vertical;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Links */
a {
	color: var(--primary-color);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

/* WebRTC Info */
#wrapper > p:first-of-type {
	font-size: 13px;
	color: var(--text-secondary);
	margin: 16px 0;
	padding: 12px;
	background-color: var(--surface-color);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border-color);
}

span[id$="IPs"],
span[id$="addr"] {
	font-weight: 500;
	color: var(--primary-color);
	font-family: 'Courier New', monospace;
	font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
	body {
		padding: 12px;
	}

	#wrapper {
		padding: 20px;
		border-radius: var(--radius-md);
	}

	h4 {
		font-size: 20px;
		margin-bottom: 16px;
	}

	#starttestbutton {
		width: 100%;
		padding: 16px;
	}

	#datatable th,
	td {
		padding: 10px 8px;
		font-size: 13px;
	}

	#datatable th:nth-child(2) {
		min-width: 150px;
	}

	textarea {
		font-size: 11px;
		min-height: 150px;
	}

	/* Make table scrollable on mobile */
	#datatable {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}
}

@media (max-width: 480px) {
	textarea {
		min-height: 120px;
	}

	#datatable th {
		font-size: 11px;
		padding: 8px 6px;
	}

	td {
		font-size: 12px;
		padding: 8px 6px;
	}
}

/* Vendor Table (if used) */
#vendortable {
	width: 100%;
	position: relative;
	margin: 16px 0;
}

/* Print Styles */
@media print {
	body {
		background-color: white;
	}

	#wrapper {
		box-shadow: none;
		padding: 0;
	}

	#starttestbutton,
	textarea,
	a {
		display: none;
	}

	#datatable [data-progress]::after {
		animation: none;
	}
}
