/* === Spot page === */

.spot-card {
	margin-bottom: 1.25rem;
}

.spot-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 0.25rem;
}

.spot-subtitle {
	font-size: 0.9rem;
	color: var(--text-muted);
	margin: 0 0 1.5rem;
}

.spot-access-message {
	margin: 0 0 1.5rem;
	padding: 1rem 1.25rem;
	border-radius: 10px;
	background: var(--surface-hover);
	border: 1px solid var(--border);
}

.spot-access-message h3 {
	margin: 0 0 0.5rem;
	font-size: 1.1rem;
	font-weight: 600;
}

.spot-access-message p {
	margin: 0 0 0.75rem;
	font-size: 0.95rem;
	color: var(--text-muted);
}

.spot-access-actions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

/* ---- Filters wrap ---- */
.spot-filters-wrap {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* Exchange pickers: 2 equal columns */
.spot-filters-exchanges {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.spot-exchange-panel {
	background: var(--surface-hover);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 1rem 1.15rem 0.85rem;
}

.spot-exchange-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.85rem;
}

.spot-exchange-panel-title {
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.spot-filter-actions {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.spot-filter-actions-sep {
	color: var(--border);
	font-size: 0.85rem;
	user-select: none;
}

/* Обёртка списка бирж: оверлеи загрузки и ошибки */
.spot-exchanges-list-wrap {
	position: relative;
	min-height: 9.5rem;
}

.spot-exchanges-loading,
.spot-exchanges-error {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 1rem;
	background: var(--surface-hover);
	border-radius: 6px;
	border: 1px solid var(--border);
}

.spot-exchanges-loading.hidden,
.spot-exchanges-error.hidden {
	display: none !important;
}

.spot-exchanges-error .load-error-message {
	color: var(--error);
	font-size: 0.9rem;
	text-align: center;
}

.spot-exchanges-error .load-error-retry {
	margin-top: 0;
}

/* Scrollable list of exchanges with checkboxes — фон как у панели, видно 4 биржи */
.spot-exchanges-chips-wrap {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	max-height: 9.5rem;
	overflow-y: auto;
	padding: 0.25rem 0;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--surface-hover);
}

.spot-exchange-item {
	display: flex;
	align-items: center;
	padding: 0.35rem 0.6rem;
	border-radius: 4px;
	font-size: 0.85rem;
	color: var(--text);
	cursor: pointer;
	transition: background 0.15s;
	user-select: none;
}

.spot-exchange-item:hover {
	background: var(--surface-hover);
}

.spot-exchange-item input[type="checkbox"] {
	display: inline-block;
	margin: 0 0.5rem 0 0;
	width: 1rem;
	height: 1rem;
	cursor: pointer;
	flex-shrink: 0;
}

.spot-exchange-item:has(input[type="checkbox"]:checked) {
	background: rgba(59, 130, 246, 0.1);
	color: var(--text);
}

.spot-exchange-item:has(input[type="checkbox"]:disabled) {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.spot-exchange-item:has(input[type="checkbox"]:disabled) input[type="checkbox"] {
	cursor: not-allowed;
}

.spot-selected-count {
	margin: 0.2rem 0 0;
	font-size: 0.75rem;
	color: var(--primary);
	font-weight: 600;
}

/* Numeric inputs: 4-column grid */
.spot-filters-inputs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
}

/* Select controls: 4-column grid */
.spot-filters-controls {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	align-items: end;
}

/* Generic field */
.spot-field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	position: relative;
}

.spot-field-label {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
}

.spot-field-label-row {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	max-width: 100%;
	vertical-align: top;
}

.spot-field-label-row .spot-field-label,
.spot-field-label-row label.spot-field-label {
	flex: 0 1 auto;
	margin-bottom: 0;
}

.spot-field-label-row .spot-help-icon {
	margin-left: 0;
	flex-shrink: 0;
}

/* Inline help icon for filters on spot page */
.spot-help-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	min-width: 20px;
	min-height: 20px;
	flex-shrink: 0;
	flex-grow: 0;
	box-sizing: border-box;
	margin-left: 0.3rem;
	border-radius: 50%;
	border: 1px solid var(--border);
	font-size: 0.8rem;
	color: var(--text-muted);
	cursor: default;
	position: relative;
	background: var(--surface-hover);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.spot-help-icon::before {
	content: '?';
	line-height: 1;
}

.spot-help-icon:hover,
.spot-help-icon:focus-visible {
	color: var(--text);
	border-color: var(--primary);
	outline: none;
}

.spot-help-bubble {
	position: absolute;
	top: 120%;
	left: 0;
	z-index: 30;
	min-width: 220px;
	max-width: 280px;
	padding: 0.5rem 0.6rem;
	border-radius: 6px;
	background: var(--surface);
	color: var(--text);
	font-size: 0.85rem;
	line-height: 1.4;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
	border: 1px solid var(--border);
	white-space: normal;
	display: none;
}

.spot-help-icon:hover .spot-help-bubble,
.spot-help-icon:focus-visible .spot-help-bubble {
	display: block;
}

/* Input */
.spot-input {
	width: 100%;
	padding: 0.55rem 0.8rem;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--text);
	background: var(--surface-hover);
	border: 1px solid var(--border);
	border-radius: 8px;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.spot-input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.13);
}

.spot-input::placeholder {
	color: var(--text-muted);
	opacity: 0.55;
}

/* Select */
.spot-select {
	width: 100%;
	padding: 0.55rem 2rem 0.55rem 0.8rem;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--text);
	background: var(--surface-hover);
	border: 1px solid var(--border);
	border-radius: 8px;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b9cb3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.spot-select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.13);
}

.spot-select--sm {
	width: auto;
	min-width: 80px;
}

