:root {
	--primary: #1b5e20;
	--primary-hover: #144919;
	--primary-light: #e8f5e9;
	--accent-clay: #c85a17;
	--accent-court: #2e7d32;
	--tennis-ball: #ccff00;
	--tennis-ball-dark: #8c9900;
	--bg: #f4f6f8;
	--card-bg: #ffffff;
	--fg: #1c252e;
	--muted: #637381;
	--border: #dfe3e8;
	--border-light: #edf2f7;
	--danger: #d32f2f;
	--danger-light: #ffebee;
	--warning: #ed6c02;
	--warning-light: #fff3e0;
	--success: #2e7d32;
	--success-light: #e8f5e9;
	--radius: 8px;
	--radius-lg: 12px;
	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.5;
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
}

.app-wrapper {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* Header */
.sta-header {
	background: #134217;
	color: #ffffff;
	border-bottom: 3px solid #ccff00;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sta-header-inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 0.85rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.sta-brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.sta-logo-icon {
	width: 38px;
	height: 38px;
	background: #ccff00;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	box-shadow: inset 0 0 0 2px #9bb800, 0 2px 4px rgba(0,0,0,0.2);
}

.sta-brand-title {
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.sta-brand-sub {
	font-size: 0.8rem;
	color: #c8e6c9;
	font-weight: 400;
}

.sta-user-area {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.sta-user-badge {
	font-size: 0.8rem;
	padding: 0.25rem 0.6rem;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.role-pill {
	font-weight: 700;
	text-transform: uppercase;
	font-size: 0.7rem;
	padding: 0.15rem 0.45rem;
	border-radius: 10px;
}

.role-pill.player {
	background: #e3f2fd;
	color: #0d47a1;
}

.role-pill.coach {
	background: #fff8e1;
	color: #e65100;
}

.role-pill.official {
	background: #f3e5f5;
	color: #4a148c;
}

/* Nav tabs */
.sta-nav-bar {
	background: #ffffff;
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 50;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sta-nav-inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 0.5rem;
	display: flex;
	gap: 0.25rem;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.sta-nav-inner::-webkit-scrollbar {
	display: none;
}

.sta-nav-btn {
	padding: 0.75rem 0.9rem;
	border: none;
	background: transparent;
	color: var(--muted);
	font-weight: 600;
	font-size: 0.88rem;
	cursor: pointer;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	border-bottom: 3px solid transparent;
	transition: all 0.15s ease;
}

.sta-nav-btn:hover {
	color: var(--primary);
	background: #f9fbf9;
}

.sta-nav-btn.active {
	color: var(--primary);
	border-bottom-color: var(--primary);
	background: var(--primary-light);
}

/* Main content */
.sta-main {
	max-width: 1080px;
	width: 100%;
	margin: 0 auto;
	padding: 1.25rem 1rem 3rem;
	flex: 1;
}

/* UI Cards */
.card {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.25rem;
	box-shadow: var(--shadow-sm);
	margin-bottom: 1.25rem;
}

.card-title {
	margin: 0 0 1rem;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--primary);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.card-title-actions {
	display: flex;
	gap: 0.5rem;
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.55rem 0.95rem;
	font-size: 0.88rem;
	font-weight: 600;
	border-radius: var(--radius);
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.15s ease;
}

.btn-primary {
	background: var(--primary);
	color: #ffffff;
}

.btn-primary:hover {
	background: var(--primary-hover);
}

.btn-secondary {
	background: #ffffff;
	border-color: var(--border);
	color: var(--fg);
}

.btn-secondary:hover {
	background: #f8fafc;
	border-color: #cbd5e1;
}

.btn-danger {
	background: var(--danger);
	color: #ffffff;
}

.btn-danger:hover {
	background: #b71c1c;
}

.btn-tennis {
	background: #ccff00;
	color: #134217;
	border: 1px solid #a3cc00;
	font-weight: 700;
}

.btn-tennis:hover {
	background: #bbee00;
}

.btn-sm {
	padding: 0.35rem 0.65rem;
	font-size: 0.8rem;
}

.btn-lg {
	padding: 0.75rem 1.25rem;
	font-size: 1rem;
}

/* Forms */
.form-group {
	margin-bottom: 1rem;
}

.form-label {
	display: block;
	font-size: 0.84rem;
	font-weight: 600;
	color: #374151;
	margin-bottom: 0.35rem;
}

.form-control {
	width: 100%;
	padding: 0.6rem 0.75rem;
	font-size: 0.92rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #ffffff;
	color: var(--fg);
	font-family: inherit;
}

.form-control:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15);
}

.form-hint {
	font-size: 0.78rem;
	color: var(--muted);
	margin-top: 0.25rem;
}

.form-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.75rem;
}

/* Alerts */
.alert {
	padding: 0.75rem 1rem;
	border-radius: var(--radius);
	font-size: 0.88rem;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.alert-error {
	background: var(--danger-light);
	color: var(--danger);
	border: 1px solid #ffcdd2;
}

.alert-success {
	background: var(--success-light);
	color: var(--success);
	border: 1px solid #c8e6c9;
}

.alert-info {
	background: #e1f5fe;
	color: #0277bd;
	border: 1px solid #b3e5fc;
}

/* Badges */
.badge {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 0.2rem 0.55rem;
	border-radius: 6px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.badge-live {
	background: #ffebee;
	color: #c62828;
	border: 1px solid #ef9a9a;
	animation: pulse-dot 1.5s infinite;
}

.badge-upcoming {
	background: #e3f2fd;
	color: #1565c0;
	border: 1px solid #90caf9;
}

.badge-completed {
	background: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #a5d6a7;
}

@keyframes pulse-dot {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.6; }
}

/* Tables */
.table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sta-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: 0.88rem;
}

.sta-table th {
	background: #f8fafc;
	padding: 0.65rem 0.75rem;
	font-weight: 700;
	color: #475569;
	border-bottom: 2px solid var(--border);
	white-space: nowrap;
}

.sta-table td {
	padding: 0.75rem;
	border-bottom: 1px solid var(--border-light);
	vertical-align: middle;
}

.sta-table tr:hover td {
	background: #fafcfb;
}

/* Grid layout for cards */
.grid-2 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
	gap: 1rem;
}

.grid-3 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
	gap: 1rem;
}

