/* =====================================================
   SF Topic Finder Widget – Frontend Styles
   ===================================================== */

/* Widget container */
.sf-tf-widget {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	box-sizing: border-box;
}

/* Title */
.sf-tf-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	text-align: center;
	margin-bottom: 18px;
	padding-bottom: 8px;
	border-bottom: 2px solid currentColor;
	display: inline-block;
}

/* Form row */
.sf-tf-form {
	width: 100%;
}

.sf-tf-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px;
}

.sf-tf-field-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1 1 200px;
	min-width: 160px;
	position: relative;
}

.sf-tf-btn-group {
	flex: 0 0 auto;
}

/* Labels */
.sf-tf-label {
	font-size: 14px;
	font-weight: 600;
	display: block;
	white-space: nowrap;
}

/* Native select */
.sf-tf-select {
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 10px 36px 10px 14px;
	font-size: 14px;
	color: #333;
	cursor: pointer;
	width: 100%;
	box-sizing: border-box;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 10px 6px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	line-height: 1.4;
}

.sf-tf-select:focus {
	outline: 2px solid #1a56db;
	outline-offset: 1px;
	border-color: #1a56db;
}

/* ── Combo Box ────────────────────────────────────── */

.sf-tf-combo-wrap {
	position: relative;
	width: 100%;
}

.sf-tf-combo-input {
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 10px 36px 10px 14px;
	font-size: 14px;
	color: #333;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	line-height: 1.4;
}

.sf-tf-combo-input:focus {
	outline: 2px solid #1a56db;
	outline-offset: 1px;
	border-color: #1a56db;
}

.sf-tf-combo-arrow {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	color: #555;
	transition: transform 0.2s ease;
	line-height: 0;
}

.sf-tf-combo-wrap.open .sf-tf-combo-arrow {
	transform: translateY(-50%) rotate(180deg);
}

/* Dropdown list */
.sf-tf-combo-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #ccc;
	border-top: none;
	border-radius: 0 0 4px 4px;
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 240px;
	overflow-y: auto;
	z-index: 9999;
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.sf-tf-combo-wrap.open .sf-tf-combo-dropdown {
	display: block;
}

.sf-tf-combo-option {
	padding: 9px 14px;
	font-size: 14px;
	color: #333;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.sf-tf-combo-option:hover,
.sf-tf-combo-option.highlighted {
	background-color: #f5f5f5;
}

.sf-tf-combo-option.selected {
	background-color: #dbeafe;
	font-weight: 600;
}

.sf-tf-combo-option.sf-tf-combo-placeholder {
	color: #888;
	font-style: italic;
}

.sf-tf-combo-option[aria-hidden="true"],
.sf-tf-combo-option.sf-tf-hidden {
	display: none;
}

/* Button */
.sf-tf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 28px;
	background-color: #1a56db;
	color: #fff;
	border: none;
	border-radius: 50px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
	line-height: 1;
}

.sf-tf-btn:hover {
	background-color: #1045b5;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(26, 86, 219, 0.4);
}

.sf-tf-btn:active {
	transform: translateY(0);
	box-shadow: 0 1px 4px rgba(26, 86, 219, 0.3);
}

/* ── Select Loader ── */
.sf-tf-select-wrap {
	position: relative;
	width: 100%;
}

.sf-tf-select-loader {
	display: none;
	position: absolute;
	right: 12px;
	top: 50%;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-top-color: #1a56db;
	border-radius: 50%;
	animation: sf-tf-spin 0.6s linear infinite;
	pointer-events: none;
	box-sizing: border-box;
	z-index: 2;
}

.sf-tf-select-wrap.sf-tf-loading .sf-tf-select-loader {
	display: block;
}

/* Hide arrow while loading */
.sf-tf-select-wrap.sf-tf-loading .sf-tf-select {
	background-image: none !important;
}

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

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
	.sf-tf-row {
		flex-direction: column;
	}
	.sf-tf-field-group {
		flex: 1 1 100%;
	}
	.sf-tf-btn-group {
		width: 100%;
	}
	.sf-tf-btn {
		width: 100%;
	}
}
