/* Calorie analyzer section */

.calorie {
	--cal-green: #3f9a44;
	--cal-green-dark: #2d7a31;
	--cal-text: #1a2332;
	--cal-muted: #64748b;
	background: #ffffff;
}

.calorie.rbz-section {
	padding-block: clamp(3.5rem, 7vw, 5.5rem);
}

.calorie__inner {
	width: 100%;
	max-width: var(--rbz-container);
	margin: 0 auto;
	padding-inline: var(--rbz-gutter);
}

.calorie__head {
	max-width: 640px;
	margin: 0 auto clamp(2rem, 4vw, 2.75rem);
	text-align: center;
}

.calorie__eyebrow {
	display: inline-block;
	margin-bottom: 0.75rem;
	padding: 0.3rem 0.75rem;
	border: 1px solid rgba(63, 154, 68, 0.18);
	border-radius: 999px;
	background: rgba(63, 154, 68, 0.06);
	color: var(--cal-green);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.calorie__title {
	color: var(--cal-text);
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 800;
	line-height: 1.45;
	letter-spacing: -0.02em;
}

.calorie__desc {
	margin-top: 0.75rem;
	color: var(--cal-muted);
	font-size: clamp(0.9375rem, 1.6vw, 1rem);
	line-height: 1.9;
}

.calorie__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(1rem, 2.5vw, 1.5rem);
	align-items: start;
}

/* Upload column */

.calorie__upload {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

.calorie__alert {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.75rem 0.875rem;
	border-radius: 14px;
	background: rgba(245, 158, 11, 0.1);
	color: #92400e;
	font-size: 0.8125rem;
	line-height: 1.75;
}

.calorie__alert i {
	flex-shrink: 0;
	margin-top: 0.125rem;
}

.calorie__file {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.calorie__drop {
	position: relative;
	min-height: 280px;
	padding: clamp(1rem, 2vw, 1.25rem);
	border: 1.5px dashed rgba(63, 154, 68, 0.22);
	border-radius: 20px;
	background: linear-gradient(160deg, rgba(63, 154, 68, 0.04) 0%, rgba(255, 255, 255, 0.9) 100%);
	transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.calorie__drop.is-dragover {
	border-color: rgba(63, 154, 68, 0.45);
	background: rgba(63, 154, 68, 0.06);
	box-shadow: 0 12px 36px rgba(63, 154, 68, 0.1);
}

.calorie__drop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 240px;
	text-align: center;
}

.calorie__drop-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	margin-bottom: 0.875rem;
	border-radius: 16px;
	background: rgba(63, 154, 68, 0.1);
	color: var(--cal-green);
	font-size: 1.5rem;
}

.calorie__drop-title {
	margin: 0 0 0.375rem;
	color: var(--cal-text);
	font-size: 0.9375rem;
	font-weight: 700;
}

.calorie__drop-hint {
	max-width: 32ch;
	margin: 0 0 1rem;
	color: var(--cal-muted);
	font-size: 0.8125rem;
	line-height: 1.75;
}

.calorie__drop-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

.calorie__action {
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
	padding: 0.5625rem 0.9375rem;
	border: 1px solid rgba(63, 154, 68, 0.18);
	border-radius: 999px;
	background: #ffffff;
	color: var(--cal-green-dark);
	font-size: 0.8125rem;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.calorie__action--primary {
	border-color: transparent;
	background: linear-gradient(145deg, var(--cal-green-dark), var(--cal-green));
	color: #ffffff;
}

.calorie__action:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(63, 154, 68, 0.14);
}

.calorie__preview {
	position: relative;
	min-height: 240px;
	border-radius: 14px;
	overflow: hidden;
}

.calorie__preview-img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 240px;
	object-fit: cover;
}

.calorie__preview-clear {
	position: absolute;
	top: 0.625rem;
	inset-inline-end: 0.625rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.55);
	color: #ffffff;
	font-size: 0.875rem;
	cursor: pointer;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.calorie__note {
	display: flex;
	flex-direction: column;
	gap: 0.3125rem;
}

.calorie__note span {
	color: var(--cal-muted);
	font-size: 0.6875rem;
	font-weight: 700;
}

.calorie__note input {
	padding: 0.5625rem 0.75rem;
	border: 1px solid rgba(63, 154, 68, 0.16);
	border-radius: 12px;
	background: #ffffff;
	color: var(--cal-text);
	font-family: inherit;
	font-size: 0.8125rem;
}

.calorie__note input:focus {
	border-color: rgba(63, 154, 68, 0.4);
	box-shadow: 0 0 0 3px rgba(63, 154, 68, 0.1);
	outline: none;
}

.calorie__analyze {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.8125rem 1.25rem;
	border: none;
	border-radius: 999px;
	background: linear-gradient(145deg, var(--cal-green-dark), var(--cal-green));
	color: #ffffff;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 700;
	cursor: pointer;
	overflow: hidden;
	box-shadow: 0 12px 32px rgba(63, 154, 68, 0.22);
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.calorie__analyze:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	box-shadow: none;
}

