/**
 * YinYang Anima - PWA Styles
 */

:root {
	--color-bg: #0b0f10;
	--color-surface: #101415;
	--color-surface-variant: #323537;
	--color-on-surface: #e0e3e5;
	--color-on-surface-variant: #bdc8d1;
	--color-primary: #8ed5ff;
	--color-primary-container: #38bdf8;
	--color-on-primary-container: #004965;
	--color-secondary: #bec6e0;
	--color-tertiary: #c2cde5;
	--color-error: #ffb4ab;
	--color-outline: #87929a;
	--color-outline-variant: #3e484f;

	--gap-sm: 12px;
	--gap-md: 24px;
	--gap-lg: 48px;
	--padding-container: 24px;

	--transition-speed: 0.3s;
	--transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
	box-sizing: border-box;
}

body {
	background-color: var(--color-bg);
	color: var(--color-on-surface);
	font-family: 'Manrope', sans-serif;
	min-height: 100vh;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
}

/* --- App Loader --- */
.app-loader {
	position: fixed;
	inset: 0;
	background: #0b0f10;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	transition: opacity 0.8s ease, visibility 0.8s;
}

.app-loader.fade-out {
	opacity: 0;
	visibility: hidden;
}

.loader-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 32px;
}

.loader-orb {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: radial-gradient(circle at 30% 30%, #38bdf8, #0ea5e9);
	box-shadow: 0 0 50px rgba(56, 189, 248, 0.4);
	animation: loader-pulse 5s infinite ease-in-out;
}

@keyframes loader-pulse {

	0%,
	100% {
		transform: scale(1);
		opacity: 0.6;
		box-shadow: 0 0 40px rgba(56, 189, 248, 0.2);
	}

	50% {
		transform: scale(1.15);
		opacity: 0.9;
		box-shadow: 0 0 80px rgba(56, 189, 248, 0.5);
	}
}

.loader-title {
	color: #ffffff;
	font-size: 14px;
	letter-spacing: 0.5em;
	font-weight: 700;
	margin: 0;
	opacity: 0.9;
}

.loader-bar-container {
	width: 140px;
	height: 2px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 999px;
	overflow: hidden;
}

.loader-bar {
	width: 60px;
	height: 100%;
	background: #38bdf8;
	animation: loader-slide 2s infinite ease-in-out;
}

@keyframes loader-slide {
	0% {
		transform: translateX(-140px);
	}

	100% {
		transform: translateX(140px);
	}
}

.yinyang-icon {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: block;
}

.app-loader .yinyang-icon {
	width: 40px;
	height: 40px;
	color: #38bdf8;
	animation: icon-spin 10s infinite linear;
}

@keyframes icon-spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

/* --- Layout Utilities --- */
.flex {
	display: flex;
}

.flex-col {
	flex-direction: column;
}

.items-center {
	align-items: center;
}

.justify-center {
	justify-content: center;
}

.justify-between {
	justify-content: space-between;
}

.justify-around {
	justify-content: space-around;
}

.items-end {
	align-items: flex-end;
}

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

.grid {
	display: grid;
}

.grid-cols-1 {
	grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.relative {
	position: relative;
}

.absolute {
	position: absolute;
}

.fixed {
	position: fixed;
}

.inset-0 {
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
}

.bottom-8 {
	bottom: 32px;
}

.left-1/2 {
	left: 50%;
}

.-translate-x-1/2 {
	transform: translateX(-50%);
}

.w-full {
	width: 100%;
}

.max-w-sm {
	max-width: 384px;
}

.z-10 {
	z-index: 10;
}

.z-50 {
	z-index: 50;
}

/* --- Spacing --- */
.gap-2 {
	gap: 8px;
}

.gap-3 {
	gap: 12px;
}

.gap-4 {
	gap: 16px;
}

.mb-2 {
	margin-bottom: 8px;
}

.mb-8 {
	margin-bottom: 32px;
}

.mb-10 {
	margin-bottom: 40px;
}

.mb-12 {
	margin-bottom: 48px;
}

.mb-20 {
	margin-bottom: 80px;
}

.mt-4 {
	margin-top: 16px;
}

.mt-8 {
	margin-top: 32px;
}

.mt-12 {
	margin-top: 48px;
}

.p-5 {
	padding: 20px;
}

.p-8 {
	padding: 32px;
}

.px-6 {
	padding-left: 24px;
	padding-right: 24px;
}

.py-4 {
	padding-top: 16px;
	padding-bottom: 16px;
}

/* --- Typography --- */
.text-center {
	text-align: center;
}

.text-right {
	text-align: right;
}

.font-display {
	font-family: 'Manrope';
	font-size: 48px;
	line-height: 1.1;
	letter-spacing: 0.05em;
	font-weight: 300;
}

.font-h1 {
	font-size: 32px;
	font-weight: 400;
}

.font-h2 {
	font-size: 24px;
	font-weight: 500;
}

.font-label-caps {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

.font-body-md {
	font-size: 14px;
	line-height: 1.6;
}

.font-small {
	font-size: 10px;
}

.status-label {
	background: rgba(56, 189, 248, 0.1);
	padding: 4px 12px;
	border-radius: 999px;
	border: 1px solid rgba(56, 189, 248, 0.2);
}

.text-on-surface-variant {
	color: var(--color-on-surface-variant);
}

.text-sky-400 {
	color: #38bdf8;
}

.text-slate-500 {
	color: #64748b;
}

.text-white {
	color: #ffffff;
}

/* --- Components --- */
.app-main {
	flex: 1;
	padding: 60px 24px 120px;
	max-width: 500px;
	margin: 0 auto;
	width: 100%;
}

.ambient-glow {
	position: fixed;
	width: 400px;
	height: 400px;
	border-radius: 50%;
	filter: blur(100px);
	opacity: 0.15;
	pointer-events: none;
	z-index: -1;
}

.glow-center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: var(--color-primary-container);
}

.glow-corner {
	bottom: -100px;
	right: -100px;
	background: var(--color-secondary);
}

.glass-panel {
	background: rgba(30, 41, 59, 0.4);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 1rem;
}

.glass-input {
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	padding: 12px 20px;
	color: #ffffff;
	font-family: 'Manrope', sans-serif;
	outline: none;
	transition: all 0.3s ease;
}

.orb-container {
	position: relative;
	width: 220px;
	height: 220px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 2rem auto 2.5rem;
}

.orb-glow {
	position: absolute;
	inset: -40px;
	background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0) 70%);
	border-radius: 50%;
	pointer-events: none;
}

