/**
 * FairBusiness — Widget Styles
 *
 * Structural CSS for FBA badge, rating sidebar, search, notifications,
 * toasts, modals, pagination, and empty states.
 * BEM naming convention.
 */

/* FBA Badge */
.fb-fba-badge {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	padding: 16px;
	border: 1px solid #eee;
	border-radius: 8px;
	text-align: center;
	min-width: 120px;
}

.fb-fba-badge__score {
	font-size: 36px;
	font-weight: 700;
	line-height: 1;
	margin-bottom: 4px;
}

.fb-fba-badge__label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
	margin-bottom: 8px;
}

.fb-fba-badge__level {
	font-size: 13px;
	font-weight: 600;
	padding: 2px 12px;
	border-radius: 12px;
}

.fb-fba-badge--excellent .fb-fba-badge__level { background: #d1fae5; color: #065f46; }
.fb-fba-badge--good .fb-fba-badge__level { background: #dbeafe; color: #1e40af; }
.fb-fba-badge--fair .fb-fba-badge__level { background: #fef3c7; color: #92400e; }
.fb-fba-badge--poor .fb-fba-badge__level { background: #fee2e2; color: #991b1b; }

/* Rating display */
.fb-rating {
	display: flex;
	align-items: center;
	gap: 8px;
}

.fb-rating__stars {
	display: flex;
	gap: 2px;
}

.fb-rating__star {
	font-size: 16px;
	color: #ddd;
}

.fb-rating__star--filled {
	color: #f59e0b;
}

.fb-rating__star--half {
	color: #f59e0b;
}

.fb-rating__value {
	font-size: 14px;
	font-weight: 600;
}

.fb-rating__count {
	font-size: 13px;
	color: #666;
}

/* Rating sidebar */
.fb-rating-sidebar {
	padding: 16px;
	border: 1px solid #eee;
	border-radius: 8px;
}

.fb-rating-sidebar__overall {
	text-align: center;
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid #eee;
}

.fb-rating-sidebar__score {
	font-size: 48px;
	font-weight: 700;
	line-height: 1;
}

.fb-rating-sidebar__breakdown {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fb-rating-sidebar__row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 0;
	font-size: 13px;
}

.fb-rating-sidebar__criterion {
	flex: 1;
}

.fb-rating-sidebar__bar {
	flex: 2;
	height: 6px;
	background: #eee;
	border-radius: 3px;
	overflow: hidden;
}

.fb-rating-sidebar__bar-fill {
	height: 100%;
	background: #f59e0b;
	border-radius: 3px;
	transition: width 0.3s;
}

/* Search */
.fb-search {
	position: relative;
	max-width: 500px;
}

.fb-search__input {
	width: 100%;
	padding: 12px 16px 12px 40px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 8px;
	box-sizing: border-box;
}

.fb-search__input:focus {
	outline: none;
	border-color: #666;
}

.fb-search__icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #999;
	pointer-events: none;
}

.fb-search__type {
	margin-top: 8px;
	display: flex;
	gap: 8px;
}

.fb-search__type-btn {
	padding: 6px 14px;
	font-size: 13px;
	border: 1px solid #ddd;
	border-radius: 16px;
	background: #fff;
	cursor: pointer;
}

.fb-search__type-btn--active {
	background: #333;
	color: #fff;
	border-color: #333;
}

/* Search suggestions dropdown */
.fb-search-suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 50;
	background: #fff;
	border: 1px solid #ddd;
	border-top: none;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	display: none;
	max-height: 300px;
	overflow-y: auto;
}

.fb-search-suggestions--active {
	display: block;
}

.fb-search-suggestion {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
}

.fb-search-suggestion:hover {
	background: #f9fafb;
}

.fb-search-suggestion__title {
	font-size: 14px;
	font-weight: 500;
}

.fb-search-suggestion__type {
	font-size: 12px;
	color: #888;
}

/* Search results */
.fb-search-results {
	max-width: 800px;
	margin: 0 auto;
}

.fb-search-results__header {
	margin-bottom: 20px;
}

.fb-search-results__count {
	font-size: 14px;
	color: #666;
}

.fb-search-result {
	padding: 16px 0;
	border-bottom: 1px solid #f3f4f6;
}

.fb-search-result__title {
	font-size: 16px;
	font-weight: 500;
	margin: 0 0 4px;
}

.fb-search-result__title a {
	text-decoration: none;
	color: inherit;
}

.fb-search-result__meta {
	font-size: 13px;
	color: #666;
	margin-bottom: 4px;
}

.fb-search-result__excerpt {
	font-size: 14px;
	color: #444;
}

/* Notification bell */
.fb-notification-bell {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.fb-notification-bell__icon {
	font-size: 20px;
	color: #666;
}

.fb-notification-bell__count {
	position: absolute;
	top: -4px;
	right: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 11px;
	font-weight: 600;
	background: #dc2626;
	color: #fff;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fb-notification-bell__count--hidden {
	display: none;
}

/* Notification dropdown */
.fb-notification-dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 60;
	width: 320px;
	max-height: 400px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	display: none;
}

.fb-notification-dropdown--active {
	display: block;
}

.fb-notification-dropdown__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
	font-size: 14px;
	font-weight: 600;
}

.fb-notification-item {
	display: block;
	padding: 12px 16px;
	border-bottom: 1px solid #f3f4f6;
	text-decoration: none;
	color: inherit;
}

.fb-notification-item:hover {
	background: #f9fafb;
}

.fb-notification-item--unread {
	background: #f0f7ff;
}

.fb-notification-item__title {
	font-size: 14px;
	font-weight: 500;
	margin-bottom: 2px;
}

.fb-notification-item__message {
	font-size: 13px;
	color: #666;
	margin-bottom: 4px;
}

.fb-notification-item__time {
	font-size: 12px;
	color: #999;
}

/* Toast notifications */
.fb-toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fb-toast {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	min-width: 300px;
	max-width: 440px;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	font-size: 14px;
	animation: fb-toast-in 0.3s ease;
}

.fb-toast--success {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.fb-toast--error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.fb-toast--info {
	background: #eff6ff;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}

.fb-toast__close {
	margin-left: auto;
	border: none;
	background: none;
	cursor: pointer;
	font-size: 16px;
	opacity: 0.5;
}

@keyframes fb-toast-in {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Modal */
.fb-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 0, 0, 0.5);
	display: none;
	align-items: center;
	justify-content: center;
}

.fb-modal-overlay--active {
	display: flex;
}

.fb-modal {
	background: #fff;
	border-radius: 12px;
	width: 90%;
	max-width: 560px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.fb-modal__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
}

.fb-modal__title {
	margin: 0;
	font-size: 18px;
}

.fb-modal__close {
	border: none;
	background: none;
	font-size: 20px;
	cursor: pointer;
	color: #666;
}

.fb-modal__body {
	padding: 20px;
}

.fb-modal__footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 16px 20px;
	border-top: 1px solid #eee;
}

/* Pagination */
.fb-pagination {
	display: flex;
	justify-content: center;
	gap: 4px;
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid #eee;
}

.fb-pagination__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
}