.calorie__analyze:not(:disabled):hover {
	transform: translateY(-1px);
}

.calorie__analyze-shine {
	position: absolute;
	inset: 0;
	background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.35) 50%, transparent 58%);
	transform: translateX(-120%);
	animation: calorie-shine 4s ease-in-out infinite;
	pointer-events: none;
}

.calorie__disclaimer {
	margin: 0;
	color: var(--cal-muted);
	font-size: 0.6875rem;
	line-height: 1.7;
	text-align: center;
}

/* Results */

.calorie__results {
	position: relative;
	min-height: 320px;
	padding: clamp(1rem, 2vw, 1.25rem);
	border: 1px solid rgba(63, 154, 68, 0.12);
	border-radius: 20px;
	background: #f9fbf9;
}

.calorie__results-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	text-align: center;
	color: var(--cal-muted);
	font-size: 0.875rem;
	line-height: 1.75;
}

.calorie__results-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	margin-bottom: 0.75rem;
	border-radius: 14px;
	background: rgba(63, 154, 68, 0.1);
	color: var(--cal-green);
	font-size: 1.375rem;
}

.calorie__results-body {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.calorie__results-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
}

.calorie__food-name {
	margin: 0;
	color: var(--cal-text);
	font-size: 1.0625rem;
	font-weight: 800;
	line-height: 1.45;
}

.calorie__serving {
	margin: 0.25rem 0 0;
	color: var(--cal-muted);
	font-size: 0.8125rem;
	line-height: 1.6;
}

.calorie__confidence {
	flex-shrink: 0;
	padding: 0.25rem 0.5625rem;
	border-radius: 999px;
	background: rgba(63, 154, 68, 0.1);
	color: var(--cal-green-dark);
	font-size: 0.6875rem;
	font-weight: 700;
}

.calorie__hero-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	border-radius: 16px;
	background: linear-gradient(145deg, var(--cal-green-dark), var(--cal-green));
	color: #ffffff;
	text-align: center;
}

.calorie__hero-value {
	font-size: clamp(2rem, 4vw, 2.75rem);
	font-weight: 800;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.calorie__hero-label {
	margin-top: 0.25rem;
	font-size: 0.8125rem;
	font-weight: 600;
	opacity: 0.88;
}

.calorie__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.5rem;
}

.calorie__stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.125rem;
	padding: 0.625rem 0.375rem;
	border-radius: 12px;
	background: #ffffff;
	border: 1px solid rgba(63, 154, 68, 0.1);
	text-align: center;
}

