/* Web3 Style Header CSS */
:root {
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --accent-color: #007bff;
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --web3-primary: #6366f1;
  --web3-secondary: #8b5cf6;
  --web3-accent: #06b6d4;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

[data-theme='light'] {
  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --bg-primary: #f8faff;
  --bg-secondary: #f0f4f8;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.2);
  --glass-border: rgba(255, 255, 255, 0.3);
}

/* Header Styles */
header {
  left: 0;
  right: 0;
  justify-content: space-between;
  z-index: 1000;
  height: 75px;
  width: 100%;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding: 0 1rem;
  box-sizing: border-box;
  position: relative; /* Ensure header is positioned */
}

/* Ensure header elements are above blur overlay */
#contentList,
#mainSearchDiv,
.profile-menu {
  position: relative;
  z-index: 1001; /* Above blur overlay (999) */
}

header.hidden-step1 {
  opacity: 0.6;
  transform: translateY(-5px);
}
header.hidden-step2 {
  opacity: 0.2;
  transform: translateY(-10px);
}
header.hidden-step3 {
  opacity: 0;
  transform: translateY(-15px);
  pointer-events: none;
}

/* Fullscreen header animation - handled by watch.css */
header {
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header nav (ul, li) */
header ul {
  display: flex;
  margin: 0;
  padding: 0;
  flex-grow: 1;
  max-width: 800px;
}
header ul li {
  list-style: none;
  flex-grow: 1;
  height: 50px;
  display: flex;
  justify-content: space-evenly;
}
header ul li figure, header ul li a {
  width: 50px;
  height: 50px;
  margin: 0;
  padding: 0;
}
header ul li a {
  display: block;
}
header #quickLinks { max-width: 200px; }
header #headerMenu {
  filter: invert(1);
  background-size: 90%;
}
header ul li:hover img {
  transform: scale(1.1);
  opacity: 0.5 !important;
}

/* Content List (Left side) */
#contentList {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

#contentList li {
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  background: transparent !important;
  border: none;
  box-shadow: none !important;
}
#contentList li:hover {
  transform: scale(1.2);
}

#contentList figure {
  margin: 0;
  padding: 0;
}

#contentList li img, #contentList li img {
  /* ensure all icon styles are unified throughout */
  width: 30px;
  height: 30px;
  filter: brightness(0) invert(1);
  transition: all 0.3s ease;
  opacity: 0.8;
}

#contentList li img {
  /* fallback filter for non-selected state */
  filter: brightness(0) invert(1);
}

#contentList li.selectedcl img,
#contentList #videos.selectedcl img,
#contentList #images.selectedcl img,
#contentList #sounds.selectedcl img {
  opacity: 1 !important;
}

/* Active tab color filter (alt system) */
#contentList li.active#videos img {
  filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(0deg) brightness(1.2);
}
#contentList li.active#images img {
  filter: brightness(0) invert(1) sepia(1) saturate(10) hue-rotate(50deg) brightness(2);
}
#contentList li.active#sounds img {
  filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(240deg) brightness(1.2);
}

#contentList li:not(.active) {
  opacity: 0.6;
}
#contentList li:not(.active):hover {
  opacity: 0.8;
}

/* New color-coding system (selected-videos, -images, -sounds) */
#contentList li.selected-videos img {
  filter: invert(17%) sepia(99%) saturate(7492%) hue-rotate(357deg) brightness(97%) contrast(119%) !important;
}
#contentList li.selected-images img {
  filter: invert(88%) sepia(80%) saturate(7492%) hue-rotate(1deg) brightness(110%) contrast(110%) !important;
}
#contentList li.selected-sounds img {
  filter: invert(24%) sepia(99%) saturate(7492%) hue-rotate(200deg) brightness(97%) contrast(119%) !important;
}

/* Legacy color-coding system for selectedcl + id  */
#contentList #videos.selectedcl img {
  filter: invert(15%) sepia(90%) saturate(7105%) hue-rotate(356deg) brightness(103%) contrast(120%);
}
#contentList #images.selectedcl img {
  filter: invert(53%) sepia(100%) saturate(526%) hue-rotate(360deg) brightness(103%) contrast(106%);
}
#contentList #sounds.selectedcl img {
  filter: invert(10%) sepia(100%) saturate(6542%) hue-rotate(245deg) brightness(89%) contrast(143%);
}

/* Content type color for icon text if SVG/font icons present */
#contentList #videos { color: #ff4444; transition: all 0.3s ease; }
#contentList #videos.selectedcl {
  background: rgba(255, 68, 68, 0.2);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
  transform: scale(1.1);
}
#contentList #images { color: #ffd700; transition: all 0.3s ease; }
#contentList #images.selectedcl {
  background: rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  transform: scale(1.1);
}
#contentList #sounds { color: #4444ff; transition: all 0.3s ease; }
#contentList #sounds.selectedcl {
  background: rgba(68, 68, 255, 0.2);
  box-shadow: 0 0 15px rgba(68, 68, 255, 0.5);
  transform: scale(1.1);
}