.fb-pagination__btn--active {
	background: #333;
	color: #fff;
	border-color: #333;
}

.fb-pagination__btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Empty state */
.fb-empty-state {
	text-align: center;
	padding: 48px 20px;
}

.fb-empty-state__icon {
	font-size: 48px;
	margin-bottom: 16px;
	color: #ccc;
}

.fb-empty-state__message {
	font-size: 16px;
	color: #666;
	margin: 0 0 16px;
}

.fb-empty-state__action {
	display: inline-flex;
}

/* Guest gate */
.fb-guest-gate {
	text-align: center;
	padding: 40px 20px;
	border: 1px solid #eee;
	border-radius: 8px;
}

.fb-guest-gate__message {
	font-size: 16px;
	margin: 0 0 16px;
}

.fb-guest-gate__buttons {
	display: flex;
	gap: 12px;
	justify-content: center;
}

/* Pending verification */
.fb-pending-verification {
	text-align: center;
	padding: 48px 20px;
}

.fb-pending-verification__icon {
	font-size: 56px;
	margin-bottom: 16px;
}

.fb-pending-verification__title {
	font-size: 22px;
	margin: 0 0 12px;
}

.fb-pending-verification__message {
	font-size: 14px;
	color: #666;
	line-height: 1.6;
	max-width: 480px;
	margin: 0 auto;
}

/* Loading spinner */
.fb-loading-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid transparent;
	border-top-color: currentColor;
	border-radius: 50%;
	animation: fb-spin 0.6s linear infinite;
}

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

/* Product card actions */
.fb-product-card__actions {
	display: flex;
	gap: 8px;
	padding: 12px 0 0;
	margin-top: 12px;
	border-top: 1px solid #f3f4f6;
}

.fb-product-card__actions .fb-btn {
	flex: 1;
}

/* Company header actions */
.fb-company-header__actions {
	display: flex;
	gap: 10px;
	align-items: center;
	padding-top: 12px;
	margin-top: 12px;
	border-top: 1px solid #eee;
}

/* Rating sidebar — button style reset for trigger */
.fb-rating-sidebar__write-btn {
	width: 100%;
}

/* Company header layout adjustment for actions row */
.fb-company-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 20px;
}

.fb-company-header__main {
	display: flex;
	align-items: center;
	gap: 16px;
	flex: 1;
	min-width: 0;
}

.fb-company-header__fba {
	flex-shrink: 0;
}

.fb-company-header__actions {
	width: 100%;
	flex-basis: 100%;
}

/* Responsive */
@media (max-width: 640px) {
	.fb-notification-dropdown {
		width: 280px;
	}

	.fb-toast-container {
		left: 10px;
		right: 10px;
	}

	.fb-toast {
		min-width: 0;
		max-width: none;
	}

	.fb-modal {
		width: 95%;
	}

	.fb-company-header__actions {
		flex-direction: column;
	}

	.fb-company-header__actions .fb-btn {
		width: 100%;
	}

	.fb-product-card__actions {
		flex-direction: column;
	}

	.fb-product-card__actions .fb-btn {
		width: 100%;
	}
}