.calorie__stat-value {
	color: var(--cal-text);
	font-size: 0.9375rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.calorie__stat-label {
	color: var(--cal-muted);
	font-size: 0.6875rem;
	font-weight: 600;
	line-height: 1.4;
}

.calorie__macros {
	display: flex;
	flex-direction: column;
	gap: 0.4375rem;
}

.calorie__macro-bar {
	display: flex;
	height: 0.5rem;
	border-radius: 999px;
	overflow: hidden;
	background: rgba(63, 154, 68, 0.1);
}

.calorie__macro-seg {
	height: 100%;
	transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.calorie__macro-seg--protein { background: #3b82f6; }
.calorie__macro-seg--carbs { background: #f59e0b; }
.calorie__macro-seg--fat { background: #ef4444; }

.calorie__macro-legend {
	display: flex;
	justify-content: space-between;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--cal-muted);
	font-size: 0.6875rem;
	font-weight: 600;
}

.calorie__block-title {
	margin: 0 0 0.4375rem;
	color: var(--cal-text);
	font-size: 0.8125rem;
	font-weight: 800;
}

.calorie__items-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.calorie__items-list li {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.4375rem 0;
	border-bottom: 1px solid rgba(63, 154, 68, 0.08);
	font-size: 0.8125rem;
	line-height: 1.5;
}

.calorie__items-list li span:first-child {
	color: var(--cal-text);
	font-weight: 600;
}

.calorie__items-list li span:last-child {
	color: var(--cal-muted);
}

.calorie__analysis p,
.calorie__tips p {
	margin: 0;
	color: var(--cal-muted);
	font-size: 0.8125rem;
	line-height: 1.85;
}

.calorie__loading {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	border-radius: inherit;
	background: rgba(249, 251, 249, 0.92);
	color: var(--cal-muted);
	font-size: 0.875rem;
	font-weight: 600;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	pointer-events: none;
}

.calorie__loading.is-active {
	display: flex;
	pointer-events: auto;
}

.calorie__loading-ring {
	width: 2.25rem;
	height: 2.25rem;
	border: 2px solid rgba(63, 154, 68, 0.15);
	border-top-color: var(--cal-green);
	border-radius: 50%;
	animation: calorie-spin 0.8s linear infinite;
}

@keyframes calorie-shine {
	0%, 100% { transform: translateX(-120%); }
	48%, 52% { transform: translateX(120%); }
}

@keyframes calorie-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 1023px) {
	.calorie.rbz-section {
		padding-block: clamp(3rem, 8vw, 4.5rem);
	}

	.calorie__head {
		margin-bottom: clamp(1.5rem, 4vw, 2rem);
	}

	.calorie__title {
		font-size: clamp(1.5rem, 6vw, 2rem);
	}

	.calorie__desc {
		line-height: 1.9;
	}

	.calorie__layout {
		grid-template-columns: 1fr;
		gap: clamp(1.25rem, 3.5vw, 1.75rem);
	}

	.calorie__upload {
		gap: 0.75rem;
	}

	.calorie__drop {
		min-height: 240px;
		border-radius: 18px;
	}

	.calorie__drop-empty {
		min-height: 200px;
	}

	.calorie__results {
		min-height: 280px;
		border-radius: 18px;
	}

	.calorie__results-empty {
		min-height: 240px;
	}
}

@media (max-width: 720px) {
	.calorie__drop-actions {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		max-width: 18rem;
	}

	.calorie__action {
		justify-content: center;
		width: 100%;
		min-height: 2.75rem;
		padding-block: 0.6875rem;
	}

	.calorie__drop {
		min-height: 220px;
		padding: 1rem;
	}

	.calorie__drop-empty {
		min-height: 180px;
	}

	.calorie__drop-icon {
		width: 3rem;
		height: 3rem;
		font-size: 1.25rem;
	}

	.calorie__preview,
	.calorie__preview-img {
		min-height: 200px;
	}

	.calorie__preview-clear {
		width: 2.375rem;
		height: 2.375rem;
	}

	.calorie__analyze {
		min-height: 2.875rem;
		padding-block: 0.9375rem;
	}

	.calorie__results-head {
		flex-direction: column;
		align-items: stretch;
	}

	.calorie__confidence {
		align-self: flex-start;
	}

	.calorie__hero-stat {
		padding: 0.875rem;
	}

	.calorie__hero-value {
		font-size: clamp(1.75rem, 8vw, 2.25rem);
	}

	.calorie__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 0.4375rem;
	}

	.calorie__stat {
		padding: 0.5rem 0.25rem;
	}

	.calorie__stat-value {
		font-size: 0.875rem;
	}

	.calorie__stat-label {
		font-size: 0.625rem;
	}

	.calorie__macro-legend {
		flex-wrap: wrap;
		justify-content: center;
		gap: 0.375rem 0.75rem;
	}

	.calorie__items-list li {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.125rem;
	}
}

@media (max-width: 480px) {
	.calorie.rbz-section {
		padding-block: clamp(2.5rem, 7vw, 3.5rem);
	}

	.calorie__inner {
		padding-inline: max(1rem, var(--rbz-gutter));
	}

	.calorie__eyebrow {
		font-size: 0.75rem;
	}

	.calorie__drop-title {
		font-size: 0.875rem;
	}

	.calorie__drop-hint {
		max-width: none;
		font-size: 0.75rem;
	}

	.calorie__alert {
		font-size: 0.75rem;
		line-height: 1.7;
	}

	.calorie__results {
		min-height: 240px;
		padding: 0.875rem;
	}

	.calorie__results-empty {
		min-height: 200px;
		font-size: 0.8125rem;
	}

	.calorie__food-name {
		font-size: 1rem;
	}

	.calorie__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.calorie__analysis p,
	.calorie__tips p {
		font-size: 0.75rem;
		line-height: 1.8;
	}
}

@media (hover: none) {
	.calorie__action:hover,
	.calorie__analyze:not(:disabled):hover {
		transform: none;
		box-shadow: none;
	}

	.calorie__action--primary:hover {
		box-shadow: none;
	}

	.calorie__analyze:not(:disabled):hover {
		box-shadow: 0 12px 32px rgba(63, 154, 68, 0.22);
	}
}

@media (prefers-reduced-motion: reduce) {
	.calorie__analyze-shine,
	.calorie__loading-ring {
		animation: none !important;
	}
}

html.rbz-dark .calorie {
	background: #0f1410;
}

html.rbz-dark .calorie__title {
	color: rgba(255, 255, 255, 0.94);
}

html.rbz-dark .calorie__drop,
html.rbz-dark .calorie__results {
	background: rgba(255, 255, 255, 0.04);
	border-color: rgba(255, 255, 255, 0.08);
}

html.rbz-dark .calorie__stat {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.08);
}

html.rbz-dark .calorie__stat-value,
html.rbz-dark .calorie__food-name,
html.rbz-dark .calorie__block-title {
	color: rgba(255, 255, 255, 0.92);
}

html.rbz-dark .calorie__note input {
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.92);
}
