/**
 * Sports Tracker - Front-End Stylesheet
 * Framework-agnostic styles for embedding standings, schedules, and ticker
 *
 * All classes prefixed with 'st-' to avoid conflicts
 * Users can override any of these styles in their own CSS
 */

/* ============================================================================
   CSS VARIABLES - Easily customizable
   ============================================================================ */
:root {
	--st-primary-color: #2563eb;
	--st-secondary-color: #64748b;
	--st-success-color: #16a34a;
	--st-danger-color: #dc2626;
	--st-warning-color: #f59e0b;
	--st-border-color: #e2e8f0;
	--st-bg-color: #ffffff;
	--st-bg-alt-color: #f8fafc;
	--st-text-color: #1e293b;
	--st-text-muted: #64748b;
	--st-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--st-font-size-base: 14px;
	--st-font-size-sm: 12px;
	--st-font-size-lg: 16px;
	--st-border-radius: 6px;
	--st-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================================================
   BASE CONTAINER
   ============================================================================ */
.st-container {
	font-family: var(--st-font-family);
	font-size: var(--st-font-size-base);
	color: var(--st-text-color);
	line-height: 1.5;
	box-sizing: border-box;
	margin-top: 0.75rem;
	margin-bottom: 1.5rem;
}

.st-container *,
.st-container *::before,
.st-container *::after {
	box-sizing: inherit;
}

/* ============================================================================
   STANDINGS TABLE
   ============================================================================ */
.st-standings {
	margin-bottom: 2rem;
	border: 1px solid var(--st-border-color);
	border-radius: var(--st-border-radius);
	overflow: hidden;
}

.st-standings-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	background: var(--st-primary-color);
	color: #fff;
	border-radius: var(--st-border-radius) var(--st-border-radius) 0 0;
	font-weight: 600;
}

.st-standings-header img {
	width: 24px;
	height: 24px;
}

.st-standings-group {
	margin-bottom: 1.5rem;
}

.st-standings-group-title {
	background: #475569;
	padding: 0.6rem 1rem;
	font-weight: 600;
	font-size: var(--st-font-size-sm);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #fff;
	border-bottom: 1px solid #334155;
}

.st-standings-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--st-bg-color);
	table-layout: fixed;
}

/* Fixed column widths so all division tables align identically */
.st-standings-table th:first-child,
.st-standings-table td:first-child {
	width: 36px;
}
.st-standings-table th:nth-child(n+3),
.st-standings-table td:nth-child(n+3) {
	width: 72px;
}

.st-standings-table th,
.st-standings-table td {
	padding: 0.6rem 0.75rem;
	text-align: left;
	border-bottom: 1px solid var(--st-border-color);
}

.st-standings-table th {
	font-weight: 600;
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
	background: var(--st-bg-alt-color);
	text-transform: uppercase;
	letter-spacing: 0.025em;
}

.st-standings-table tbody tr:hover {
	background: var(--st-bg-alt-color);
}

.st-standings-table tbody tr.st-tracked {
	background: rgba(37, 99, 235, 0.08);
}

.st-standings-table tbody tr.st-tracked:hover {
	background: rgba(37, 99, 235, 0.12);
}

.st-team-cell {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.st-team-logo {
	width: 24px;
	height: 24px;
	object-fit: contain;
	flex-shrink: 0;
}

.st-team-name {
	font-weight: 500;
}

.st-text-center {
	text-align: center !important;
}

.st-text-right {
	text-align: right !important;
}

.st-text-muted {
	color: var(--st-text-muted);
}

.st-streak-win {
	color: var(--st-success-color);
	font-weight: 500;
}

.st-streak-loss {
	color: var(--st-danger-color);
	font-weight: 500;
}

/* ============================================================================
   SCHEDULE
   ============================================================================ */
.st-schedule {
	margin-bottom: 2rem;
	border: 1px solid var(--st-border-color);
	border-radius: var(--st-border-radius);
	overflow: hidden;
}

.st-schedule-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: var(--st-primary-color);
	color: #fff;
	border-radius: var(--st-border-radius) var(--st-border-radius) 0 0;
}

.st-schedule-title {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-weight: 600;
}

.st-schedule-title img {
	width: 28px;
	height: 28px;
}

.st-schedule-list {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--st-bg-color);
	border: 1px solid var(--st-border-color);
	border-top: none;
	border-radius: 0 0 var(--st-border-radius) var(--st-border-radius);
}

.st-game {
	display: flex;
	align-items: center;
	padding: 0.875rem 1rem;
	border-bottom: 1px solid var(--st-border-color);
	gap: 1rem;
}