.orb-rim {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
}

.rim-outer {
	inset: -15px;
	border: 1px solid rgba(56, 189, 248, 0.1);
}

.rim-inner {
	inset: 8px;
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.breath-orb {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
	z-index: 5;
	transition: transform 2.5s var(--transition-ease), box-shadow 2.5s var(--transition-ease);
	/* Fix Safari overflow:hidden + border-radius bug */
	-webkit-mask-image: -webkit-radial-gradient(white, black);
	-webkit-backface-visibility: hidden;
	transform: translateZ(0);
	isolation: isolate;
}

.inner-rim {
	box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
}

.breath-orb.expanding {
	transform: scale(1.3);
	box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.1), 0 0 60px rgba(56, 189, 248, 0.4);
}

.orb-fill {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background: rgba(142, 213, 255, 0.2);
	filter: blur(8px);
	transition: height 1s ease-in-out;
}

.round-indicator {
	position: absolute;
	top: -15px;
	right: -15px;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.8);
	border: 1px solid rgba(56, 189, 248, 0.4);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 30;
}

.segment-indicator {
	position: absolute;
	bottom: -15px;
	left: 50%;
	transform: translateX(-50%);
	padding: 6px 16px;
	border-radius: 9999px;
	background: rgba(15, 23, 42, 0.8);
	border: 1px solid rgba(56, 189, 248, 0.3);
	z-index: 20;
	width: auto;
	min-width: 140px;
	text-align: center;
}

.primary-button {
	background: var(--color-primary-container);
	color: var(--color-on-primary-container);
	padding: 16px 48px;
	border-radius: 9999px;
	font-weight: 700;
	letter-spacing: 0.1em;
	border: none;
	cursor: pointer;
	transition: transform 0.2s;
}

.primary-button:active {
	transform: scale(0.95);
}

.secondary-button {
	background: rgba(255, 255, 255, 0.05);
	color: var(--color-on-surface-variant);
	border: 1px solid rgba(255, 255, 255, 0.1);
	padding: 14px 32px;
	border-radius: 9999px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s var(--transition-ease);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.secondary-button:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
}

.danger-button {
	background: rgba(239, 68, 68, 0.1);
	color: #ef4444;
	border: 1px solid rgba(239, 68, 68, 0.2);
	padding: 12px 24px;
	border-radius: 9999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	cursor: pointer;
	transition: all 0.3s var(--transition-ease);
}

.danger-button:hover {
	background: rgba(239, 68, 68, 0.2);
	border-color: rgba(239, 68, 68, 0.4);
	transform: translateY(-1px);
}