/* Icon hover/selection scaling */
#contentList li:hover img { transform: scale(1.05); }
#contentList li.selectedcl:hover { transform: scale(1.15); }
#contentList li.selected-videos:hover img, 
#contentList li.selected-images:hover img, 
#contentList li.selected-sounds:hover img {
  transform: scale(1.1);
}

/* Ensure selected items remain visually prominent */
#contentList li.selectedcl { opacity: 1 !important; }

/* Search Bar: Rounded, right-aligned */
#mainSearchDiv {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 35px;
  padding: 0.5rem 1.75rem 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  height: 40px;
  box-sizing: border-box;
  flex-direction: row;
  gap: 0;
  margin-left: auto;
  border: solid thin rgba(255, 255, 255, 0.2);
  overflow: hidden;
  box-shadow: none;
  position: relative;
}

/* Mobile search icon button - hidden on desktop */
.mobile-search-icon {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: white;
  font-size: 20px;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 30px;
  min-height: 30px;
}

.mobile-search-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* Content list animation states */
#contentList {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

#contentList.slide-out {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

#mainSearchDiv > form { display: flex; }
#mainSearchDiv:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}
#mainSearchDiv:focus-within {
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}
#mainSearchDiv:active,
#mainSearchDiv:hover,
#mainSearchDiv:focus-within {
  transform: scale(1.05);
}
#mainSearchDiv:has(> #mainSearch:focus) {
  box-shadow: 0 0 15px white;
  border: solid rgba(255, 255, 255, 0.9);
}

/* Search Field */

#searchForm {
  margin: 0;
}
#mainSearch {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 18px;
  width: 80%;
  height: 30px;
  line-height: 1.4;
  flex: 1 1 auto;
  padding: 0 0 0 5px;
}
#mainSearch::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
#mainSearch:focus {
  outline: none;
  border: none;
}

/* Search Button */
#mainSearchButton {
  width: 35px;
  min-width: 35px;
  height: 27px;
  background: transparent;
  border: none;
  cursor: pointer;
  margin-left: 0.3rem;
  padding: 0;
  transition: all 0.3s ease;
  align-self: center;
  box-sizing: border-box;
  filter: invert(100%);
  transform: scaleX(-1);
  display: flex;
  align-items: center;
  justify-content: center;
}
#mainSearch:hover ~ #mainSearchButton {
  transform: scale(1.15) scaleX(-1);
  filter: brightness(1.2) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}
#mainSearchButton:active {
  transform: scale(0.95) scaleX(-1);
}

