/* ==========================================================================
   STRAVA VISUALIZER UI - MAIN STYLESHEET
   ========================================================================== */

/* ==========================================================================
   CSS VARIABLES & ROOT STYLES
   ========================================================================== */
:root {
	--strava-orange: #FC4C02;
	--strava-orange-hover: #e04302;
	--light-bg: #f8f9fa;
	--dark-text: #495057;
	--card-bg: #ffffff;
	--border-radius: 6px;
	--shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
	--shadow-hover: 0 6px 24px rgba(252, 76, 2, 0.12);
	--tab-active-bg: #fff3ef;
	--text-muted: #888;
	--text-secondary: #666;
	--border-color: #e9ecef;
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
body {
	background-color: var(--light-bg);
	margin: 0;
	padding: 16px;
	min-height: 100vh;
	font-family: 'Arial', sans-serif;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.strava-color {
	color: var(--strava-orange);
}

.mb-3 {
	margin-bottom: 2rem !important;
}

/* ==========================================================================
   LOADING INDICATOR
   ========================================================================== */
.loading-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	padding: 2rem;
	background: var(--card-bg);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	margin: 2rem auto;
	max-width: 500px;
}

.loading-spinner {
	position: relative;
	width: 80px;
	height: 80px;
	margin-bottom: 2rem;
}

.loading-spinner::before,
.loading-spinner::after {
	content: '';
	position: absolute;
	border-radius: 50%;
	animation: loading-pulse 2s ease-in-out infinite;
}

.loading-spinner::before {
	width: 100%;
	height: 100%;
	background: linear-gradient(45deg, var(--strava-orange), #ff6b35);
	animation-delay: 0s;
}

.loading-spinner::after {
	width: 60%;
	height: 60%;
	background: var(--card-bg);
	top: 20%;
	left: 20%;
	animation-delay: 0.5s;
}

.loading-text {
	font-size: 1.2rem;
	font-weight: 500;
	color: var(--dark-text);
	margin-bottom: 1rem;
	text-align: center;
}

.loading-subtitle {
	font-size: 0.9rem;
	color: var(--text-muted);
	text-align: center;
	margin: 0;
}

.loading-progress {
	width: 100%;
	max-width: 300px;
	height: 6px;
	background: var(--border-color);
	border-radius: 3px;
	overflow: hidden;
	margin-top: 1.5rem;
	position: relative;
}

.loading-progress-bar {
	height: 100%;
	background: linear-gradient(90deg, var(--strava-orange), #ff6b35);
	border-radius: 3px;
	animation: loading-progress 2s ease-in-out infinite;
	position: relative;
}

.loading-progress-bar::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
	animation: loading-shimmer 1.5s ease-in-out infinite;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes loading-pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.1);
		opacity: 0.8;
	}
}

@keyframes loading-progress {
	0% { width: 0%; }
	50% { width: 70%; }
	100% { width: 100%; }
}

