/**
 * Crymbo Widget – CoinCashy-compatible styles
 */
.crymbo-widget {
	--crymbo-primary: #171717;
	--crymbo-primary-hover: #2d2d2d;
	--crymbo-bg: #ffffff;
	--crymbo-tab-bg: #efefef;
	--crymbo-border: #e5e7eb;
	--crymbo-text: #111827;
	--crymbo-text-muted: #9ca3af;
	--crymbo-error: #dc2626;
	--crymbo-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--crymbo-radius: 16px;
	--crymbo-field-radius: 12px;

	max-width: 420px;
	width: 100%;
	box-sizing: border-box;
	padding: 0;                          /* tabs bleed to card edges */
	border: 1px solid var(--crymbo-border);
	border-radius: var(--crymbo-radius);
	overflow: hidden;                    /* round the tabs with the card */
	font-family: var(--crymbo-font);
	color: var(--crymbo-text);
	background: var(--crymbo-bg);
}

.crymbo-widget-inner {
	display: flex;
	flex-direction: column;
}

/* ── Tabs ── */
.crymbo-tabs {
	display: flex;
	background: var(--crymbo-tab-bg);
	/* No border-radius – widget overflow:hidden handles the top corners */
}

.crymbo-tab {
	flex: 1;
	padding: 1em 1.5em;
	border: none;
	border-bottom: none;
	background: transparent;
	border-radius: 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--crymbo-text-muted);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	letter-spacing: -0.01em;
}

.crymbo-tab:hover:not(.crymbo-tab-active) {
	color: var(--crymbo-text);
	background: rgba(255, 255, 255, 0.5);
}

/* Active tab: white – same as the body below, no divider = "part of the panel" */
.crymbo-tab.crymbo-tab-active {
	background: var(--crymbo-bg);
	color: var(--crymbo-text);
}

/* Thin divider between inactive tabs so they read as separate */
.crymbo-tab:not(:last-child) {
	border-right: 1px solid rgba(0, 0, 0, 0.07);
}

.crymbo-tab:focus-visible {
	outline: 2px solid var(--crymbo-primary);
	outline-offset: -2px;
}

/* ── Widget body (content below tabs) ── */
.crymbo-widget-body {
	display: flex;
	flex-direction: column;
	gap: 0.875em;
	padding: 1.25em;
}

/* ── Fields ── */
.crymbo-fields {
	display: flex;
	flex-direction: column;
	gap: 0.625em;
	margin: 0;
}

.crymbo-field {
	background: var(--crymbo-field-bg);
	border: 1px solid var(--crymbo-border);
	border-radius: var(--crymbo-field-radius);
	padding: 0.75em 1em;
	display: flex;
	flex-direction: column;
	gap: 0.3em;
}

.crymbo-field-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
}

.crymbo-label {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--crymbo-text-muted);
	flex-shrink: 0;
}

/* Amount inputs */
.crymbo-spend,
.crymbo-receive-value {
	border: none;
	padding: 0;
	font-size: 1.125rem;
	font-weight: 500;
	color: var(--crymbo-text);
	background: transparent;
	width: 100%;
	font-family: inherit;
	-moz-appearance: textfield;
}

.crymbo-spend::-webkit-outer-spin-button,
.crymbo-spend::-webkit-inner-spin-button {
	-webkit-appearance: none;
}

.crymbo-spend::placeholder,
.crymbo-receive-value::placeholder {
	color: var(--crymbo-text-muted);
}

.crymbo-spend:focus,
.crymbo-receive-value:focus {
	outline: none;
}

.crymbo-receive-value {
	cursor: default;
	color: var(--crymbo-text-muted);
}

/* Focus ring on the whole field card */
.crymbo-field:focus-within {
	border-color: #9ca3af;
}

/* ── Currency Picker ── */
.crymbo-currency-picker {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	background: #f3f4f6;
	border-radius: 999px;
	padding: 0.3em 0.5em 0.3em 0.3em;
	position: relative;
	flex-shrink: 0;
}

.crymbo-currency-icon {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: #e5e7eb;
}

/* The native select – transparent, overlaid for interaction */
.crymbo-currency-picker select.crymbo-currency {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	font-size: 1rem;
	border: none;
	background: transparent;
	-webkit-appearance: auto;
}

/* Visible label showing ticker + chevron */
.crymbo-picker-label {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--crymbo-text);
	pointer-events: none;
	white-space: nowrap;
}

.crymbo-picker-chevron {
	font-size: 0.75rem;
	color: var(--crymbo-text-muted);
	pointer-events: none;
	line-height: 1;
}

/* ── Quote section ── */
.crymbo-quote-section {
	padding: 0.25em 0;
}

.crymbo-quote-section[hidden] {
	display: none !important;
}

.crymbo-quote-line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
}

.crymbo-quote-text {
	font-size: 0.9375rem;
	color: var(--crymbo-text);
	font-weight: 500;
}

.crymbo-quote-timer {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	font-size: 0.875rem;
	color: var(--crymbo-text-muted);
	white-space: nowrap;
}

.crymbo-timer-value {
	font-variant-numeric: tabular-nums;
}

.crymbo-timer-refresh {
	padding: 0.2em;
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 1rem;
	color: var(--crymbo-text-muted);
	border-radius: 4px;
	line-height: 1;
}

.crymbo-timer-refresh:hover {
	color: var(--crymbo-primary);
}

.crymbo-quote-separator {
	height: 1px;
	background: var(--crymbo-border);
	margin: 0.5em 0;
}

.crymbo-fees summary {
	cursor: pointer;
	font-size: 0.875rem;
	color: var(--crymbo-text-muted);
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.crymbo-fees summary::-webkit-details-marker {
	display: none;
}

.crymbo-fees summary::after {
	content: '↓';
	font-size: 0.75rem;
}

.crymbo-fees[open] summary::after {
	content: '↑';
}

.crymbo-fees-detail {
	margin: 0.4em 0 0;
	font-size: 0.8125rem;
	color: var(--crymbo-text-muted);
}

/* ── Loading & error ── */
.crymbo-loading {
	font-size: 0.875rem;
	color: var(--crymbo-text-muted);
	font-style: italic;
}

.crymbo-error {
	font-size: 0.875rem;
	color: var(--crymbo-error);
}

.crymbo-btn-retry {
	margin-left: 0.5em;
	font-size: 0.8125rem;
}

/* ── Buttons ── */
.crymbo-actions {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
}

.crymbo-btn {
	padding: 0.825em 1.25em;
	min-height: 50px;
	text-decoration: none;
	border-radius: 10px;
	border: none;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, opacity 0.15s;
	letter-spacing: -0.01em;
}

.crymbo-btn-get-quote {
	background: #f3f4f6;
	color: var(--crymbo-text);
	border: 1px solid var(--crymbo-border);
}

.crymbo-btn-get-quote:hover {
	background: #e5e7eb;
}

.crymbo-btn-cta {
	background: var(--crymbo-primary);
	color: #fff;
}

.crymbo-btn-cta:hover {
	background: var(--crymbo-primary-hover);
}

.crymbo-btn-cta[hidden],
.crymbo-btn-get-quote[hidden] {
	display: none !important;
}

.crymbo-btn:focus-visible {
	outline: 2px solid var(--crymbo-primary);
	outline-offset: 2px;
}
