/**
 * Filmy Search Styles
 *
 * @package Filmy
 * @author  nevma
 * @link    https://nevma.gr
 */

/* ==========================================================================
   Search Wrapper
   ========================================================================== */

.filmy-search-wrapper {
	position: relative;
	display: inline-block;
	width: 100%;
	max-width: 500px;
	margin-left: 20px;
	margin-top: 25px;
}

.filmy-search-wrapper * {
	box-sizing: border-box;
}

/* ==========================================================================
   Search Form
   ========================================================================== */

.filmy-search-form {
	display: flex;
	align-items: center;
	position: relative;
}

.filmy-search-input {
	flex: 1;
	padding: 12px 55px 12px 20px;
	border: 2px solid #ddd;
	border-radius: 25px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.3s, box-shadow 0.3s;
	background: #fff;
	color: #333;
	min-width: 300px;
	/* Allow text selection */
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
	user-select: text;
}

.filmy-search-input:focus {
	border-color: #fe7900;
	box-shadow: 0 0 0 3px rgba(254, 121, 0, 0.1);
}

.filmy-search-input::placeholder {
	color: #888;
}

.filmy-search-submit {
	background: #fff;
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	margin-left: 10px;
	color: #000;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.3s, transform 0.2s;
	flex-shrink: 0;
}

.filmy-search-submit:hover {
	/* background: #e56d00; */
	transform: scale(1.05);
}

.filmy-search-submit:active {
	transform: scale(0.95);
}

.filmy-search-submit i {
	font-size: 18px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.filmy-search-wrapper.filmy-loading .filmy-search-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20'%3E%3Cstyle%3E.spinner{transform-origin:center;animation:spin 1s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}%3C/style%3E%3Cg class='spinner'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%23fe7900' stroke-width='2' stroke-dasharray='31.4 31.4'/%3E%3C/g%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 15px center;
	background-size: 20px 20px;
}

/* ==========================================================================
   Results Dropdown
   ========================================================================== */

.filmy-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
	max-height: 480px;
	overflow-y: auto;
	z-index: 99999;
	margin-top: 8px;
}

.filmy-search-results::-webkit-scrollbar {
	width: 6px;
}

.filmy-search-results::-webkit-scrollbar-track {
	background: #f5f5f5;
	border-radius: 3px;
}

.filmy-search-results::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

.filmy-search-results::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* ==========================================================================
   Results Sections
   ========================================================================== */

.filmy-results-section {
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
}

.filmy-results-section:last-of-type {
	border-bottom: none;
}

.filmy-results-section h4 {
	padding: 0 16px 8px;
	margin: 0;
	font-size: 11px;
	font-weight: 600;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Icons */
.filmy-icon {
	display: inline-block;
	width: 18px;
	height: 18px;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

.filmy-icon-movie::before {
	content: "🎬";
	font-size: 14px;
}

.filmy-icon-page::before {
	content: "📄";
	font-size: 14px;
}

/* ==========================================================================
   Result Items
   ========================================================================== */

.filmy-results-section ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.filmy-results-section li {
	margin: 0;
	padding: 0;
}

.filmy-results-section li a {
	display: flex;
	align-items: center;
	padding: 10px 16px;
	color: #333;
	text-decoration: none;
	transition: background-color 0.2s;
	gap: 12px;
}

.filmy-results-section li a:hover,
.filmy-results-section li a.filmy-highlighted {
	background: #f8f8f8;
}

/* Thumbnail */
.filmy-thumb {
	width: 48px;
	height: 48px;
	border-radius: 6px;
	overflow: hidden;
	background: #f0f0f0;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.filmy-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.filmy-no-thumb {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.filmy-no-thumb-movie::before {
	content: "🎬";
	font-size: 20px;
	opacity: 0.5;
}

.filmy-no-thumb-page::before {
	content: "📄";
	font-size: 20px;
	opacity: 0.5;
}

/* Info */
.filmy-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.filmy-title {
	font-weight: 500;
	font-size: 14px;
	line-height: 1.3;
	color: #222;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.filmy-year {
	font-size: 12px;
	color: #888;
	margin-top: 3px;
}

/* ==========================================================================
   No Results
   ========================================================================== */

.filmy-no-results {
	padding: 30px 20px;
	text-align: center;
	color: #888;
	font-size: 14px;
}

/* ==========================================================================
   View All Link
   ========================================================================== */

.filmy-view-all {
	padding: 14px 16px;
	text-align: center;
	border-top: 1px solid #f0f0f0;
	background: #fafafa;
	border-radius: 0 0 12px 12px;
}

.filmy-view-all a {
	color: #fe7900;
	text-decoration: none;
	font-weight: 600;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: color 0.2s;
}

.filmy-view-all a:hover {
	color: #e56d00;
}

.filmy-arrow {
	font-size: 16px;
	transition: transform 0.2s;
}

.filmy-view-all a:hover .filmy-arrow {
	transform: translateX(3px);
}

/* ==========================================================================
   Dark Theme (for dark headers)
   ========================================================================== */

.header-dark .filmy-search-input,
#masthead.dark .filmy-search-input {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
	color: #fff;
	border-radius: 30px;
	border: 1px solid;
}

.header-dark .filmy-search-input::placeholder,
#masthead.dark .filmy-search-input::placeholder {
	color: rgba(255, 255, 255, 0.6);
}

