/* Import Google Font and Font Awesome */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css');

/* Root Variables */
:root {
  --primary-color: #1877f2;
  --background-color: #18191a;
  --text-color: #e4e6eb;
  --subtext-color: #b0b3b8;
  --white: #242526;
  --shadow: 0 2px 8px rgba(255, 255, 255, 0.05);
}

/* Reset & Base */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}

/* Header */
header {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 24px;
}

.header-content a {
  text-decoration: none;
  color: var(--white);
  display: flex;
  align-items: center;
}

.site-logo {
  height: 50px;
  width: auto;
  border-radius: 6px;
}

/* Hamburger Menu */
.hamburger-menu {
  position: relative;
  display: inline-block;
}

#menu-toggle {
  all: unset;
  font-size: 28px;
  color: white !important;
  cursor: pointer;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#menu-toggle:hover {
  transform: scale(1.1);
}

#menu-items {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 12px;
  background-color: #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  min-width: 200px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease;
  z-index: 1000;
}

#menu-items.show {
  display: block;
}

#menu-items a {
  display: block;
  padding: 14px 20px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #3a3a3a;
  transition: background 0.2s;
  font-size: 14px;
}

#menu-items a:hover {
  background-color: #3b3b3b;
}

/* Search Bar - Improved for Mobile */
.search-bar {
  position: relative;
  margin: 20px auto;
  max-width: 600px;
  display: flex;
  z-index: 10;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

.search-bar input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid var(--primary-color);
  border-right: none;
  border-radius: 4px 0 0 4px;
  outline: none;
  background-color: var(--white);
  color: var(--text-color);
  min-width: 0;
}

.search-bar button {
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 0 4px 4px 0;
  color: #2a2a2a;
  font-weight: 700;
  padding: 0 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Dropdown Suggestions */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 20px;
  right: 20px;
  background: var(--white);
  border: 2px solid var(--primary-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  z-index: 20;
  display: none;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.search-dropdown.show {
  display: block;
}

.dropdown-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid #333;
  color: var(--text-color);
  font-size: 15px;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--primary-color);
  color: white;
  padding-left: 20px;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown::-webkit-scrollbar {
  width: 8px;
}
.search-dropdown::-webkit-scrollbar-track {
  background: #2a2a2a;
}
.search-dropdown::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}
.search-dropdown::-webkit-scrollbar-thumb:hover {
  background: #145dbf;
}

/* Videos Container */
.videos-container {
  max-width: 1200px;
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 0 20px;
}

/* Video Card */
.video-card {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.video-card:hover {
  transform: translateY(-5px);
}

/* Image */
.video-card img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  object-position: center;
  background: #111;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}

/* Video Info */
.video-info {
  padding: 12px 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.video-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

/* Pagination */
.pagination {
  text-align: center;
  margin: 40px 0 60px;
  padding: 15px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  position: relative;
  z-index: 30;
  background: var(--background-color);
}

.pagination a,
.pagination span.active {
  display: inline-block;
  padding: 10px 15px;
  text-decoration: none;
  font-weight: bold;
  color: var(--primary-color);
  background: var(--white);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.pagination a:hover,
.pagination span.active {
  background: var(--primary-color);
  color: var(--white);
}

/* Trending & Hottest Buttons */
.header-nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  text-decoration: none !important;
  transition: transform 0.3s ease;
}

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

.nav-icon-btn i { 
  color: #fff !important;
}

.hidden { display: none; }

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 768px) {
  header {
    padding: 12px 15px;
  }

  .search-bar {
    padding: 0 15px;
    margin: 15px auto;
  }

  .search-bar input[type="text"] {
    padding: 11px 14px;
    font-size: 15.5px;
  }

  .search-bar button {
    padding: 0 18px;
  }

  .videos-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 0 12px;
  }

  .video-card img {
    max-height: 200px;
  }

  .video-title {
    font-size: 15.5px;
  }
}

@media (max-width: 480px) {
  .search-bar {
    padding: 0 12px;
    margin: 12px auto;
  }

  .search-bar input[type="text"] {
    font-size: 15px;
    padding: 10px 12px;
  }

  .search-bar button {
    padding: 0 16px;
  }

  .videos-container {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 12px;
  }

  .video-card img {
    max-height: 180px;
  }

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}