/* --- UNIVERSAL HEADER (ALWAYS PILL SHAPE) --- */
.universal-header {
  position: fixed; 
  top: 20px; 
  left: 0; 
  right: 0; 
  margin: 0 auto; 
  width: 92%; 
  max-width: 1450px; 
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  
  /* OFF-SCROLL: Solid dark background */
  background: #0A0A0B; 
  border-radius: 50px; 
  border: 1px solid rgba(255, 255, 255, 0.05); 
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  
  transition: background 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* --- ZAIRAKU-STYLE GLASSY EFFECT (ON SCROLL) --- */
.universal-header.scrolled {
  background: rgba(10, 10, 11, 0.55); 
  backdrop-filter: blur(28px); 
  -webkit-backdrop-filter: blur(28px); 
  border: 1px solid rgba(255, 255, 255, 0.12); 
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7); 
}

/* Mobile Adjustments */
@media (max-width: 1100px) {
  .universal-header {
    width: 94%;
    padding: 10px 16px;
    top: 15px;
  }
}

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

.menu-toggle {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 35px;
  width: auto;
  border-radius: 6px;
  filter: drop-shadow(0 0 10px rgba(147, 51, 234, 0.5));
}

/* --- HEADER SEARCH BAR --- */
.header-search {
  width: 100%;
  max-width: 350px; 
  margin-left: auto; 
  margin-right: 20px; 
  position: relative;
  display: flex;
  align-items: center;
}

.header-search input {
  width: 100%;
  padding: 10px 15px 10px 42px; /* Space for the absolute icon */
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: 0.3s;
}