#clear-data {
	margin-top: 1.5rem;
	opacity: 0.7;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#clear-data:hover {
	opacity: 1;
	background: rgba(239, 68, 68, 0.2);
	box-shadow: 0 0 30px rgba(239, 68, 68, 0.15);
	letter-spacing: 0.15em;
}

.outlined-button {
	background: transparent;
	border: 1px solid var(--color-primary-container);
	color: var(--color-primary-container);
	padding: 16px 48px;
	border-radius: 9999px;
	font-weight: 700;
	cursor: pointer;
}

.app-nav {
	position: fixed;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%);
	width: 85%;
	max-width: 384px;
	z-index: 100;
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 10px 24px;
	background: rgba(15, 23, 42, 0.8);
	backdrop-filter: blur(32px);
	border-radius: 9999px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nav-item {
	background: none;
	border: none;
	color: var(--color-outline);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	transition: color 0.3s;
}

.nav-item.active {
	color: var(--color-primary-container);
}

.setting-card {
	padding: 20px;
	background: rgba(30, 41, 59, 0.4);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 1rem;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.setting-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.setting-label-area {
	display: flex;
	align-items: center;
	gap: 8px;
}

.setting-description {
	font-size: 9px;
	color: #94a3b8;
	text-transform: uppercase;
	margin: 0;
}

.input-group {
	display: flex;
	background: rgba(15, 23, 42, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	overflow: hidden;
	width: 140px;
}

.input-group input {
	background: transparent;
	border: none;
	color: white;
	padding: 10px 12px;
	width: 100%;
	text-align: right;
	outline: none;
}

.input-group-addon {
	background: rgba(255, 255, 255, 0.03);
	padding: 0 12px;
	display: flex;
	align-items: center;
	color: rgba(56, 189, 248, 0.5);
	font-size: 9px;
	font-weight: 700;
}

.mute-indicator {
	position: absolute;
	top: -10px;
	left: -5px;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 99;
}

.rating-btn {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 16px;
	padding: 20px 10px;
	width: 80px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.rating-btn:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.1);
}

.rating-btn.active {
	background: rgba(56, 189, 248, 0.1);
	border-color: rgba(56, 189, 248, 0.4);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.rating-btn .material-symbols-outlined {
	font-size: 32px;
	color: #64748b;
	transition: all 0.3s ease;
}

.rating-btn.active .material-symbols-outlined {
	color: #38bdf8;
	font-variation-settings: 'FILL' 1;
	transform: scale(1.1);
}

.rating-btn.active .font-label-caps {
	color: #38bdf8;
}

.hidden {
	display: none !important;
}

/* --- Ready State Pulse --- */
@keyframes orb-ready-pulse {
	0% {
		transform: scale(1);
		opacity: 1;
		filter: brightness(1);
	}

	50% {
		transform: scale(1.04);
		opacity: 0.8;
		filter: brightness(1.2);
	}

	100% {
		transform: scale(1);
		opacity: 1;
		filter: brightness(1);
	}
}

.orb-pulse {
	animation: orb-ready-pulse 4s infinite ease-in-out;
}

/* --- Stats Charts --- */
.chart-scroll-container {
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 8px;
}

.chart-inner-wrapper {
	min-width: 100%;
	height: 200px;
	position: relative;
}

/* Custom Scrollbar */
.chart-scroll-container::-webkit-scrollbar {
	height: 3px;
}

.chart-scroll-container::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.05);
}

.chart-scroll-container::-webkit-scrollbar-thumb {
	background: rgba(56, 189, 248, 0.3);
	border-radius: 99px;
}

.chart-scroll-container::-webkit-scrollbar-thumb:hover {
	background: rgba(56, 189, 248, 0.6);
}

/* --- Firefly Animation --- */
.firefly {
	width: 5px;
	height: 5px;
	position: absolute;
	background-color: var(--color-primary-container);
	box-shadow: 0px 0px 15px 3px rgba(56, 189, 248, 0.8);
	border-radius: 50%;
	z-index: 0;
	top: 0;
	pointer-events: none;
}

/* --- Modals --- */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	z-index: 1000;
}

.modal-btn-confirm {
	background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
	color: white;
	border: none;
	padding: 16px 32px;
	border-radius: 9999px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.modal-btn-confirm:hover {
	background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.modal-btn-cancel {
	background: rgba(255, 255, 255, 0.05);
	color: #94a3b8;
	border: 1px solid rgba(255, 255, 255, 0.1);
	padding: 16px 32px;
	border-radius: 9999px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-btn-cancel:hover {
	background: rgba(255, 255, 255, 0.1);
	color: white;
	border-color: rgba(255, 255, 255, 0.2);
	transform: translateY(-2px);
}