/*
Theme Name: ViralPulse
Theme URI: http://viralpulse-theme.local
Author: Antigravity
Author URI: https://github.com/google-deepmind
Description: Modern, mobile-first responsive dark theme inspired by premium viral video content aggregators. Features custom video metaboxes, AJAX live search, and optimized ad layouts.
Version: 1.0.0
Text Domain: viralpulse
*/

/* Reset & Base Variables */
:root {
  --bg-dark: #090a0f;
  --bg-card: #131520;
  --border-color: #1e2235;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --accent: #ff0055;
  --accent-hover: #d90048;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --border-radius: 12px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
  --header-height: 56px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-height);
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

/* 1. Header Layout */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: rgba(9, 10, 15, 0.95);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-toggle {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: none;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Header Search Form */
.search-form-wrap {
  position: relative;
}

.search-field-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 5px 12px;
  width: 240px;
  transition: var(--transition);
}

.search-field-container:focus-within {
  border-color: var(--accent);
  width: 280px;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
}

.search-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* AJAX Search Suggestions Dropdown */
.ajax-search-suggestions {
  position: absolute;
  top: 105%;
  right: 0;
  width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}

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

.suggestion-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.suggestion-thumb {
  width: 50px;
  height: 35px;
  border-radius: 4px;
  object-fit: cover;
  background-color: var(--border-color);
}

.suggestion-title {
  font-size: 12px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-main);
}

/* 2. Scrollable Categories Ribbon */
.categories-nav-wrap {
  width: 100%;
  background-color: rgba(9, 10, 15, 0.85);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 15px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.categories-nav-wrap::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.categories-menu {
  display: flex;
  gap: 10px;
  list-style: none;
  white-space: nowrap;
}

.categories-menu a {
  display: inline-block;
  padding: 6px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.categories-menu a:hover, .categories-menu .current-menu-item a {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 3. Main Workspace Grid */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 15px;
  display: flex;
  gap: 25px;
}

.primary-content {
  flex: 1;
  min-width: 0;
}

/* 4. Viral Cards Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.viral-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.viral-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background-color: #000;
  overflow: hidden;
}

.card-thumb-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.viral-card:hover .card-thumb-wrap img {
  transform: scale(1.05);
}

/* Overlay play button */
.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(255, 0, 85, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  pointer-events: none;
}

.play-overlay span {
  font-size: 28px;
  color: #fff;
  margin-left: 2px; /* Centering offset */
}

.viral-card:hover .play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Badges */
.badge-trending {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 10;
  letter-spacing: 0.5px;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Card Details */
.card-details {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.card-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-meta span .material-icons {
  font-size: 12px;
}

/* 5. Trending Slider / Featured Post */
.trending-featured-wrap {
  margin-bottom: 25px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

.featured-slider {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 15px;
}

.featured-big {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: #000;
  padding-top: 56.25%;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.featured-big img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: var(--transition);
}

.featured-big:hover img {
  transform: scale(1.02);
  opacity: 0.8;
}

.featured-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 25px 20px;
  background: linear-gradient(to top, rgba(9, 10, 15, 0.95) 0%, rgba(9, 10, 15, 0.4) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.featured-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.featured-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* 6. Post Detail Page Layout */
.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background-color: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.player-container iframe, .player-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.post-header {
  margin-bottom: 20px;
}

.post-header-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  margin-bottom: 8px;
}

.post-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.post-views {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-buttons-container {
  display: flex;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: none;
}

.share-fb { background-color: #3b5998; }
.share-tw { background-color: #1da1f2; }
.share-wa { background-color: #25d366; }

.share-btn .material-icons {
  font-size: 16px;
}

.post-description {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
  background-color: var(--bg-card);
  padding: 15px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: 25px;
}

/* Related section */
.related-posts-section {
  margin-top: 35px;
}

/* 7. Sidebars & Widgets */
.sidebar-content {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 15px;
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 15px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  color: #fff;
}

/* Sidebar List posts */
.sidebar-list-posts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-post-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sidebar-post-thumb {
  width: 80px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  background-color: var(--border-color);
  flex-shrink: 0;
}

.sidebar-post-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-post-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-post-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Ad placeholder widget */
.ad-banner-widget {
  min-height: 250px;
  background-color: rgba(30, 34, 53, 0.4);
  border: 1px dashed var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 8. Footer Layout */
.site-footer {
  background-color: rgba(9, 10, 15, 0.98);
  border-top: 1px solid var(--border-color);
  padding: 30px 15px;
  margin-top: 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  list-style: none;
  margin-bottom: 15px;
}

.footer-links a:hover {
  color: var(--accent);
}

/* 9. Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 35px;
}

.pagination a, .pagination span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pagination .current, .pagination a:hover {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 10. Drawer Mobile Navigation menu */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background-color: var(--bg-sidebar, #131520);
  border-right: 1px solid var(--border-color);
  z-index: 2000;
  transition: left var(--transition);
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-shadow: var(--shadow);
}

.mobile-nav-drawer.open {
  left: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.drawer-header h3 {
  font-weight: 800;
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.drawer-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.drawer-menu a:hover, .drawer-menu .current-menu-item a {
  color: var(--accent);
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.6);
  z-index: 1999;
  display: none;
}

/* 11. Mobile Responsiveness */
@media (max-width: 991px) {
  .main-wrapper {
    flex-direction: column;
  }
  
  .sidebar-content {
    width: 100%;
  }

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

  .featured-sidebar {
    display: none; /* Hide minor featured cards on mobile */
  }
}

@media (max-width: 768px) {
  body {
    padding-top: calc(var(--header-height) + 40px); /* Add space for horizontal category strip */
  }

  .site-header {
    height: var(--header-height);
  }

  .categories-nav-wrap {
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 999;
    height: 40px;
    padding: 6px 10px;
  }

  .menu-toggle {
    display: block;
  }

  .posts-grid {
    grid-template-columns: repeat(2, 1fr); /* 2-column layout on mobile */
    gap: 12px;
  }

  .card-details {
    padding: 8px;
    gap: 4px;
  }

  .card-title {
    font-size: 12px;
  }

  .card-category {
    font-size: 9px;
  }

  .card-meta {
    font-size: 9px;
  }

  .play-overlay {
    width: 40px;
    height: 40px;
  }

  .play-overlay span {
    font-size: 20px;
  }

  .featured-title {
    font-size: 16px;
  }

  .search-field-container {
    width: 150px;
  }

  .search-field-container:focus-within {
    width: 180px;
  }
}
