/* =========================================
   1. CSS VARIABLES (THEME & DESIGN TOKENS)
   ========================================= */
:root {
  --bg: #050510;
  --card-bg: rgba(12, 12, 22, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --pink: #e61e4d;
  --purple: #a020f0;
  --text: #f5f1f7;
  --text-muted: #b0a7bd;
  --radius: 22px;
  --telegram-blue: #0088cc;
}

/* =========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--bg);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.5rem;
  position: relative;
  overflow-x: hidden;
  background-image:
    radial-gradient(
      ellipse 70% 55% at 30% 20%,
      rgba(230, 30, 77, 0.06) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 50% at 80% 70%,
      rgba(160, 32, 240, 0.04) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 45% 40% at 50% 80%,
      rgba(255, 70, 110, 0.03) 0%,
      transparent 60%
    );
  background-attachment: fixed;
}

/* =========================================
   3. BACKGROUND ANIMATIONS (GLOW ORBS)
   ========================================= */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  animation: orbFloat 14s ease-in-out infinite;
}
.orb-1 {
  width: 50vw;
  height: 50vw;
  max-width: 500px;
  max-height: 500px;
  background: radial-gradient(circle, rgba(230, 30, 77, 0.25) 0%, rgba(230, 30, 77, 0) 70%);
  top: -12%;
  left: -8%;
}
.orb-2 {
  width: 40vw;
  height: 40vw;
  max-width: 400px;
  max-height: 400px;
  background: radial-gradient(circle, rgba(160, 32, 240, 0.25) 0%, rgba(160, 32, 240, 0) 70%);
  bottom: -10%;
  right: -6%;
  animation-delay: -6s;
}
@keyframes orbFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(25px, -25px) scale(1.04);
  }
}

/* =========================================
   4. LAYOUT & GRID SYSTEM
   ========================================= */
.container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  animation: fadeUp 0.7s ease forwards;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   5. HEADER & BRANDING (LOGO + SEARCH)
   ========================================= */
.header-section {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  transition:
    transform 0.3s,
    filter 0.3s;
}
.logo-link:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 18px rgba(255, 56, 96, 0.6));
}
.logo-svg {
  width: 44px;
  height: 44px;
}
.logo-text {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #f0edf2, #d4c0e2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search Bar Styles */
.search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 250px;
}
.search-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  border-radius: 40px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.search-input::placeholder {
  color: var(--text-muted);
}
.search-input:focus {
  border-color: rgba(230, 30, 77, 0.5);
  box-shadow: 0 0 20px rgba(230, 30, 77, 0.2), inset 0 0 0 1px rgba(230, 30, 77, 0.2);
  background: rgba(20, 20, 35, 0.7);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s ease;
  z-index: 5;
}
.search-input:focus + .search-icon, 
.search-input:focus ~ .search-icon {
  color: var(--pink);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: rgba(12, 12, 22, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(230, 30, 77, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(230, 30, 77, 0.2);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.show {
  transform: translateX(0);
  opacity: 1;
}
.toast-icon {
  width: 20px;
  height: 20px;
  fill: #0088cc;
}

.video-grid {
  display: grid;
  /* Changed from auto-fit to auto-fill to prevent cards from becoming huge on search */
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.8rem;
  width: 100%;
}

/* =========================================
   6. COMPONENT: VIDEO CARDS
   ========================================= */
/* Base video card styling with glassmorphism */
.video-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s;
  display: flex;
  flex-direction: column;
  will-change: transform;
  position: relative;
}
@media (hover: hover) and (pointer: fine) {
  .video-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
      0 20px 45px rgba(0, 0, 0, 0.6),
      0 0 30px rgba(230, 30, 77, 0.25);
  }
}
.video-card::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius) + 2px);
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(255, 56, 96, 0.5),
    rgba(160, 32, 240, 0.5),
    rgba(255, 56, 96, 0.2)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  z-index: 5;
}
@media (hover: hover) and (pointer: fine) {
  .video-card:hover::after {
    opacity: 1;
  }
}

