/* Cost of Living & City Affordability Calculator — front-end styles */

.col-calculator {
	--col-accent: #6366f1;
	--col-anim-speed: 600ms;
	--col-bg: transparent;
	--col-card-bg: #ffffff;
	--col-text: #1e293b;
	--col-text-muted: #64748b;
	--col-border: #e2e8f0;
	--col-track: #eef2f7;
	--col-green: #16a34a;
	--col-green-bg: #dcfce7;
	--col-red: #dc2626;
	--col-red-bg: #fee2e2;
	--col-grey: #64748b;
	--col-grey-bg: #f1f5f9;

	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--col-text);
	background: var(--col-bg);
	max-width: 860px;
	margin: 0 auto;
	line-height: 1.5;
}

.col-calculator *,
.col-calculator *::before,
.col-calculator *::after {
	box-sizing: border-box;
}

/* Dark theme */
.col-calculator.col-dark {
	--col-bg: #1e1e2e;
	--col-card-bg: #2a2a3e;
	--col-text: #e2e8f0;
	--col-text-muted: #94a3b8;
	--col-border: #3f3f5c;
	--col-track: #232338;
	--col-green-bg: rgba(22, 163, 74, 0.2);
	--col-red-bg: rgba(220, 38, 38, 0.2);
	--col-grey-bg: rgba(148, 163, 184, 0.15);
	--col-green: #4ade80;
	--col-red: #f87171;
	--col-grey: #94a3b8;
	background: var(--col-bg);
	padding: 16px;
	border-radius: 16px;
}

/* Cards */
.col-card {
	background: var(--col-card-bg);
	border: 1px solid var(--col-border);
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	padding: 24px;
	margin-bottom: 20px;
}

/* Header */
.col-header {
	text-align: center;
	margin-bottom: 24px;
}

.col-title {
	margin: 0 0 4px;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--col-text);
}

.col-subtitle {
	margin: 0;
	color: var(--col-text-muted);
	font-size: 0.95rem;
}

/* Form layout */
.col-city-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

@media (min-width: 768px) {
	.col-city-row {
		grid-template-columns: 1fr 1fr;
	}
}

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

.col-label {
	font-weight: 600;
	font-size: 0.9rem;
	margin-bottom: 6px;
	color: var(--col-text);
}

/* Custom select */
.col-select-wrap {
	position: relative;
}

.col-select-wrap::after {
	content: '';
	position: absolute;
	right: 14px;
	top: 50%;
	width: 9px;
	height: 9px;
	border-right: 2px solid var(--col-text-muted);
	border-bottom: 2px solid var(--col-text-muted);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.col-select,
.col-input {
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	background: var(--col-card-bg);
	color: var(--col-text);
	border: 1px solid var(--col-border);
	border-radius: 8px;
	padding: 11px 36px 11px 12px;
	font-size: 1rem;
	font-family: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.col-input {
	padding-right: 12px;
}

.col-select:focus,
.col-input:focus {
	outline: 2px solid var(--col-accent);
	outline-offset: 1px;
	border-color: var(--col-accent);
}

/* Salary input */
.col-salary-field {
	margin-bottom: 16px;
}

.col-salary-input-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.col-salary-prefix {
	font-weight: 600;
	color: var(--col-text-muted);
}

.col-salary-input-wrap .col-input {
	max-width: 220px;
}

.col-salary-suffix {
	color: var(--col-text-muted);
	font-size: 0.9rem;
}

.col-hint {
	margin: 6px 0 0;
	font-size: 0.8rem;
	color: var(--col-text-muted);
}

/* Errors */
.col-inline-error {
	margin: 6px 0 0;
	font-size: 0.85rem;
	color: var(--col-red);
}

.col-error-banner[hidden],
.col-progress[hidden] {
	display: none;
}

.col-error-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--col-red-bg);
	color: var(--col-red);
	border: 1px solid var(--col-red);
	border-radius: 8px;
	padding: 10px 14px;
	margin-bottom: 16px;
	font-size: 0.9rem;
}

.col-error-banner button {
	background: none;
	border: none;
	color: inherit;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
}

/* Subtle indeterminate loading bar, visible only while calculating */
.col-progress {
	height: 3px;
	border-radius: 999px;
	background: var(--col-track);
	overflow: hidden;
	margin-bottom: 14px;
}

