/******************************************************************************
 * Базовый сброс и CSS-переменные (темизация)
 * Прототип MYTENNIS.ONLINE
 ******************************************************************************/

/* -----------------------------------------------
 * CSS Custom Properties — темизация
 * Изменяйте значения в :root для смены цветовой схемы
 * ----------------------------------------------- */
:root {
	/* Основные цвета */
	--color-primary: #1a73e8;
	--color-primary-hover: #1557b0;
	--color-bg: #ffffff;
	--color-bg-secondary: #f5f5f5;
	--color-bg-tertiary: #e8e8e8;
	--color-bg-hover: #eeeeee;
	--color-text: #333333;
	--color-text-secondary: #666666;
	--color-text-muted: #999999;
	--color-border: #e0e0e0;
	--color-border-light: #f0f0f0;

	/* Семантические цвета */
	--color-success: #34a853;
	--color-warning: #fbbc04;
	--color-danger: #ea4335;
	--color-info: #4285f4;

	/* Дополнительные цвета (для селектора игрока в шапке) */
	--color-surface: #ffffff;
	--color-primary-light: #f0f4ff;
	--color-sidebar-active: #f0f4ff;

	/* Скругления */
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 12px;
	--radius-full: 50%;
	--radius-round: 50%;

	/* Тени */
	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
	--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
	--shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
	--shadow-card: 0 0 13px 0 rgba(82, 63, 105, 0.1);

	/* Отступы */
	--spacing-xs: 4px;
	--spacing-sm: 8px;
	--spacing-md: 16px;
	--spacing-lg: 24px;
	--spacing-xl: 32px;

	/* Типографика */
	--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--font-size-xs: 11px;
	--font-size-sm: 13px;
	--font-size-md: 15px;
	--font-size-lg: 18px;
	--font-size-xl: 24px;
	--font-size-xxl: 32px;

	/* Layout */
	--sidebar-width: 240px;
	--header-height: 56px;
	--content-max-width: 1200px;
}

/* -----------------------------------------------
 * CSS Reset
 * ----------------------------------------------- */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	overflow: hidden;
}

body {
	font-family: var(--font-family);
	font-size: var(--font-size-md);
	color: var(--color-text);
	background: var(--color-bg);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a {
	color: var(--color-primary);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--color-primary-hover);
	text-decoration: underline;
}

img {
	max-width: 100%;
	height: auto;
}

ul, ol {
	list-style: none;
}

table {
	border-collapse: collapse;
	width: 100%;
}

input, textarea, select, button {
	font-family: inherit;
	font-size: inherit;
}

/* -----------------------------------------------
 * Типографика
 * ----------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
	font-weight: 600;
	line-height: 1.3;
	color: var(--color-text);
}

h1 { font-size: var(--font-size-xxl); margin-bottom: var(--spacing-md); }
h2 { font-size: var(--font-size-xl); margin-bottom: var(--spacing-md); }
h3 { font-size: var(--font-size-lg); margin-bottom: var(--spacing-sm); }
h4 { font-size: var(--font-size-md); margin-bottom: var(--spacing-sm); }

p {
	margin-bottom: var(--spacing-sm);
}

small {
	font-size: var(--font-size-sm);
	color: var(--color-text-secondary);
}

/* -----------------------------------------------
 * Утилиты
 * ----------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }

.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.ml-auto { margin-left: auto; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-xs { gap: 4px; }

.flex-wrap { flex-wrap: wrap; }

.w-full { width: 100%; }

.hidden { display: none !important; }

/* -----------------------------------------------
 * Скелетон-загрузка
 * ----------------------------------------------- */
.skeleton {
	background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-bg-tertiary) 50%, var(--color-bg-secondary) 75%);
	background-size: 200% 100%;
	animation: skeleton-pulse 1.5s ease-in-out infinite;
	border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.skeleton-line {
	height: 12px;
	margin-bottom: var(--spacing-sm);
	width: 100%;
}

.skeleton-line:nth-child(2) { width: 80%; }
.skeleton-line:nth-child(3) { width: 60%; }

.skeleton-avatar {
	width: 40px;
	height: 40px;
	border-radius: var(--radius-full);
}

.skeleton-card {
	height: 120px;
	margin-bottom: var(--spacing-md);
}

/* -----------------------------------------------
 * Spinner
 * ----------------------------------------------- */
.spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--color-border);
	border-top-color: var(--color-primary);
	border-radius: var(--radius-full);
	animation: spin 0.8s linear infinite;
}

.spinner-sm {
	width: 16px;
	height: 16px;
	border-width: 2px;
}

.spinner-lg {
	width: 48px;
	height: 48px;
	border-width: 4px;
}

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

.spinner-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.7);
	z-index: 9999;
}

/* -----------------------------------------------
 * Состояния страниц
 * ----------------------------------------------- */
.state-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--spacing-xl);
	color: var(--color-text-muted);
	gap: var(--spacing-md);
}

.state-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--spacing-xl);
	color: var(--color-danger);
	gap: var(--spacing-md);
	text-align: center;
}

.state-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--spacing-xl);
	color: var(--color-text-muted);
	gap: var(--spacing-md);
	text-align: center;
}

.state-error-text {
	font-size: var(--font-size-lg);
}

/* -----------------------------------------------
 * Offline banner
 * ----------------------------------------------- */
.offline-banner {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: var(--color-danger);
	color: #ffffff;
	text-align: center;
	padding: var(--spacing-sm) var(--spacing-md);
	font-size: var(--font-size-sm);
	z-index: 10000;
}

.offline-banner-text {
	font-weight: 500;
}

/* -----------------------------------------------
 * Badge
 * ----------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 2px 8px;
	font-size: var(--font-size-xs);
	font-weight: 600;
	border-radius: 10px;
	line-height: 1.4;
}

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

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

.badge-success {
	background: var(--color-success);
	color: #ffffff;
}

.badge-warning {
	background: var(--color-warning);
	color: #333333;
}

/* -----------------------------------------------
 * Avatar
 * ----------------------------------------------- */
.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-full);
	background: var(--color-bg-secondary);
	color: var(--color-text-secondary);
	font-weight: 600;
	font-size: var(--font-size-md);
	overflow: hidden;
	flex-shrink: 0;
}

.avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-sm); }
.avatar-md { width: 48px; height: 48px; font-size: var(--font-size-lg); }
.avatar-lg { width: 64px; height: 64px; font-size: var(--font-size-xl); }

/* -----------------------------------------------
 * Badge outline
 * ----------------------------------------------- */
.badge-outline {
	border: 1px solid var(--color-border);
	color: var(--color-text-secondary);
	background: transparent;
}

/* -----------------------------------------------
 * Form layout helpers
 * ----------------------------------------------- */
.form-section-title {
	font-size: var(--font-size-md);
	font-weight: 600;
	color: var(--color-text);
	margin: 20px 0 10px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--color-border);
}

.form-section-title:first-child {
	margin-top: 0;
}

.form-row {
	display: flex;
	gap: 12px;
	margin-bottom: 4px;
}

.form-row .form-group {
	flex: 1;
	min-width: 0;
}

/* -----------------------------------------------
 * Autocomplete list
 * ----------------------------------------------- */
.autocomplete-list {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--border-radius);
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	max-height: 300px;
	overflow-y: auto;
	z-index: 1000;
}

.autocomplete-item {
	padding: 8px 12px;
	cursor: pointer;
	border-bottom: 1px solid var(--color-border-light);
}

.autocomplete-item:last-child {
	border-bottom: none;
}

.autocomplete-item:hover {
	background: var(--color-bg-hover);
}