/* Highlighted Telegram card */
.video-card.telegram-highlight {
  background: linear-gradient(
    135deg,
    rgba(0, 136, 204, 0.15) 0%,
    rgba(160, 32, 240, 0.12) 100%
  );
  border: 1px solid rgba(0, 136, 204, 0.25);
  box-shadow:
    0 0 30px rgba(0, 136, 204, 0.25),
    0 12px 30px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s,
    border-color 0.35s;
}
@media (hover: hover) and (pointer: fine) {
  .video-card.telegram-highlight:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(0, 136, 204, 0.5);
    box-shadow:
      0 0 50px rgba(0, 136, 204, 0.45),
      0 20px 45px rgba(0, 0, 0, 0.6);
  }
}
/* Different glow ring for Telegram card */
.video-card.telegram-highlight::after {
  background: linear-gradient(
    135deg,
    rgba(0, 136, 204, 0.7),
    rgba(160, 32, 240, 0.6),
    rgba(0, 136, 204, 0.4)
  );
}

/* =========================================
   7. COMPONENT: CARD THUMBNAIL & SKELETON
   ========================================= */
.card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #141420;
  cursor: pointer;
}
/* Skeleton Shimmer Effect */
.card-img::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
  z-index: 1;
}
@keyframes shimmer {
  100% { transform: translateX(100%); }
}
.card-img.loaded::before {
  display: none;
  animation: none;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, opacity 0.3s ease;
  will-change: transform;
  opacity: 0;
}
.card-img.loaded img {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .video-card:hover .card-img img {
    transform: scale(1.06);
  }
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 30px rgba(255, 56, 96, 0.35);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 2;
}
.play-overlay::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 16px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
}
@media (hover: hover) and (pointer: fine) {
  .video-card:hover .play-overlay {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 45px rgba(255, 56, 96, 0.55);
    transform: translate(-50%, -50%) scale(1.08);
  }
}
/* Telegram card might not need the play overlay – we can hide it or replace with a custom overlay? */
.telegram-highlight .play-overlay {
  display: none; /* No play triangle on the Telegram card */
}

.card-body {
  padding: 1.2rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  z-index: 2;
}
.card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.3;
}
.telegram-highlight .card-title {
  color: #d4f0ff;
}

/* =========================================
   8. COMPONENT: WATCH BUTTONS & EFFECTS
   ========================================= */
.btn-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem 0.7rem 1rem;
  background: linear-gradient(135deg, #e61e4d, #a020f0);
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 18px rgba(230, 30, 77, 0.4);
  position: relative;
  overflow: hidden;
  will-change: transform;
}
/* Sweeping Light Effect (Shine) */
.btn-watch::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  animation: sweep 4s infinite;
}
@keyframes sweep {
  0% { left: -100%; }
  20%, 100% { left: 200%; }
}
@media (hover: hover) and (pointer: fine) {
  .btn-watch:hover {
    transform: scale(1.04) translateY(-2px);
    box-shadow:
      0 12px 28px rgba(230, 30, 77, 0.55),
      0 0 45px rgba(160, 32, 240, 0.3);
    background: linear-gradient(135deg, #ff2d5e, #b620e6);
  }
}
/* Telegram button styles */
.telegram-highlight .btn-watch {
  background: linear-gradient(135deg, #0088cc, #006699);
  box-shadow: 0 6px 18px rgba(0, 136, 204, 0.4);
}
@media (hover: hover) and (pointer: fine) {
  .telegram-highlight .btn-watch:hover {
    background: linear-gradient(135deg, #0099e6, #0088cc);
    box-shadow:
      0 12px 28px rgba(0, 136, 204, 0.6),
      0 0 45px rgba(0, 136, 204, 0.4);
  }
}

.btn-watch svg {
  width: 16px;
  height: 16px;
  fill: white;
  flex-shrink: 0;
  transition: transform 0.25s;
}
@media (hover: hover) and (pointer: fine) {
  .btn-watch:hover svg {
    transform: scale(1.2);
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}
@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* =========================================
   9. MOBILE RESPONSIVE QUERIES
   ========================================= */
@media (max-width: 600px) {
  .header-section {
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
  }
  .search-container {
    max-width: 100%;
    width: 100%;
  }
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
  .toast {
    width: 100%;
    justify-content: center;
  }
  body {
    padding: 1.5rem 1rem;
  }
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    justify-content: center;
    gap: 1.3rem;
  }
  .logo-svg {
    width: 36px;
    height: 36px;
  }
  .logo-text {
    font-size: 1.2rem;
  }
  .card-body {
    padding: 1rem;
  }
  .btn-watch {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
  .play-overlay {
    width: 44px;
    height: 44px;
  }
  .play-overlay::before {
    border-width: 7px 0 7px 12px;
  }
}

/* =========================================
   10. INFINITE SCROLL LOADER
   ========================================= */
.loader-container {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
  padding: 2rem 0;
  margin-top: 1rem;
}
.loader-container.active {
  display: flex;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 56, 96, 0.15);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