.col-progress-fill {
	height: 100%;
	width: 40%;
	border-radius: 999px;
	background: var(--col-accent);
	animation: col-progress-slide 1.1s ease-in-out infinite;
}

@keyframes col-progress-slide {
	0% { transform: translateX(-110%); }
	100% { transform: translateX(280%); }
}

/* Submit button */
.col-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	background: var(--col-accent);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 13px 24px;
	font-size: 1.05rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.col-submit:hover {
	filter: brightness(1.08);
}

.col-submit:focus-visible {
	outline: 2px solid var(--col-accent);
	outline-offset: 2px;
}

.col-submit.col-loading {
	pointer-events: none;
	opacity: 0.75;
}

@media (min-width: 768px) {
	.col-submit {
		width: auto;
		min-width: 220px;
		margin: 0 auto;
		display: flex;
	}
}

/* Spinner */
.col-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: col-spin 0.7s linear infinite;
}

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

/* Results reveal */
.col-results {
	opacity: 0;
	transform: translateY(16px);
}

.col-results.col-visible {
	animation: col-reveal var(--col-anim-speed) ease forwards;
}

@keyframes col-reveal {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Section 1: city cards */
.col-city-cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
	margin-bottom: 20px;
}

@media (min-width: 768px) {
	.col-city-cards {
		grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	}
}

.col-city-card {
	text-align: center;
	margin-bottom: 0;
}

.col-city-flag {
	font-size: 1.8rem;
	display: block;
}

.col-city-name {
	margin: 4px 0 4px;
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--col-text);
}

.col-city-tagline {
	margin: 0 0 18px;
	color: var(--col-text-muted);
	font-size: 0.9rem;
}

/* Circular gauge (conic-gradient, no chart library) */
.col-gauge {
	--col-gauge: 50;
	width: 132px;
	height: 132px;
	border-radius: 50%;
	margin: 0 auto;
	background: conic-gradient(
		var(--col-accent) calc(var(--col-gauge) * 1%),
		var(--col-track) 0
	);
	display: flex;
	align-items: center;
	justify-content: center;
}

.col-gauge-inner {
	width: 104px;
	height: 104px;
	border-radius: 50%;
	background: var(--col-card-bg);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
}

.col-gauge-value {
	font-size: 1.9rem;
	font-weight: 700;
	color: var(--col-text);
}

.col-gauge-max {
	font-size: 0.8rem;
	color: var(--col-text-muted);
}

.col-gauge-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--col-text-muted);
	margin-top: 3px;
}

/* Section titles */
.col-section-title {
	margin: 0 0 16px;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--col-text);
}

/* Section 2: comparison table (cards on mobile, table on desktop) */
.col-table {
	width: 100%;
}

.col-table-row {
	border-bottom: 1px solid var(--col-border);
	padding: 12px 0;
}

.col-table-row:last-child {
	border-bottom: none;
}

.col-table-head {
	display: none;
}

.col-table-cell {
	display: block;
	font-size: 0.95rem;
}

.col-cell-category {
	font-weight: 600;
	margin-bottom: 6px;
}

/* Mobile: label each value cell */
.col-table-row:not(.col-table-head) .col-table-cell:not(.col-cell-category)::before {
	content: attr(data-label) ': ';
	color: var(--col-text-muted);
	font-size: 0.8rem;
}

@media (min-width: 768px) {
	.col-table-head {
		display: grid;
	}

	.col-table-row {
		display: grid;
		grid-template-columns: 2fr 1fr 1fr 1.6fr;
		gap: 12px;
		align-items: center;
	}

	.col-table-single .col-table-row {
		grid-template-columns: 2fr 1fr;
	}

	.col-table-head .col-table-cell {
		font-weight: 700;
		font-size: 0.85rem;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--col-text-muted);
	}

	.col-cell-category {
		margin-bottom: 0;
	}

	.col-table-row:not(.col-table-head) .col-table-cell:not(.col-cell-category)::before {
		content: none;
	}
}

/* Badges */
.col-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 600;
	white-space: nowrap;
}

.col-badge-cheaper {
	background: var(--col-green-bg);
	color: var(--col-green);
}