@keyframes loading-shimmer {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

/* ==========================================================================
   DASHBOARD COMPONENTS
   ========================================================================== */
.dashboard-toolbar {
	margin-bottom: 1rem;
	background-color: var(--card-bg) !important;
	border: none !important;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
}

.dashboard-title {
	margin: 0;
	padding: 0.5em 0;
	display: flex;
	align-items: center;
	gap: 0.5em;
	font-weight: 600;
}

/* ==========================================================================
   CARD COMPONENTS
   ========================================================================== */
.p-card, .profile-card {
	border-radius: var(--border-radius) !important;
	box-shadow: var(--shadow) !important;
	background: var(--card-bg) !important;
}

.p-panel {
	border-radius: var(--border-radius) !important;
	box-shadow: var(--shadow) !important;
	background: var(--card-bg) !important;
}

.highlight-card {
	border-left: 4px solid var(--strava-orange);
	background: #fff7f3;
}

/* ==========================================================================
   ATHLETE PROFILE
   ========================================================================== */
.athlete-image, .profile-image {
	width: 120px;
	height: 120px;
	object-fit: cover;
	border: 3px solid var(--strava-orange);
	border-radius: 50%;
	margin: 0 auto;
	display: block;
}

.athlete-detail {
	text-align: center;
	margin-top: 1rem;
}

.athlete-name {
	font-size: 1.2rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

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

.athlete-name i,
.athlete-location i {
	margin-right: 0.5em;
	vertical-align: middle;
}

.athlete-detail i {
	vertical-align: middle;
}

/* ==========================================================================
   STATISTICS
   ========================================================================== */
.stats-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1rem;
	margin: 1.5rem 0 0 0;
}

.stat-box {
	background: #fff;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	padding: 1.2rem 0.8rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	transition: box-shadow 0.2s;
	flex: 1 1 130px;
	max-width: 160px;
	text-align: center;
}

.stat-box:hover {
	box-shadow: var(--shadow-hover);
}

.stat-icon {
	font-size: 2rem;
	margin-bottom: 0.5rem;
	color: var(--strava-orange);
}

.stat-label {
	font-size: 1.05rem;
	color: var(--text-secondary);
	margin-bottom: 0.15rem;
}

.stat-value {
	font-size: 1.4rem;
	font-weight: 700;
	color: #222;
	margin: 0.3rem 0;
}

.stat-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 1rem 0;
	border-left: 4px solid var(--strava-orange);
}

.stat-title {
	font-size: 1.1rem;
	font-weight: 500;
	margin-bottom: 0.2rem;
	color: #555;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.button-container, .button-grid {
	display: flex;
	gap: 0.5rem;
}

.button-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
	justify-items: center;
	margin-top: 8px;
}

.button-grid .ui-button, .button-grid .p-button {
	width: 100%;
	min-width: 140px;
	max-width: 220px;
	box-sizing: border-box;
}

.button-grid .dashboard-btn {
	grid-column: span 2;
}

.ui-button {
	transition: box-shadow 0.2s;
}

.ui-button:hover {
	box-shadow: 0 4px 18px rgba(252, 76, 2, 0.10);
}

.strava-button, .p-button.strava-button, .ui-button.strava-button {
	background-color: var(--strava-orange) !important;
	color: #fff !important;
	border: none !important;
}

.strava-button:hover, .p-button.strava-button:hover, .ui-button.strava-button:hover,
	.strava-button:focus, .p-button.strava-button:focus, .ui-button.strava-button:focus {
	background-color: var(--strava-orange-hover) !important;
	color: #fff !important;
}

.strava-orange-btn, .p-button.strava-orange-btn, .ui-button.strava-orange-btn {
	background: var(--strava-orange) !important;
	color: #fff !important;
	border: none !important;
}

.strava-orange-btn:hover, .p-button.strava-orange-btn:hover, .ui-button.strava-orange-btn:hover,
	.strava-orange-btn:focus, .p-button.strava-orange-btn:focus, .ui-button.strava-orange-btn:focus {
	background: var(--strava-orange-hover) !important;
	color: #fff !important;
}

.neutral-grey-btn, .p-button.neutral-grey-btn, .ui-button.neutral-grey-btn {
	background: #e0e0e0 !important;
	color: #222 !important;
	border: none !important;
}

.neutral-grey-btn:hover, .p-button.neutral-grey-btn:hover, .ui-button.neutral-grey-btn:hover,
	.neutral-grey-btn:focus, .p-button.neutral-grey-btn:focus, .ui-button.neutral-grey-btn:focus {
	background: #bdbdbd !important;
	color: #111 !important;
}

/* ==========================================================================
   ACTIVITY COMPONENTS
   ========================================================================== */
.activity-map, .activity-route-map {
	width: 100%;
	height: 400px;
	border-radius: var(--border-radius);
	margin-top: 1rem;
}

.activity-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 2rem;
	gap: 1rem;
}

.activity-card {
	background: #fff;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	padding: 1rem;
	margin-bottom: 1rem;
	border-left: 4px solid var(--strava-orange);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
}

