:root {
  --bg-color: #0d0d12;
  --surface-color: #1a1a24;
  --surface-border: #2d2d3d;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Tajawal', sans-serif;
  --danger: #ef4444;
  --success: #10b981;
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video,
input,
button,
select,
textarea {
  font-family: var(--font-family);
}

.fa,
.fas,
.far,
.fal,
.fad,
.fab,
.fa-solid,
.fa-regular,
.fa-brands,
[class^="fa-"],
[class*=" fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.bg-shape {
  position: fixed;
  top: -20%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(138, 43, 226, 0.08) 0%, rgba(10, 10, 15, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

.bg-shape-2 {
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.06) 0%, rgba(10, 10, 15, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 20px;
}

header {
  text-align: center;
  margin-bottom: 50px;
}

.logo {
  margin-bottom: 8px;
  display: inline-block;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 400;
}

.search-container {
  max-width: 800px;
  margin: 0 auto 40px;
}

.search-wrapper {
  position: relative;
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.search-input {
  flex: 1;
  padding: 18px 25px;
  font-size: 1.1rem;
  background: var(--surface-color);
  border: 2px solid var(--surface-border);
  border-radius: 12px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.search-input::placeholder {
  color: #64748b;
}

.search-btn {
  padding: 0 35px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.advanced-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  background: var(--surface-color);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
}

.input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-group label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.number-input {
  width: 100px;
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-main);
  outline: none;
  text-align: center;
  font-size: 1.1rem;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-input[type=number] {
  -moz-appearance: textfield;
}

.number-input:focus {
  border-color: var(--primary);
}

.categories {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-dark);
}

.card-img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  background: #1a1a24;
  border-bottom: 1px solid var(--surface-border);
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.platform-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 8px;
}

.movie-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
}

.platform-type {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
  margin-right: 10px;
}

.platform-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  flex-grow: 1;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2;
}

.fav-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fav-btn:hover {
  transform: scale(1.1);
}

.fav-btn.active {
  color: var(--danger);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  display: inline-block;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.loader {
  display: none;
  width: 50px;
  height: 50px;
  border: 5px solid var(--surface-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 50px auto;
}

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

.status-msg {
  text-align: center;
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 15px;
  display: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.multi-links {
  display: flex;
  gap: 8px;
}

.multi-links .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 10px 4px;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  grid-column: 1 / -1;
}

.empty-text {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  transform: translateZ(0);
  will-change: opacity;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  contain: content;
}

.modal-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface-border);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ff3366;
}

.iframe-container {
  flex-grow: 1;
  width: 100%;
  background: #000;
  position: relative;
  transform: translateZ(0);
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 768px) {
  .logo {
    font-size: 2.5rem;
  }

  .search-input {
    font-size: 1.1rem;
    padding: 16px 20px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}