/* ===========================
   BASE STYLES
=========================== */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #121212;
  color: #fff;
  transition: background 0.3s, color 0.3s;
}

a,
a:visited,
a:hover,
a:active {
  text-decoration: none;
}

/* ===========================
   LAYOUT
=========================== */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* ===========================
   VIDEO CARDS
=========================== */
.video-card {
  background: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  opacity: 1;
  transition: transform 0.3s, box-shadow 0.3s;
}

.video-card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.video-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.video-card.fade-out {
  opacity: 0;
}

/* Duration Overlay */
.duration-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: white;
}

/* Card Info */
.card-info {
  padding: 10px;
}
.card-info h3 {
  font-size: 16px;
  margin: 0 0 5px;
  color: white;
}
.views {
  color: white;
}
.views::before {
  content: "👁️ ";
}

/* ===========================
   SPINNER
=========================== */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s cubic-bezier(1, 0, 0.27, 0.85) infinite;
  margin-bottom: 15px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===========================
   SEARCH BAR
=========================== */
.search-bar {
  padding: 15px;
  text-align: center;
}
.search-bar input {
  width: 50%;
  padding: 10px;
  border-radius: 5px;
  border: none;
}

/* ===========================
   PAGINATION
=========================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  overflow-x: auto; /* Mobile: horizontal scroll */
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pagination::-webkit-scrollbar { height: 4px; }
.pagination::-webkit-scrollbar-track { background: transparent; }
.pagination::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Buttons */
.pagination button,
.pagination .ellipsis {
  min-width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background-color: #f5f5f5;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  flex-shrink: 0;
}
.pagination button:hover:not(.active-page) {
  background-color: #e9e9e9;
  transform: translateY(-1px);
}
.pagination button.active-page {
  background-color: #333;
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 1px 4px 2px rgb(188 9 9);
}
.pagination .ellipsis {
  background-color: transparent;
  color: #999;
  font-weight: bold;
  pointer-events: none;
  margin: 0 6px;
}

/* Arrows */
.pagination .prev-next {
  min-width: 36px;
  height: 36px;
  font-size: 16px;
  background-color: #f0f0f0;
  border-radius: 8px;
  padding: 0;
}
.pagination .prev-next:hover {
  background-color: #e0e0e0;
  transform: translateY(-1px);
}
.pagination button:focus {
  outline: 2px solid #333;
  outline-offset: 2px;
}

/* Pagination container + indicators */
.pagination-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.pagination-indicator {
  display: flex;
  justify-content: space-between;
  margin-top: -12px;
  pointer-events: none;
  opacity: 0.5;
  padding: 0 10px;
}
.indicator-left,
.indicator-right {
  width: 20px;
  height: 16px;
  border-radius: 4px;
}
.indicator-left {
  background: linear-gradient(to right, white, transparent);
}
.indicator-right {
  background: linear-gradient(to left, white, transparent);
}

/* ===========================
   PAGINATION RESPONSIVE
=========================== */
/* Tablet (≥768px) */
@media (min-width: 768px) {
  .pagination {
    overflow-x: visible; /* no scroll */
    justify-content: center;
    font-size: 16px;
  }
  .pagination button,
  .pagination .ellipsis {
    min-width: 50px;
    height: 40px;
    font-size: 16px;
  }
  .pagination .prev-next {
    min-width: 40px;
    height: 40px;
  }
  .pagination-indicator { display: none; } /* hide indicators on tablet+ */
}

/* Desktop (≥1024px) */
@media (min-width: 1024px) {
  .pagination {
    gap: 10px;
    font-size: 18px;
  }
  .pagination button,
  .pagination .ellipsis {
    min-width: 60px;
    height: 44px;
    font-size: 18px;
  }
  .pagination .prev-next {
    min-width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Large screens (≥1440px) */
@media (min-width: 1440px) {
  .pagination {
    gap: 12px;
  }
  .pagination button,
  .pagination .ellipsis {
    min-width: 70px;
    height: 48px;
    font-size: 20px;
  }
  .pagination .prev-next {
    min-width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

/* ===========================
   HEADER
=========================== */
.site-header {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  align-items: center;
  background: #000;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-center { display: flex; justify-content: center; }
.logo {
  width: 350px;
  height: 50px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo img {
  height: 100%;
  width: auto;
  object-fit: cover;
  object-position: center;
}

/* Header buttons */
.search-toggle,
.nav-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.search-toggle { font-size: 22px; display: none; }
.nav-toggle { font-size: 26px; justify-self: end; }

/* Header search */
.header-search {
  grid-column: 1 / 4;
  margin-top: 10px;
}
.header-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 20px;
  border: none;
  outline: none;
  font-size: 14px;
}

/* ===========================
   SIDE MENU
=========================== */
.side-menu {
  position: fixed;
  top: 0;
  right: -260px;
  width: 250px;
  height: 100%;
  background: #222;
  padding: 20px;
  transition: right 0.3s ease;
  z-index: 1100;
  overflow-y: auto;
  visibility: hidden;
}
.side-menu.active { right: 0; visibility: visible; }
.side-menu ul { list-style: none; padding: 0; margin-top: 40px; }
.side-menu ul li { margin: 15px 0; }
.side-menu ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  transition: color 0.3s ease;
}
.side-menu ul li a:hover { color: #ff5252; }
.side-menu .close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 15px;
}

/* ===========================
   OVERLAY
=========================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(97 83 83 / 27%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: none;
  z-index: 1050;
}

/* ===========================
   RESPONSIVE HEADER
=========================== */
@media (max-width: 992px) {
  .logo { width: 280px; height: 40px; }
}
@media (max-width: 768px) {
  .site-header { min-height: 30px; padding: 12px 15px; }
  .header-search { display: none; }
  .search-toggle { display: inline-block; }
  .logo { width: 250px; height: 35px; }
  .nav-toggle { font-size: 24px; }
}
@media (max-width: 480px) {
  .logo { width: 200px; height: 22px; }
  .nav-toggle, .search-toggle { font-size: 20px; }
}
