*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg: #0a0a0f;
	--bg2: #111118;
	--bg3: #18181f;
	--border: rgba(255, 255, 255, 0.07);
	--border2: rgba(255, 255, 255, 0.14);
	--text: #f0eff5;
	--muted: #8884a0;
	--accent: #e8c46a;
	--accent2: #c4729e;
	--gold: #f5c842;
	--red: #e84545;
	--green: #4caf82;
	--radius: 12px;
	--radius-sm: 8px;
}

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: "DM Sans", sans-serif;
	min-height: 100vh;
	overflow-x: hidden;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
	pointer-events: none;
	z-index: 0;
	opacity: 0.6;
}

header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(10, 10, 15, 0.85);
	backdrop-filter: blur(20px);
	border-bottom: 1px solid var(--border);
	padding: 0 2rem;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	font-family: "Bebas Neue", sans-serif;
	font-size: 1.9rem;
	letter-spacing: 0.05em;
	color: var(--text);
	text-decoration: none;
}

.logo span {
	color: var(--accent);
}

nav {
	display: flex;
	gap: 0.25rem;
}

.nav-btn {
	background: none;
	border: none;
	color: var(--muted);
	font-family: "DM Sans", sans-serif;
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	padding: 0.45rem 1rem;
	border-radius: 6px;
	cursor: pointer;
	transition:
		color 0.2s,
		background 0.2s;
	text-transform: uppercase;
}

.nav-btn:hover,
.nav-btn.active {
	color: var(--text);
	background: rgba(255, 255, 255, 0.07);
}

.nav-btn.active {
	color: var(--accent);
}

#hero {
	position: relative;
	height: 520px;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	padding: 3rem 2.5rem;
}

#hero-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center 20%;
	transition: background-image 0.8s ease;
	filter: brightness(0.35) saturate(0.7);
}

#hero-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, var(--bg) 0%, transparent 60%);
}

.hero-content {
	position: relative;
	z-index: 1;
	max-width: 600px;
}

.hero-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: rgba(232, 196, 106, 0.15);
	border: 1px solid rgba(232, 196, 106, 0.3);
	color: var(--accent);
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: 4px;
	margin-bottom: 1rem;
}

.hero-title {
	font-family: "Bebas Neue", sans-serif;
	font-size: clamp(2.4rem, 5vw, 3.8rem);
	line-height: 1.02;
	letter-spacing: 0.02em;
	margin-bottom: 0.75rem;
}

.hero-meta {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
	font-size: 0.85rem;
	color: var(--muted);
}

.hero-meta .rating {
	display: flex;
	align-items: center;
	gap: 5px;
	color: var(--gold);
	font-weight: 500;
}

.hero-overview {
	font-size: 0.9rem;
	line-height: 1.6;
	color: rgba(240, 239, 245, 0.75);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-bottom: 1.5rem;
	max-width: 520px;
}

.hero-actions {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.btn-primary {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--accent);
	color: #0a0a0f;
	border: none;
	font-family: "DM Sans", sans-serif;
	font-weight: 500;
	font-size: 0.88rem;
	padding: 0.65rem 1.4rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition:
		opacity 0.2s,
		transform 0.15s;
}

.btn-primary:hover {
	opacity: 0.88;
	transform: translateY(-1px);
}

.btn-outline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
	border: 1px solid var(--border2);
	font-family: "DM Sans", sans-serif;
	font-weight: 400;
	font-size: 0.88rem;
	padding: 0.65rem 1.4rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition:
		background 0.2s,
		border-color 0.2s;
}

.btn-outline:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: var(--border2);
}

#search-section {
	padding: 2rem 2.5rem 0;
	position: relative;
	z-index: 2;
}

.search-wrap {
	display: flex;
	gap: 0.75rem;
	max-width: 700px;
	margin: 0 auto;
}

.search-input-wrap {
	position: relative;
	flex: 1;
}

.search-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--muted);
	font-size: 1rem;
	pointer-events: none;
}

#search-input {
	width: 100%;
	background: var(--bg2);
	border: 1px solid var(--border);
	color: var(--text);
	font-family: "DM Sans", sans-serif;
	font-size: 0.9rem;
	padding: 0.75rem 1rem 0.75rem 2.75rem;
	border-radius: var(--radius-sm);
	outline: none;
	transition: border-color 0.2s;
}

#search-input:focus {
	border-color: var(--accent);
}
#search-input::placeholder {
	color: var(--muted);
}

.search-btn {
	background: var(--accent);
	color: #0a0a0f;
	border: none;
	font-family: "DM Sans", sans-serif;
	font-weight: 500;
	font-size: 0.88rem;
	padding: 0.75rem 1.5rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.search-btn:hover {
	opacity: 0.88;
}

#genres-section {
	padding: 1.5rem 2.5rem 0;
}

.genres-scroll {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	padding-bottom: 0.5rem;
	scrollbar-width: none;
}