.st-game:last-child {
	border-bottom: none;
}

.st-game:hover {
	background: var(--st-bg-alt-color);
}

.st-game-date {
	flex: 0 0 auto;
	min-width: 100px;
	text-align: center;
}

.st-game-date-day {
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
	text-transform: uppercase;
}

.st-game-date-num {
	font-weight: 600;
	font-size: var(--st-font-size-lg);
}

.st-game-date-time {
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
}

.st-game-matchup {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.st-game-opponent {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.st-game-opponent img {
	width: 32px;
	height: 32px;
	object-fit: contain;
}

.st-game-opponent-name {
	font-weight: 500;
}

.st-game-location {
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
}

.st-game-at {
	color: var(--st-text-muted);
	font-size: var(--st-font-size-sm);
}

.st-game-result {
	flex: 0 0 auto;
	text-align: right;
	min-width: 80px;
}

.st-game-score {
	font-weight: 600;
	font-size: var(--st-font-size-lg);
}

.st-game-score.st-win {
	color: var(--st-success-color);
}

.st-game-score.st-loss {
	color: var(--st-danger-color);
}

.st-game-status {
	display: inline-block;
	padding: 0.25rem 0.5rem;
	font-size: var(--st-font-size-sm);
	font-weight: 500;
	border-radius: 3px;
}

.st-game-status.st-scheduled {
	background: #dbeafe;
	color: #1e40af;
}

.st-game-status.st-live {
	background: var(--st-danger-color);
	color: #fff;
	animation: st-pulse 1.5s infinite;
}

.st-game-status.st-final {
	background: #dcfce7;
	color: #166534;
}

.st-game-status.st-postponed {
	background: #fef3c7;
	color: #92400e;
}

.st-game-status.st-canceled {
	background: #fee2e2;
	color: #991b1b;
}

@keyframes st-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

.st-game-broadcast {
	flex: 1 1 0;
	text-align: right;
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
	min-width: 0;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.st-game-venue {
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
}

/* ============================================================================
   LIVE TICKER
   ============================================================================ */
.st-ticker-wrapper {
	overflow: hidden;
	background: var(--st-bg-color);
	border: 1px solid var(--st-border-color);
	border-radius: var(--st-border-radius);
}

.st-ticker {
	display: flex;
	gap: 1rem;
	padding: 0.5rem;
	overflow-x: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}

.st-ticker::-webkit-scrollbar {
	height: 4px;
}

.st-ticker::-webkit-scrollbar-track {
	background: var(--st-bg-alt-color);
}

.st-ticker::-webkit-scrollbar-thumb {
	background: var(--st-border-color);
	border-radius: 2px;
}

.st-ticker-game {
	flex: 0 0 auto;
	min-width: 180px;
	padding: 0.625rem 0.75rem;
	background: var(--st-bg-alt-color);
	border-radius: var(--st-border-radius);
	border: 1px solid var(--st-border-color);
}

.st-ticker-game.st-tracked {
	border-color: var(--st-primary-color);
	background: rgba(37, 99, 235, 0.05);
}

.st-ticker-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
	font-size: var(--st-font-size-sm);
}

.st-ticker-sport {
	color: var(--st-text-muted);
	text-transform: uppercase;
	font-weight: 500;
	letter-spacing: 0.025em;
}

.st-ticker-status {
	font-weight: 600;
	font-size: 10px;
	padding: 0.125rem 0.375rem;
	border-radius: 2px;
}

.st-ticker-status.st-live {
	background: var(--st-danger-color);
	color: #fff;
}

.st-ticker-status.st-final {
	background: var(--st-secondary-color);
	color: #fff;
}

.st-ticker-team {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.25rem 0;
}

.st-ticker-team-info {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.st-ticker-team img {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.st-ticker-team-abbrev {
	font-weight: 500;
	font-size: var(--st-font-size-sm);
}

.st-ticker-team-score {
	font-weight: 700;
	font-size: var(--st-font-size-base);
}

.st-ticker-team.st-winning .st-ticker-team-score {
	color: var(--st-text-color);
}

.st-ticker-team.st-losing .st-ticker-team-score {
	color: var(--st-text-muted);
}

.st-ticker-period {
	text-align: center;
	font-size: 10px;
	color: var(--st-text-muted);
	margin-top: 0.25rem;
}

/* ============================================================================
   SCROLLING TICKER (Auto-scroll variant)
   ============================================================================ */
.st-ticker-scroll {
	display: flex;
	animation: st-scroll 30s linear infinite;
	width: max-content;
}

.st-ticker-scroll:hover {
	animation-play-state: paused;
}

@keyframes st-scroll {
	0% { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */
.st-empty {
	padding: 2rem;
	text-align: center;
	color: var(--st-text-muted);
	background: var(--st-bg-alt-color);
	border-radius: var(--st-border-radius);
}

.st-empty-icon {
	font-size: 2rem;
	margin-bottom: 0.5rem;
	opacity: 0.5;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */
.st-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	color: var(--st-text-muted);
}

.st-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid var(--st-border-color);
	border-top-color: var(--st-primary-color);
	border-radius: 50%;
	animation: st-spin 0.8s linear infinite;
	margin-right: 0.75rem;
}

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

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
	.st-standings-table th:nth-child(n+5),
	.st-standings-table td:nth-child(n+5) {
		display: none;
	}

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

	.st-game-date {
		min-width: 70px;
	}

	.st-game-broadcast {
		display: none;
	}

	.st-ticker-game {
		min-width: 160px;
	}
}

@media (max-width: 480px) {
	.st-standings-table th:nth-child(n+4),
	.st-standings-table td:nth-child(n+4) {
		display: none;
	}

	.st-team-logo {
		display: none;
	}

	.st-game-matchup {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.25rem;
	}

	.st-game-at {
		display: none;
	}
}

/* ============================================================================
   SPORTS PAGE - Tabbed Layout
   ============================================================================ */

.st-page {
	box-sizing: border-box;
	font-family: var(--st-font-family);
}

.st-page *,
.st-page *::before,
.st-page *::after {
	box-sizing: border-box;
}

.st-page-ticker {
	margin-bottom: 1.5rem;
}

/* Tab Navigation */
.st-tab-nav {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--st-border-color);
	margin-bottom: 1.5rem;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.st-tab-nav::-webkit-scrollbar {
	display: none;
}

.st-tab-nav {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.st-tab-btn {
	padding: 12px 24px;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	cursor: pointer;
	font-family: var(--st-font-family);
	font-size: var(--st-font-size-base);
	font-weight: 600;
	color: var(--st-text-muted);
	white-space: nowrap;
	transition: color 0.2s, border-color 0.2s;
}

.st-tab-btn:hover {
	color: var(--st-text-color);
}

.st-tab-btn.st-tab-active {
	color: var(--st-primary-color);
	border-bottom-color: var(--st-primary-color);
}

.st-tab-btn i {
	margin-right: 6px;
}

/* Tab Panels */
.st-tab-panel {
	display: none;
}

.st-tab-panel.st-tab-panel-active {
	display: block;
}

/* Season Info Subtitle */
.st-season-info {
	font-family: var(--st-font-family);
	font-size: var(--st-font-size-sm);
	color: var(--st-text-muted);
	margin-bottom: 1rem;
	padding: 0.5rem 0.75rem;
	background: var(--st-bg-alt-color);
	border: 1px solid var(--st-border-color);
	border-radius: var(--st-border-radius);
	display: inline-block;
}

.st-season-year {
	font-weight: 600;
	color: var(--st-text-color);
}

.st-season-divider {
	margin: 0 0.25rem;
	color: var(--st-border-color);
}

.st-season-type {
	font-weight: 500;
	color: var(--st-primary-color);
}

/* Stacked layout for tab content */
.st-tab-content {
	display: block;
}

/* Recent Results (full width below the grid) */
.st-tab-recent {
	margin-top: 0.5rem;
}

/* Off-Season Notice */
.st-offseason {
	text-align: center;
	padding: 3rem 2rem;
	background: var(--st-bg-alt-color);
	border-radius: var(--st-border-radius);
	border: 1px solid var(--st-border-color);
	margin-top: 0.5rem;
}

.st-offseason-icon {
	font-size: 3rem;
	color: var(--st-text-muted);
	margin-bottom: 1rem;
	opacity: 0.6;
}

.st-offseason-title {
	margin: 0 0 0.5rem;
	font-family: var(--st-font-family);
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--st-text-color);
}

.st-offseason-text {
	color: var(--st-text-muted);
	font-size: var(--st-font-size-base);
	margin: 0 0 1.5rem;
	line-height: 1.6;
}

.st-offseason-standings {
	text-align: left;
	margin-top: 1.5rem;
}

.st-offseason-standings summary {
	cursor: pointer;
	font-weight: 600;
	font-size: var(--st-font-size-base);
	color: var(--st-primary-color);
	padding: 0.5rem 0;
}

.st-offseason-standings summary:hover {
	text-decoration: underline;
}

/* Mobile: tab scroll hint */
@media (max-width: 768px) {
	.st-tab-btn {
		padding: 10px 16px;
		font-size: var(--st-font-size-sm);
	}
}