.spot-input--sm {
	width: 120px;
}

.spot-field-error {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	right: auto;
	transform: none;
	background: var(--surface-hover);
	color: var(--error);
	font-size: 0.78rem;
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	white-space: normal;
	max-width: 320px;
	word-break: break-word;
	z-index: 10;
}

.spot-field-error--below {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	right: auto;
	transform: none;
	margin: 0;
	white-space: normal;
	display: block;
	z-index: 10;
}


.spot-input-invalid {
	border-color: var(--error) !important;
	box-shadow: 0 0 0 1px var(--error);
}

/* Chain-compatible toggle field */
.spot-field--chain {
	justify-content: flex-end;
}

.spot-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.5rem 0.8rem;
	background: var(--surface-hover);
	border: 1px solid var(--border);
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.875rem;
	color: var(--text-muted);
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	user-select: none;
	white-space: nowrap;
}

.spot-toggle-label:hover {
	border-color: var(--text-muted);
	color: var(--text);
}

.spot-toggle-label input[type="checkbox"] {
	display: none;
}

.spot-toggle-track {
	position: relative;
	width: 32px;
	height: 18px;
	background: var(--border);
	border-radius: 999px;
	flex-shrink: 0;
	transition: background 0.2s;
}

.spot-toggle-thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	background: var(--text-muted);
	border-radius: 50%;
	transition: left 0.2s, background 0.2s;
}

.spot-toggle-label:has(input:checked) .spot-toggle-track {
	background: var(--primary);
}

.spot-toggle-label:has(input:checked) .spot-toggle-thumb {
	left: 16px;
	background: #fff;
}

.spot-toggle-label:has(input:checked) {
	border-color: var(--primary);
	background: rgba(59, 130, 246, 0.1);
	color: var(--spot-toggle-checked-color);
}

/* Footer row */
.spot-filters-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}

.spot-filters-footer-left {
	display: flex;
	align-items: center;
	gap: 0.85rem;
}

.spot-field--inline {
	flex-direction: row;
	align-items: center;
	gap: 0.65rem;
	flex-wrap: wrap;
}

.spot-field--inline .spot-field-label {
	text-transform: none;
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: 0;
}

.spot-footer-actions {
	display: flex;
	gap: 0.5rem;
}

/* Responsive */
@media (max-width: 800px) {
	.spot-filters-inputs,
	.spot-filters-controls {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.spot-filters-exchanges {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.spot-filters-inputs,
	.spot-filters-controls {
		grid-template-columns: 1fr;
	}

	.spot-filters-footer {
		flex-direction: column;
		gap: 0.75rem;
		align-items: stretch;
	}

	.spot-footer-actions {
		justify-content: flex-end;
	}
}

/* ---- Results stats ---- */
.spot-stats {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.95rem;
	color: var(--text-muted);
	margin-bottom: 0.75rem;
}

/* ---- Results table ---- */
.spot-table-wrapper {
	overflow-x: auto;
}

.spot-show-more-row {
	margin-top: 0.75rem;
	display: flex;
	justify-content: center;
}

.spot-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	font-size: 1rem;
}

.spot-table--blurred {
	filter: blur(1.5px);
	opacity: 0.8;
	pointer-events: none;
	transition: filter 0.15s ease, opacity 0.15s ease;
}

.spot-table thead th {
	text-align: left;
	vertical-align: middle;
	padding: 0.45rem 0.7rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface-hover);
	font-size: 0.85rem;
	color: var(--text-muted);
	font-weight: 600;
	white-space: normal;
	line-height: 1.35;
}

.spot-table tbody td {
	padding: 0.6rem 0.7rem;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

/* ---- Base column widths (7 cols, no avg prices): main уже, volume шире ---- */
.spot-col-main   { width: 15%; }
.spot-col-chains { width: 16%; white-space: normal; word-wrap: break-word; }
.spot-col-volume { width: 13%; text-align: left; font-size: 0.9rem; color: var(--text-muted); }
.spot-col-profit { width: 10%; min-width: 5rem; text-align: left; }

/* ---- С колонками средних цен: main ещё уже, колонки средних цен шире ---- */
.spot-table--with-avg .spot-col-main   { width: 12%; }
.spot-table--with-avg .spot-col-chains { width: 13%; }
.spot-table--with-avg .spot-col-volume { width: 11%; }
.spot-table--with-avg .spot-col-profit { width: 8%; min-width: 5rem; }

.spot-col-arrow { display: none; }

.spot-exchange-name {
	font-weight: 600;
	margin-bottom: 0.15rem;
	font-size: 1rem;
}

.spot-symbol-link {
	display: inline-block;
	font-size: 0.9rem;
	color: var(--primary);
	text-decoration: none;
}

.spot-symbol-link:hover {
	text-decoration: underline;
}

.spot-price {
	font-size: 0.95rem;
	color: var(--text-muted);
	margin-top: 0.15rem;
}

.spot-volume {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-top: 0.1rem;
}

.spot-chain {
	display: inline-block;
	padding: 0.1rem 0.45rem;
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 500;
	margin: 0 0.15rem 0.15rem 0;
}

.spot-chain--open {
	background-color: rgba(34, 197, 94, 0.15);
	color: #4ade80;
}

.spot-chain--closed {
	background-color: rgba(239, 68, 68, 0.15);
	color: #f87171;
}

.spot-chains-empty {
	color: var(--text-muted);
}

.spot-profit {
	display: inline-block;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 600;
}

.spot-profit--positive {
	color: #4ade80;
	background-color: rgba(34, 197, 94, 0.15);
}

.spot-profit--negative {
	color: #f87171;
	background-color: rgba(239, 68, 68, 0.15);
}