/* Profile Menu (Right side) */
.profile-menu {
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 20px;
  margin-left: auto;
  position: relative;
  z-index: 1001;
}
.profile-menu:hover { transform: scale(1.05); }
.profile-pic {
  margin-top: 20px;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  object-fit: cover;
  object-position: center;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1001;
}
.profile-menu:hover .profile-pic {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 25px rgba(0, 123, 255, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: scale(1.08);
}
.profile-menu img.profile-pic {
  width: 75px;
  height: 75px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

/* Responsive overrides for profile pic - only apply to watch/vibe/explore pages (head2 header) */
header:has(#contentList) .profile-menu img.profile-pic {
  /* Watch/Vibe/Explore pages - smaller profile pic */
}

@media (max-width: 768px) {
  header:has(#contentList) .profile-menu {
    margin-right: 20px;
    margin-left: auto;
  }
  
  header:has(#contentList) .profile-menu img.profile-pic {
    width: 48px !important;
    height: 48px !important;
  }
}

@media (max-width: 480px) {
  header:has(#contentList) .profile-menu {
    margin-right: 20px;
    margin-left: auto;
  }
  
  header:has(#contentList) .profile-menu img.profile-pic {
    width: 50px !important;
    height: 50px !important;
  }
}

/* Responsive overrides for profile pic to ensure it shrinks on mobile */
@media (max-width: 768px) {
  .profile-menu img.profile-pic {
    width: 35px;
    height: 35px;
  }
}

@media (max-width: 480px) {
  .profile-menu img.profile-pic {
    width: 30px;
    height: 30px;
  }
}

/* Left Side Navigation Buttons - Web3 Style */
.left-nav-buttons {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1001;
}
.prev-btn-web3,
.queue-btn-web3 {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.prev-btn-web3 {
  background: linear-gradient(135deg, var(--web3-primary), var(--web3-secondary));
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.queue-btn-web3 {
  background: linear-gradient(135deg, var(--web3-accent), var(--web3-primary));
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.prev-btn-web3::before,
.queue-btn-web3::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.prev-btn-web3:hover::before,
.queue-btn-web3:hover::before {
  transform: translateX(100%);
}
.prev-btn-web3:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}
.queue-btn-web3:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}
.prev-btn-web3:active {
  transform: translateY(-50%) scale(0.95);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.queue-btn-web3:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.prev-btn-web3 i,
.queue-btn-web3 i {
  font-size: 1.8rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* General layout rules */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
}
main {
  display: flex;
  height: calc(100% - 75px);
}

/* Miscellaneous */
img {
  height: 100%;
  width: 100%;
}

h1 {
  padding: 0;
  margin: 0;
}

#diceAudio { display: none; }

/* Responsive Design */
@media (max-width: 768px) {
  header {
    padding: 0 1rem;
    height: 60px;
    position: relative;
  }
  main {
    height: calc(100% - 60px);
  }
  .left-nav-buttons {
    left: 10px;
    gap: 10px;
  }
  .prev-btn-web3,
  .queue-btn-web3 {
    width: 50px;
    height: 50px;
  }
  .prev-btn-web3 i,
  .queue-btn-web3 i {
    font-size: 1.5rem;
  }
  
  header {
    position: relative;
  }
  
  /* Show mobile search icon, hide search form by default */
  .mobile-search-icon {
    display: flex;
    font-size: 23px;
    padding: 0;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: brightness(0) invert(1);
    opacity: 0.8;
  }
  
  .mobile-search-icon:hover {
    opacity: 1;
    transform: scale(1.1);
  }
  
  #mainSearchDiv:not(.search-active) #searchForm {
    display: none;
  }
  
  #mainSearchDiv:not(.search-active) {
    padding: 0;
    background: transparent !important;
    border: none !important;
    width: auto;
    min-width: auto;
    margin-left: 0;
    height: auto;
    border-radius: 0;
    backdrop-filter: none;
    box-shadow: none;
    position: static;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
  }
  
  /* Make search icon appear inline with contentList */
  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
  }
  
  #contentList {
    display: flex;
    align-items: center;
    margin-right: 8px;
    height: 100%;
    gap: 12px;
  }
  
  #mainSearchDiv:not(.search-active) {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    margin-right: 12px;
    height: 30px;
    width: 30px;
    flex-shrink: 0;
  }
  
  #mainSearchDiv.search-active {
    position: absolute;
    left: 15px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    width: calc(100% - 115px); /* Leave space for profile pic (48px) + left margin (15px) + right margin (15px) */
    max-width: calc(100% - 115px);
    padding: 0.5rem 1rem 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 35px;
    margin-left: 0;
    z-index: 1002;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
    backdrop-filter: blur(10px);
    box-shadow: none;
    height: 40px;
    display: flex !important;
  }
  
  #mainSearchDiv.search-active.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  
  #mainSearchDiv.search-active .mobile-search-icon {
    display: none;
  }
  
  #mainSearchDiv.search-active #searchForm {
    display: flex;
    width: 100%;
  }
  
  #mainSearch {
    width: 100%;
    flex: 1;
  }
  
  .profile-pic {
    width: 45px;
    height: 45px;
    margin-top: 0;
    padding: 1px;
    object-fit: cover;
    object-position: center;
  }
  
  .profile-menu img.profile-pic {
    width: 45px !important;
    height: 45px !important;
  }
  #contentList {
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    height: 100%;
    align-items: center;
    display: flex;
  }
  
  #contentList li { 
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
  }
  
  #contentList img {
    width: 30px;
    height: 30px;
  }
  
  #contentList figure {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    width: 30px;
  }
}
@media (max-width: 480px) {
  header {
    padding: 0 0.5rem;
  }
  .left-nav-buttons {
    left: 5px;
    gap: 8px;
  }
  .prev-btn-web3,
  .queue-btn-web3 {
    width: 45px;
    height: 45px;
  }
  .prev-btn-web3 i,
  .queue-btn-web3 i {
    font-size: 1.3rem;
  }
  
  .profile-menu {
    margin-right: 20px;
    margin-left: auto;
  }
  
  .profile-pic {
    width: 50px !important;
    height: 50px !important;
    margin-top: 0;
    padding: 1px;
    object-fit: cover;
    object-position: center;
  }
  
  .profile-menu img.profile-pic {
    width: 50px !important;
    height: 50px !important;
  }
  
  #mainSearchDiv:not(.search-active) {
    margin-right: 15px;
  }
  
  #contentList {
    gap: 10px;
    height: 100%;
    align-items: center;
    display: flex;
  }
  
  #contentList li {
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #contentList img {
    width: 28px;
    height: 28px;
  }
  
  #contentList figure {
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-search-icon {
    width: 28px;
    height: 28px;
    font-size: 22px;
  }
  
  #mainSearchDiv.search-active {
    left: 12px;
    width: calc(100% - 108px); /* Leave space for profile pic (46px) + left margin (12px) + right margin (12px) */
    max-width: calc(100% - 108px);
    border-radius: 25px;
    padding: 0.4rem 0.8rem 0.4rem 0.8rem;
  }
}