.grid-4 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
	gap: 0.75rem;
}

/* Stat card */
.stat-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1rem;
	display: flex;
	align-items: center;
	gap: 0.85rem;
	box-shadow: var(--shadow-sm);
}

.stat-icon {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	background: var(--primary-light);
	color: var(--primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	flex-shrink: 0;
}

.stat-value {
	font-size: 1.4rem;
	font-weight: 800;
	color: #111827;
	line-height: 1;
}

.stat-label {
	font-size: 0.8rem;
	color: var(--muted);
	margin-top: 0.2rem;
	font-weight: 600;
}

/* Scoreboard display */
.court-scoreboard {
	background: #0f3613;
	background: linear-gradient(145deg, #0d3110 0%, #174b1c 100%);
	color: #ffffff;
	border-radius: var(--radius-lg);
	padding: 1.25rem;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	border: 2px solid #2e7d32;
	margin-bottom: 1.25rem;
}

.court-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
	padding-bottom: 0.6rem;
	margin-bottom: 0.85rem;
	font-size: 0.85rem;
	color: #c8e6c9;
}

.score-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.65rem 0.5rem;
	border-radius: 6px;
	margin-bottom: 0.35rem;
	background: rgba(0, 0, 0, 0.2);
}

.score-row.serving {
	background: rgba(204, 255, 0, 0.12);
	border-left: 3px solid #ccff00;
}

.player-info-cell {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.05rem;
	font-weight: 700;
	flex: 1;
}

.server-ball {
	color: #ccff00;
	font-size: 0.9rem;
}

.score-digits {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.score-box {
	min-width: 38px;
	height: 38px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.15rem;
	font-weight: 800;
	color: #ffffff;
	font-family: monospace, monospace;
}

.score-box.points {
	background: #ccff00;
	color: #0f3613;
	font-size: 1.25rem;
}

.score-box.winner-box {
	background: #4caf50;
	color: #ffffff;
}

.score-legend {
	display: flex;
	justify-content: flex-end;
	gap: 0.6rem;
	font-size: 0.72rem;
	color: #a5d6a7;
	text-transform: uppercase;
	font-weight: 700;
	margin-bottom: 0.35rem;
	padding-right: 0.25rem;
}

/* Modal / Dialog */
.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 1000;
}

.modal-content {
	background: #ffffff;
	border-radius: var(--radius-lg);
	max-width: 520px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: var(--shadow-md);
	border: 1px solid var(--border);
}

.modal-header {
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.modal-header h3 {
	margin: 0;
	font-size: 1.1rem;
	color: var(--primary);
}

.modal-body {
	padding: 1.25rem;
}

.modal-footer {
	padding: 0.85rem 1.25rem;
	border-top: 1px solid var(--border);
	background: #f8fafc;
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
}

/* Login Card Specific */
.login-box {
	max-width: 400px;
	margin: 2.5rem auto;
}

.login-header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.login-header-logo {
	width: 54px;
	height: 54px;
	background: #ccff00;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.8rem;
	margin: 0 auto 0.75rem;
	box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.login-title {
	font-size: 1.35rem;
	font-weight: 800;
	color: #134217;
	margin: 0 0 0.25rem;
}

.login-sub {
	font-size: 0.85rem;
	color: var(--muted);
	margin: 0;
}

/* Quick test accounts helper banner */
.test-accounts-card {
	background: #f0f7f1;
	border: 1px dashed #a5d6a7;
	border-radius: var(--radius);
	padding: 0.85rem;
	margin-top: 1rem;
	font-size: 0.82rem;
}

.test-accounts-card h4 {
	margin: 0 0 0.4rem;
	color: #1b5e20;
	font-size: 0.85rem;
}

.test-account-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.3rem 0;
	border-bottom: 1px dotted #c8e6c9;
}

.test-account-row:last-child {
	border-bottom: none;
}

/* Mobile responsive fine-tuning */
@media (max-width: 600px) {
	.sta-header-inner {
		padding: 0.65rem 0.85rem;
	}

	.sta-brand-title {
		font-size: 1.05rem;
	}

	.sta-main {
		padding: 0.85rem 0.75rem 2rem;
	}

	.card {
		padding: 1rem;
	}

	.score-box {
		min-width: 32px;
		height: 32px;
		font-size: 1rem;
	}

	.score-box.points {
		font-size: 1.1rem;
	}

	.player-info-cell {
		font-size: 0.95rem;
	}
}