.header-dark .filmy-search-input:focus,
#masthead.dark .filmy-search-input:focus {
	background: rgba(255, 255, 255, 0.15);
	border-color: #fff;
}

/* ==========================================================================
   Mobile Styles
   ========================================================================== */

@media screen and (max-width: 768px) {
	.filmy-search-wrapper {
		max-width: 100%;
	}

	.filmy-search-results {
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		max-height: 70vh;
		margin-top: 0;
		border-radius: 20px 20px 0 0;
		border: none;
		box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
	}

	.filmy-search-results::before {
		content: "";
		display: block;
		width: 40px;
		height: 4px;
		background: #ddd;
		border-radius: 2px;
		margin: 12px auto;
	}

	.filmy-thumb {
		width: 56px;
		height: 56px;
	}

	.filmy-title {
		font-size: 15px;
	}

	.filmy-results-section li a {
		padding: 12px 16px;
	}
}

/* Small mobile */
@media screen and (max-width: 480px) {
	.filmy-search-input {
		padding: 10px 16px;
		font-size: 16px; /* Prevent zoom on iOS */
		min-width: 200px;
	}

	.filmy-search-submit {
		width: 36px;
		height: 36px;
		margin-left: 8px;
	}

	.filmy-search-wrapper {
		margin-left: 0;
	}
}

/* ==========================================================================
   Mobile Search Icon (for WP Mobile Menu integration)
   ========================================================================== */

.filmy-mobile-search-icon {
	display: none;
	width: 40px;
	height: 40px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	align-items: center;
	justify-content: center;
}

.filmy-mobile-search-icon i {
	font-size: 20px;
	color: #fff;
}

@media screen and (max-width: 768px) {
	.filmy-mobile-search-icon {
		display: flex;
	}

	/* Hide desktop search on mobile if needed */
	.site-header .filmy-search-wrapper {
		display: none;
	}
}

/* ==========================================================================
   Full Screen Search Overlay (Mobile)
   ========================================================================== */

.filmy-fullscreen-search {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.95);
	z-index: 999999;
	padding: 20px;
	opacity: 0;
	transition: opacity 0.3s;
}

.filmy-fullscreen-search.active {
	display: flex;
	flex-direction: column;
	opacity: 1;
}

.filmy-fullscreen-search .filmy-search-wrapper {
	max-width: 100%;
	margin-top: 60px;
}

.filmy-fullscreen-search .filmy-search-input {
	background: #fff;
	font-size: 18px;
	padding: 16px 24px;
}

.filmy-fullscreen-search .filmy-search-results {
	position: relative;
	margin-top: 20px;
	max-height: calc(100vh - 180px);
}

.filmy-fullscreen-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 30px;
	cursor: pointer;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.filmy-fullscreen-close:hover {
	color: #fe7900;
}

.single-movie .entry-action {
	margin: 0px 0;
	padding: 0px 0;
}