.header-search input:focus {
  outline: none;
  background: rgba(0,0,0,0.6);
  border-color: #8b5cf6;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* Fix icon exactly vertically centered on the left */
.search-icon-left {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* Prevents icon from blocking input clicks */
}

/* Live Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 15px);
  left: 0;
  right: 0;
  background: #0A0A0B;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow: hidden;
  display: none; 
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  z-index: 200;
}

.search-dropdown.active {
  display: flex;
}

.live-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

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

.live-result-item:hover {
  background: rgba(139, 92, 246, 0.15);
}

.live-result-item img {
  width: 45px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.live-result-item h4 {
  font-size: 13px;
  color: #fff;
  margin: 0;
  font-weight: 600;
}

.advanced-search-btn {
  padding: 12px;
  text-align: center;
  color: #a855f7;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: 0.2s;
}
.advanced-search-btn:hover { color: #fff; background: rgba(139, 92, 246, 0.2); }

/* Bookmark Button */
.bookmark-btn {
    background: #8b5cf6;
    color: #fff;
    padding: 10px 15px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0px;
    transition: 0.2s;
    white-space: nowrap;
}

.bookmark-btn:hover {
  background: #7c3aed;
  transform: scale(1.05);
}

/* =========================================
   MOBILE SEARCH TOGGLE (DESKTOP DEFAULT)
========================================= */
.mobile-search-toggle {
  display: none; 
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  margin-left: auto;
  margin-right: 15px;
}

/* =========================================
   MOBILE SPECIFICS & EXTREME DARK GLASS BAR
========================================= */
@media (max-width: 768px) {
  #continueWatchingSection .swimlane-controls { display: none; }
  .mobile-search-toggle { display: flex; }
  
  .header-search {
    position: absolute;
    top: 70px;
    left: 4%;
    right: 4%;
    width: 92%;
    max-width: 100%;
    margin: 0;
    display: none; 
    z-index: 250; 
  }

  .header-search input {
    background: rgba(5, 5, 8, 0.85) !important;
    backdrop-filter: blur(40px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(150%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
    padding: 14px 15px 14px 45px;
    font-size: 15px;
    color: #ffffff !important;
    transition: all 0.3s ease;
  }
  
  .header-search input:focus {
    background: rgba(2, 2, 5, 0.94) !important;
    backdrop-filter: blur(50px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(50px) saturate(150%) !important;
    border: 1px solid rgba(139, 92, 246, 0.9) !important;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.4), 0 20px 50px rgba(0, 0, 0, 0.9) !important;
    outline: none;
  }
  
  .header-search.mobile-active {
    display: flex; /* Changed to flex to keep icon centered */
    animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  }
}

/* =========================================
   GLOBAL ANIMATIONS
========================================= */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- PREFIXED SIDEBAR MENU --- */
.univ-sidebar-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 199; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.univ-sidebar-overlay.active { opacity: 1; pointer-events: all; }

.univ-sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; background: #0A0A0B; z-index: 200; transition: left 0.3s ease; display: flex; flex-direction: column; box-shadow: 10px 0 30px rgba(0,0,0,0.5); border-right: 1px solid rgba(255, 255, 255, 0.05); }
.univ-sidebar.active { left: 0; }

.univ-sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.univ-sidebar-header h2 { font-size: 20px; color: #a855f7; margin: 0; }

.univ-close-menu { background: transparent; border: none; color: #fff; cursor: pointer; }

.univ-sidebar-menu { padding: 15px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }

.univ-menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 15px; color: #a1a1aa; text-decoration: none; border-radius: 12px; font-weight: 600; font-size: 15px; transition: 0.2s; }
.univ-menu-item:hover { background: rgba(139, 92, 246, 0.15); color: #fff; }

.univ-menu-item.univ-label-btn { background: rgba(255,255,255,0.03); border: 1px solid rgba(255, 255, 255, 0.05); margin-bottom: 5px; }
.univ-menu-item.univ-label-btn:hover { background: rgba(139, 92, 246, 0.2); border-color: #8b5cf6; }

.univ-menu-divider { height: 1px; background: rgba(255, 255, 255, 0.05); margin: 10px 0; }

/* =========================================
   HEADER & SIDEBAR SVG STYLING & ANIMATIONS
========================================= */

/* Generic SVG wrapper */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Sizing the SVG elements globally */
.svg-icon svg {
  width: 18px;
  height: 18px;
  color: currentColor; 
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

/* Specific Adjustments */
.menu-toggle .svg-icon svg,
.univ-close-menu .svg-icon svg {
  width: 22px;
  height: 22px;
}

.mobile-search-toggle .svg-icon svg {
  width: 20px;
  height: 20px;
}

.search-icon-left svg {
  width: 18px;
  height: 18px;
  margin-right: 0px; /* Reset margin for absolute positioning */
  color: #a1a1aa; 
}

/* Bookmark Icon adjustment (Bigger for Solid Fill) */
.bookmark-btn .svg-icon svg {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}

/* Sidebar Menu Icons */
.univ-menu-item .svg-icon svg {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  color: #a1a1aa;
}

/* --- REFINED SVG ANIMATIONS (Replaced old 'i' tags) --- */

.menu-toggle .svg-icon svg, 
.mobile-search-toggle .svg-icon svg, 
.univ-close-menu .svg-icon svg {
  color: rgba(255, 255, 255, 0.85); 
}

.menu-toggle:hover .svg-icon svg {
  transform: scale(1.15);
  color: #8b5cf6; 
}
.menu-toggle:active .svg-icon svg {
  transform: scale(0.9); 
}

.mobile-search-toggle:hover .svg-icon svg {
  transform: scale(1.15) rotate(10deg); 
  color: #8b5cf6;
}
.mobile-search-toggle:active .svg-icon svg {
  transform: scale(0.9);
}

.univ-close-menu:hover .svg-icon svg {
  transform: rotate(90deg) scale(1.1); 
  color: #ef4444; 
}

/* SEARCH ANIMATION: When user clicks inside the search box */
.header-search:focus-within .search-icon-left svg {
  color: #8b5cf6;
  transform: scale(1.15); 
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5)); 
}

/* SIDEBAR HOVER ANIMATION */
.univ-menu-item:hover .svg-icon svg {
  transform: translateX(4px); 
  color: #8b5cf6; 
}