.col-badge-expensive {
	background: var(--col-red-bg);
	color: var(--col-red);
}

.col-badge-similar {
	background: var(--col-grey-bg);
	color: var(--col-grey);
}

/* Section 3: progress bars */
.col-bar-group {
	margin-bottom: 18px;
}

.col-bar-group:last-child {
	margin-bottom: 0;
}

.col-bar-title {
	margin: 0 0 8px;
	font-weight: 600;
	font-size: 0.92rem;
}

.col-bar-row {
	display: grid;
	grid-template-columns: minmax(80px, 120px) 1fr minmax(72px, auto);
	gap: 10px;
	align-items: center;
	margin-bottom: 6px;
}

.col-bar-city {
	font-size: 0.85rem;
	color: var(--col-text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.col-bar-track,
.col-stretch-track {
	background: var(--col-track);
	border-radius: 999px;
	height: 12px;
	overflow: hidden;
}

.col-bar-fill {
	background: var(--col-accent);
	height: 100%;
	border-radius: 999px;
	transition: width var(--col-anim-speed) ease;
}

.col-bar-amount {
	font-size: 0.85rem;
	font-weight: 600;
	text-align: right;
}

/* Section 4: AI summary */
.col-ai-card {
	border-left: 4px solid var(--col-accent);
	background: var(--col-card-bg);
	background: color-mix(in srgb, var(--col-accent) 6%, var(--col-card-bg));
}

.col-ai-title {
	margin: 0 0 10px;
	font-size: 1rem;
	font-weight: 700;
}

.col-ai-text {
	font-style: italic;
	color: var(--col-text-muted);
	font-size: 0.95rem;
}

.col-ai-text p {
	margin: 0 0 8px;
}

.col-ai-text p:last-child {
	margin-bottom: 0;
}

.col-ai-unavailable {
	color: var(--col-text-muted);
	font-size: 0.85rem;
	text-align: center;
	margin: 0 0 20px;
}

/* Section 5: salary stretch */
.col-salary-meta {
	margin: 0 0 16px;
	font-size: 0.9rem;
	color: var(--col-text-muted);
}

.col-stretch {
	margin-bottom: 18px;
}

.col-stretch:last-child {
	margin-bottom: 0;
}

.col-stretch-title {
	margin: 0 0 6px;
	font-weight: 600;
	font-size: 0.95rem;
}

.col-stretch-track {
	height: 16px;
}

.col-stretch-fill {
	height: 100%;
	border-radius: 999px;
	transition: width var(--col-anim-speed) ease;
}

.col-stretch-ok {
	background: var(--col-green);
}

.col-stretch-short {
	background: var(--col-red);
}

.col-stretch-note {
	margin: 8px 0 0;
	font-size: 0.9rem;
}

.col-stretch-detail {
	color: var(--col-text-muted);
	font-size: 0.82rem;
}

/* Section 6: disclaimer */
.col-disclaimer {
	color: var(--col-text-muted);
	font-size: 0.78rem;
	text-align: center;
	margin: 0 0 8px;
}

/* Comfortable touch targets everywhere */
.col-select,
.col-input {
	min-height: 44px;
}

.col-submit {
	min-height: 48px;
}

/* Mobile polish */
@media (max-width: 767px) {
	.col-card {
		padding: 18px 16px;
		margin-bottom: 16px;
	}

	.col-calculator.col-dark {
		padding: 12px;
	}

	.col-title {
		font-size: 1.3rem;
	}

	.col-table-cell {
		font-size: 0.9rem;
	}

	.col-badge {
		white-space: normal;
	}

	.col-city-cards {
		gap: 16px;
	}
}

@media (max-width: 480px) {
	.col-bar-row {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			'city amount'
			'bar bar';
		row-gap: 5px;
		margin-bottom: 10px;
	}

	.col-bar-city {
		grid-area: city;
	}

	.col-bar-track {
		grid-area: bar;
	}

	.col-bar-amount {
		grid-area: amount;
	}

	.col-salary-input-wrap .col-input {
		max-width: none;
		flex: 1;
	}

	.col-gauge {
		width: 116px;
		height: 116px;
	}

	.col-gauge-inner {
		width: 90px;
		height: 90px;
	}

	.col-gauge-value {
		font-size: 1.6rem;
	}
}
