/* ==========================================================================
   Instant Search Modal
   ========================================================================== */

.is-modal-open { overflow: hidden; }

/* Overlay */
.search-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 12vh;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 200ms ease, visibility 200ms ease;
}

.search-modal.is-open {
	opacity: 1;
	visibility: visible;
}

/* Container */
.search-modal__inner {
	width: 100%;
	max-width: 640px;
	padding: 0 1rem;
	transform: translateY(-12px) scale(0.98);
	transition: transform 200ms ease;
}

.search-modal.is-open .search-modal__inner {
	transform: translateY(0) scale(1);
}

/* Search Box */
.search-modal__box {
	background: #18181f;
	border: 1px solid #2a2a3a;
	border-radius: 16px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03);
	overflow: hidden;
}

/* Input Row */
.search-modal__input-row {
	display: flex;
	align-items: center;
	padding: 0 20px;
	gap: 12px;
	height: 56px;
}

.search-modal__icon {
	flex-shrink: 0;
	color: #5c5c72;
	transition: color 150ms ease;
}

.search-modal__input-row:focus-within .search-modal__icon {
	color: #e94560;
}

.search-modal__input {
	flex: 1;
	background: none;
	border: none;
	outline: none;
	font-size: 1rem;
	font-family: inherit;
	color: #f0f0f5;
	caret-color: #e94560;
}

.search-modal__input::placeholder {
	color: #5c5c72;
}

.search-modal__kbd {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 2px;
}

.search-modal__kbd kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	font-size: 16px;
	font-family: inherit;
	color: #5c5c72;
	background: #111118;
	border: 1px solid #2a2a3a;
	border-radius: 6px;
	line-height: 1;
}

/* Close Button */
.search-modal__close {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: none;
	border: 1px solid #2a2a3a;
	border-radius: 8px;
	color: #5c5c72;
	cursor: pointer;
	transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.search-modal__close:hover {
	color: #e94560;
	background: rgba(233, 69, 96, 0.1);
	border-color: rgba(233, 69, 96, 0.3);
}

/* Divider */
.search-modal__divider {
	height: 1px;
	background: #2a2a3a;
	margin: 0;
}

/* Results Area */
.search-modal__results {
	max-height: 420px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #2a2a3a transparent;
}

.search-modal__results::-webkit-scrollbar { width: 6px; }
.search-modal__results::-webkit-scrollbar-track { background: transparent; }
.search-modal__results::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 3px; }

/* Section Labels */
.search-modal__section {
	padding: 12px 20px 6px;
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #5c5c72;
}

/* Result Item */
.search-modal__item {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 12px 20px;
	cursor: pointer;
	transition: background 100ms ease;
	text-decoration: none;
	color: inherit;
}

.search-modal__item:hover,
.search-modal__item.is-active {
	background: rgba(233, 69, 96, 0.06);
}

.search-modal__item.is-active {
	outline: none;
}

/* Thumbnail */
.search-modal__thumb {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: cover;
	background: #111118;
}

.search-modal__thumb--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #111118;
	color: #3a3a4a;
}

/* Content */
.search-modal__content {
	flex: 1;
	min-width: 0;
}

.search-modal__title {
	font-size: 16px;
	font-weight: 600;
	color: #f0f0f5;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.search-modal__excerpt {
	font-size: 16px;
	color: #8888a0;
	line-height: 1.5;
	margin-top: 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.search-modal__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	font-size: 16px;
	color: #5c5c72;
}

.search-modal__meta-dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: #3a3a4a;
	flex-shrink: 0;
}

/* Highlight */
.search-modal__highlight {
	color: #e94560;
	background: rgba(233, 69, 96, 0.12);
	border-radius: 2px;
	padding: 0 2px;
}

/* Arrow indicator */
.search-modal__arrow {
	flex-shrink: 0;
	align-self: center;
	opacity: 0;
	transition: opacity 150ms ease;
	color: #5c5c72;
}

.search-modal__item.is-active .search-modal__arrow {
	opacity: 1;
}

/* Recent Search Item */
.search-modal__recent {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 20px;
	cursor: pointer;
	transition: background 100ms ease;
}

.search-modal__recent:hover,
.search-modal__recent.is-active {
	background: rgba(233, 69, 96, 0.06);
}

.search-modal__recent-icon {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	background: #111118;
	color: #5c5c72;
}

.search-modal__recent:hover .search-modal__recent-icon,
.search-modal__recent.is-active .search-modal__recent-icon {
	color: #e94560;
}

.search-modal__recent-text {
	flex: 1;
	font-size: 16px;
	color: #c8c8d4;
}

.search-modal__recent-remove {
	flex-shrink: 0;
	padding: 4px;
	background: none;
	border: none;
	color: #3a3a4a;
	cursor: pointer;
	border-radius: 4px;
	transition: color 150ms ease, background 150ms ease;
}

.search-modal__recent-remove:hover {
	color: #e94560;
	background: rgba(233, 69, 96, 0.1);
}

/* View All */
.search-modal__view-all {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	font-size: 16px;
	font-weight: 500;
	color: #e94560;
	text-decoration: none;
	border-top: 1px solid #2a2a3a;
	transition: background 100ms ease;
}

.search-modal__view-all:hover {
	background: rgba(233, 69, 96, 0.06);
}

/* States */
.search-modal__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 32px 20px;
	color: #8888a0;
	font-size: 16px;
}

.search-modal__spinner {
	width: 18px;
	height: 18px;
	border: 2px solid #2a2a3a;
	border-top-color: #e94560;
	border-radius: 50%;
	animation: search-spin 600ms linear infinite;
}

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

.search-modal__empty {
	text-align: center;
	padding: 40px 20px;
}

.search-modal__empty-icon {
	margin-bottom: 12px;
	color: #3a3a4a;
}

.search-modal__empty-title {
	font-size: 16px;
	font-weight: 600;
	color: #8888a0;
	margin-bottom: 4px;
}

.search-modal__empty-desc {
	font-size: 16px;
	color: #5c5c72;
}

/* Footer */
.search-modal__footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 10px 20px;
	border-top: 1px solid #2a2a3a;
	font-size: 16px;
	color: #5c5c72;
}

.search-modal__footer kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	font-size: 16px;
	font-family: inherit;
	color: #5c5c72;
	background: #111118;
	border: 1px solid #2a2a3a;
	border-radius: 4px;
	margin-right: 4px;
}

/* Mobile */
@media (max-width: 768px) {
	.search-modal {
		padding-top: 0;
		align-items: flex-start;
	}

	.search-modal__inner {
		max-width: 100%;
		padding: 0;
	}

	.search-modal__box {
		border-radius: 0;
		min-height: 100vh;
		border: none;
	}

	.search-modal__results {
		max-height: none;
	}

	.search-modal__kbd { display: none; }

	.search-modal__footer kbd:nth-child(3) { display: none; }
}