.genres-scroll::-webkit-scrollbar {
	display: none;
}

.genre-pill {
	background: var(--bg2);
	border: 1px solid var(--border);
	color: var(--muted);
	font-family: "DM Sans", sans-serif;
	font-size: 0.8rem;
	font-weight: 400;
	padding: 0.4rem 0.9rem;
	border-radius: 50px;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s;
	flex-shrink: 0;
}

.genre-pill:hover {
	border-color: var(--border2);
	color: var(--text);
}
.genre-pill.active {
	background: rgba(232, 196, 106, 0.12);
	border-color: rgba(232, 196, 106, 0.4);
	color: var(--accent);
}

.section-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	padding: 2rem 2.5rem 1.25rem;
}

.section-title {
	font-family: "Bebas Neue", sans-serif;
	font-size: 1.6rem;
	letter-spacing: 0.04em;
	color: var(--text);
}

.section-count {
	font-size: 0.8rem;
	color: var(--muted);
}

#movies-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 1.25rem;
	padding: 0 2.5rem 3rem;
}

.movie-card {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	cursor: pointer;
	transition:
		transform 0.25s,
		border-color 0.25s,
		box-shadow 0.25s;
	position: relative;
	animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.movie-card:hover {
	transform: translateY(-5px);
	border-color: var(--border2);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.card-poster {
	position: relative;
	aspect-ratio: 2/3;
	overflow: hidden;
	background: var(--bg3);
}

.card-poster img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.movie-card:hover .card-poster img {
	transform: scale(1.05);
}

.card-poster-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	color: var(--muted);
	font-size: 0.75rem;
}

.card-poster-placeholder svg {
	width: 36px;
	height: 36px;
	opacity: 0.3;
}

.card-rating {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba(10, 10, 15, 0.85);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	padding: 3px 7px;
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--gold);
}

.card-rating svg {
	width: 11px;
	height: 11px;
	fill: var(--gold);
}

.card-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(10, 10, 15, 0.95) 0%,
		transparent 50%
	);
	opacity: 0;
	transition: opacity 0.3s;
	display: flex;
	align-items: flex-end;
	padding: 1rem;
}

.movie-card:hover .card-overlay {
	opacity: 1;
}

.overlay-genres {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.overlay-genre-tag {
	background: rgba(232, 196, 106, 0.2);
	border: 1px solid rgba(232, 196, 106, 0.3);
	color: var(--accent);
	font-size: 0.68rem;
	font-weight: 400;
	padding: 2px 7px;
	border-radius: 3px;
}

.card-info {
	padding: 0.75rem 0.9rem 0.9rem;
}

.card-title {
	font-size: 0.88rem;
	font-weight: 500;
	line-height: 1.3;
	margin-bottom: 0.35rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card-year {
	font-size: 0.75rem;
	color: var(--muted);
}

#loader {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 4rem 2.5rem;
	gap: 1rem;
	color: var(--muted);
	font-size: 0.85rem;
}

.spinner {
	width: 36px;
	height: 36px;
	border: 2px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

#modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(8px);
	z-index: 200;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

#modal-overlay.open {
	display: flex;
}

#modal {
	background: var(--bg2);
	border: 1px solid var(--border2);
	border-radius: 16px;
	max-width: 760px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	animation: modalIn 0.3s ease;
	scrollbar-width: thin;
	scrollbar-color: var(--border2) transparent;
}

@keyframes modalIn {
	from {
		opacity: 0;
		transform: scale(0.94) translateY(10px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.modal-top {
	position: relative;
	height: 280px;
	overflow: hidden;
	border-radius: 16px 16px 0 0;
}

#modal-backdrop {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: brightness(0.45) saturate(0.6);
}

.modal-top::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, var(--bg2) 0%, transparent 60%);
}

.modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: rgba(10, 10, 15, 0.7);
	border: 1px solid var(--border2);
	color: var(--text);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.1rem;
	z-index: 2;
	transition: background 0.2s;
}

.modal-close:hover {
	background: rgba(255, 255, 255, 0.12);
}

.modal-body {
	padding: 1.5rem 2rem 2rem;
}

.modal-header {
	display: flex;
	gap: 1.5rem;
	margin-bottom: 1.5rem;
}

#modal-poster {
	width: 110px;
	height: 165px;
	object-fit: cover;
	border-radius: var(--radius-sm);
	flex-shrink: 0;
	margin-top: -60px;
	position: relative;
	z-index: 1;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
	border: 1px solid var(--border2);
}

.modal-info {
	flex: 1;
}

#modal-title {
	font-family: "Bebas Neue", sans-serif;
	font-size: 1.9rem;
	letter-spacing: 0.03em;
	line-height: 1;
	margin-bottom: 0.6rem;
}

.modal-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	font-size: 0.82rem;
	color: var(--muted);
	margin-bottom: 0.75rem;
}

.modal-meta-item {
	display: flex;
	align-items: center;
	gap: 5px;
}