.activity-info {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.activity-card-header {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.activity-date {
	font-size: 0.85rem;
	color: var(--text-secondary);
	white-space: nowrap;
}

.activity-type {
	font-size: 0.85rem;
	font-weight: 600;
}

.activity-name {
	font-weight: 600;
	font-size: 1.05rem;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.activity-distance {
	color: #555;
	font-size: 0.95rem;
}

.activity-action {
	flex-shrink: 0;
}

.activity-action .p-button {
	white-space: nowrap;
}

.activity-header {
	display: flex;
	align-items: flex-start;
	gap: 2rem;
	margin-bottom: 2rem;
}

.activity-details-icon {
	color: var(--strava-orange);
}

.activity-details-avatar {
	margin: 0 auto;
	display: block;
}

.activity-details-header-text {
	flex: 1;
}

.activity-details-title {
	margin: 0 0 0.5rem 0;
}

.activity-details-description {
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
}

.activity-details-date {
	color: var(--text-muted);
}

/* ==========================================================================
   AI COACH COMPONENTS
   ========================================================================== */
.ai-coach-card {
	border-left: 4px solid var(--strava-orange);
	background: #fff7f3;
}

.ai-coach-card .p-card-title {
	font-weight: 600;
}

.coach-content {
	max-height: 60vh;
	overflow-y: auto;
	padding: 1rem 0;
}

.coach-analysis {
	line-height: 1.6;
}

.coach-analysis p {
	margin-bottom: 1rem;
	color: #333;
}

/* ==========================================================================
   HOMEPAGE COMPONENTS
   ========================================================================== */
.homepage-container {
	max-width: 500px;
	margin: 2rem auto;
	padding: 0 1rem;
}

.homepage-profile-card {
	text-align: center;
}

.homepage-profile-card .ui-card-body {
	padding-top: 2rem;
	padding-bottom: 2rem;
}

.homepage-profile-image-container {
	width: 120px;
	height: 120px;
	margin: 0 auto 1.5rem auto;
}

.homepage-name {
	font-size: 2rem;
	font-weight: bold;
	color: #333;
	margin-bottom: 0.5rem;
}

.homepage-title {
	text-align: center;
	color: var(--text-secondary);
	font-size: 1.1rem;
	margin-bottom: 1rem;
}

.homepage-description {
	text-align: center;
	margin: 1.5rem 0 2rem 0;
	color: #444;
	line-height: 1.6;
}

.homepage-button-grid {
	justify-content: center;
	margin-top: 1rem;
}

/* ==========================================================================
   DIALOG COMPONENTS
   ========================================================================== */
.dialog-footer-buttons {
	display: flex;
	justify-content: center;
	gap: 1rem;
}

.dialog-footer-buttons .p-button {
	min-height: 44px;
	min-width: 80px;
}

/* ==========================================================================
   RESPONSIVE GRID LAYOUT
   ========================================================================== */
.dashboard-responsive-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	margin-bottom: 2rem;
}

.dashboard-profile-col {
	flex: 1 1 320px;
	min-width: 280px;
	max-width: 400px;
}

.dashboard-activities-col {
	flex: 2 1 480px;
	min-width: 320px;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 900px) {
	.dashboard-responsive-grid {
		flex-direction: column;
		gap: 1.5rem;
		margin-bottom: 1.5rem;
	}
	
	.dashboard-profile-col, .dashboard-activities-col {
		max-width: 100%;
		min-width: 0;
	}
	
	/* Show mobile activity cards, hide desktop table */
	.activity-card {
		display: flex;
	}
	
	.activity-table {
		display: none !important;
	}
}

@media (min-width: 900px) {
	/* Hide mobile activity cards, show desktop table */
	.activity-card {
		display: none;
	}
	
	.activity-table {
		display: table !important;
	}
}

@media (max-width: 768px) {
	body {
		padding: 8px;
	}
	
	.dashboard-container {
		height: auto;
	}
	
	.button-container, .button-grid {
		flex-direction: column;
	}
	
	.button-grid {
		grid-template-columns: 1fr;
	}
	
	.stat-value {
		font-size: 1.2rem;
	}
	
	.activity-table .col-type, .activity-table .col-distance {
		display: none !important;
	}
	
	.loading-container {
		margin: 1rem;
		padding: 1.5rem;
		min-height: 50vh;
	}
	
	.loading-spinner {
		width: 60px;
		height: 60px;
		margin-bottom: 1.5rem;
	}
	
	.loading-text {
		font-size: 1.1rem;
	}
	
	.loading-subtitle {
		font-size: 0.85rem;
	}
	
	.activity-header {
		gap: 1rem;
		margin-bottom: 1rem;
	}
	
	.activity-header h1 {
		font-size: 1.5rem !important;
		margin-bottom: 0.25rem !important;
	}
	
	.activity-header .pi-calendar {
		font-size: 0.9rem;
	}
	
	.homepage-container {
		margin: 1rem auto;
		padding: 0 0.5rem;
	}
	
	.homepage-profile-card .ui-card-body {
		padding-top: 1.5rem;
		padding-bottom: 1.5rem;
	}
	
	.homepage-profile-image-container {
		margin: 0 auto 1rem auto;
	}
	
	.homepage-name {
		font-size: 1.75rem;
	}
	
	.homepage-title {
		font-size: 1rem;
	}
	
	.homepage-description {
		margin: 1.25rem 0 1.5rem 0;
		font-size: 0.95rem;
	}
	
	.homepage-button-grid {
		margin-top: 0.75rem;
	}
}

/* ==========================================================================
   MOBILE-SPECIFIC DIALOG STYLES
   ========================================================================== */
@media (max-width: 768px) {
	.ui-dialog {
		width: 95vw !important;
		max-width: 95vw !important;
		height: 90vh !important;
		max-height: 90vh !important;
		top: 5vh !important;
		left: 2.5vw !important;
		right: 2.5vw !important;
		bottom: 5vh !important;
		border-radius: 8px !important;
		box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
	}
	
	.ui-dialog .ui-dialog-content {
		max-height: calc(90vh - 120px) !important;
		overflow-y: auto !important;
		padding: 1rem !important;
		-webkit-overflow-scrolling: touch !important;
		scroll-behavior: smooth !important;
	}
	
	.ui-dialog .ui-dialog-titlebar {
		padding: 0.75rem 1rem !important;
		font-size: 1.1rem !important;
	}
	
	.ui-dialog .ui-dialog-buttonpane {
		padding: 0.75rem 1rem !important;
		position: sticky !important;
		bottom: 0 !important;
		background: #fff !important;
		border-top: 1px solid #ddd !important;
	}
	
	.ui-dialog .ui-dialog-buttonpane .ui-button {
		min-height: 44px !important;
		min-width: 80px !important;
		font-size: 16px !important;
		padding: 0.75rem 1.5rem !important;
	}
	
	.coach-content {
		max-height: calc(90vh - 180px) !important;
		overflow-y: auto !important;
		padding: 0.5rem 0 !important;
	}
	
	.coach-analysis {
		font-size: 16px !important;
		line-height: 1.5 !important;
	}
	
	.coach-analysis p {
		margin-bottom: 0.75rem !important;
		font-size: 0.95rem !important;
	}
}

/* ==========================================================================
   UTILITY CLASSES & OVERRIDES
   ========================================================================== */
.mobile-only {
	display: none;
}

.desktop-only {
	display: block;
}

@media (max-width: 900px) {
	.mobile-only {
		display: block;
	}
	.desktop-only {
		display: none;
	}
}

.ui-dialog.ui-dialog-responsive {
	position: fixed !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) !important;
}

body.dialog-open {
	overflow: hidden !important;
	position: fixed !important;
	width: 100% !important;
}

/* Override PrimeFaces default progress bar styles */
.loading-container .ui-progressbar {
	background: transparent !important;
	border: none !important;
	height: auto !important;
}

.loading-container .ui-progressbar-value {
	display: none !important;
}