.modal-meta-item svg {
	width: 14px;
	height: 14px;
}

.modal-rating-big {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: rgba(245, 200, 66, 0.12);
	border: 1px solid rgba(245, 200, 66, 0.3);
	color: var(--gold);
	font-size: 0.9rem;
	font-weight: 500;
	padding: 5px 12px;
	border-radius: 6px;
}

.modal-rating-big svg {
	width: 14px;
	height: 14px;
	fill: var(--gold);
}

.modal-genres {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 0.75rem;
}

.modal-genre-tag {
	background: var(--bg3);
	border: 1px solid var(--border);
	color: var(--text);
	font-size: 0.75rem;
	padding: 4px 10px;
	border-radius: 4px;
}

.modal-section-label {
	font-size: 0.72rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 500;
	margin-bottom: 0.5rem;
	margin-top: 1.5rem;
}

#modal-overview {
	font-size: 0.88rem;
	line-height: 1.7;
	color: rgba(240, 239, 245, 0.8);
}

.modal-cast {
	display: flex;
	gap: 0.75rem;
	overflow-x: auto;
	padding-bottom: 0.5rem;
	scrollbar-width: none;
	margin-top: 0.5rem;
}

.modal-cast::-webkit-scrollbar {
	display: none;
}

.cast-card {
	flex-shrink: 0;
	text-align: center;
	width: 72px;
}

.cast-avatar {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--border);
	background: var(--bg3);
	margin: 0 auto 6px;
	display: block;
}

.cast-name {
	font-size: 0.68rem;
	line-height: 1.3;
	color: var(--muted);
}

#pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0 2.5rem 3rem;
}

.page-btn {
	background: var(--bg2);
	border: 1px solid var(--border);
	color: var(--muted);
	font-family: "DM Sans", sans-serif;
	font-size: 0.85rem;
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all 0.2s;
}

.page-btn:hover {
	border-color: var(--border2);
	color: var(--text);
}
.page-btn.active {
	background: var(--accent);
	color: #0a0a0f;
	border-color: var(--accent);
	font-weight: 500;
}
.page-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

#no-results {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 5rem 2.5rem;
	gap: 0.75rem;
	color: var(--muted);
}

#no-results svg {
	width: 48px;
	height: 48px;
	opacity: 0.25;
}

#api-notice {
	background: rgba(232, 69, 69, 0.08);
	border: 1px solid rgba(232, 69, 69, 0.2);
	border-radius: var(--radius-sm);
	padding: 1rem 1.5rem;
	margin: 1.5rem 2.5rem 0;
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	font-size: 0.85rem;
	line-height: 1.5;
}

#api-notice svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--red);
	margin-top: 1px;
}
#api-notice a {
	color: var(--accent);
}

#api-key-form {
	display: flex;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

#api-key-input {
	flex: 1;
	background: var(--bg3);
	border: 1px solid rgba(232, 69, 69, 0.3);
	color: var(--text);
	font-family: "DM Sans", sans-serif;
	font-size: 0.85rem;
	padding: 0.5rem 0.9rem;
	border-radius: 6px;
	outline: none;
}

#api-key-input:focus {
	border-color: var(--accent);
}

#api-key-save {
	background: var(--accent);
	color: #0a0a0f;
	border: none;
	font-family: "DM Sans", sans-serif;
	font-weight: 500;
	font-size: 0.82rem;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
}

#watch-providers {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 10px;
}

.provider-card {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(255, 255, 255, 0.08);
	padding: 8px 12px;
	border-radius: 10px;
}

.provider-card img {
	width: 30px;
	height: 30px;
	border-radius: 8px;
}

#sort-section {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	margin: 20px 40px;
}

#sort-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;

	background: rgba(255, 255, 255, 0.08);
	color: white;
	border: 1px solid rgba(255, 255, 255, 0.12);

	padding: 12px 45px 12px 16px;
	border-radius: 12px;
	font-size: 0.95rem;
	font-weight: 500;
	cursor: pointer;

	backdrop-filter: blur(12px);
	transition: all 0.25s ease;
	outline: none;
	position: relative;
}

#sort-select:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.2);
}

#sort-select:focus {
	border-color: #e50914;
	box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
}

#sort-select option {
	background: #111;
	color: white;
}

@media (max-width: 600px) {
	header {
		padding: 0 1rem;
	}
	nav {
		display: none;
	}
	#hero {
		padding: 2rem 1.25rem;
		height: 420px;
	}
	#search-section,
	#genres-section,
	.section-header,
	#movies-grid,
	#pagination,
	#api-notice {
		padding-left: 1.25rem;
		padding-right: 1.25rem;
	}
	#movies-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 0.9rem;
	}
	.modal-body {
		padding: 1rem 1.25rem 1.5rem;
	}
	#modal-poster {
		width: 90px;
		height: 135px;
	}
	#modal-title {
		font-size: 1.5rem;
	}
}
