/* ===== NAVIGATION STYLES ===== */

/* Header Styles */
header {
  background-color: var(--color-light);
  box-shadow: var(--shadow-sm);
  position: sticky;
  height: 100px;
  top: 0;
  z-index: 100;
  transition: all var(--transition-normal);
}

header.shrink {
  padding: var(--space-xs) 0;
}

.header-content {
  display: flex;
  flex-direction: column;
  height: 100px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  padding-bottom: 0;
}

.logo-button {
  height: 80px;
  margin-top: auto;
  margin-bottom: 0;
}

.logo-button img {
  height: 100px;
  transition: transform var(--transition-normal);
  will-change: transform;
}

.logo-button:hover img {
  animation: shake 0.5s ease-in-out;
}

/* Navigation */
.center-nav {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 30px;
  bottom: 0;
  margin-top: auto;
  padding-bottom: 0;
}

nav ul {
  display: flex;
  list-style: none;
  gap: var(--space-xl);
  margin: 0;
  padding: 0;
  align-items: center;
}

nav ul li a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: bold;
  font-size: 2.1rem;
  position: relative;
  padding: var(--space-sm) var(--space-md);
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
}

nav ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-normal);
}

nav ul li a:hover::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle-container {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.theme-toggle button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--color-primary);
  transition: all var(--transition-normal);
  padding: var(--space-xs);
  border-radius: 50%;
  transform: scale(1);
}

/* Bounce scale animation */
.theme-toggle button.animated {
  animation: bounceScale 0.5s linear 0s 1 normal forwards;
}

.theme-toggle button i {
  transition: transform 1s ease-in-out;
  transform: rotate(0deg);
}

/* Artists Dropdown Styles */
.artists-dropdown-container {
  position: relative;
}

.artists-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.artists-dropdown-trigger .fa-chevron-down {
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.artists-dropdown-container:hover .artists-dropdown-trigger .fa-chevron-down {
  transform: rotate(180deg);
}

.artists-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: 12px;
  padding: 15px;
  min-width: 250px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.dark-mode .artists-dropdown {
  background: #2d2d2d;
  border-color: var(--color-primary);
}

.artists-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Updated Artists Grid Layout */
.artists-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.artist-thumbnail {
  transition: transform 0.2s ease;
}

.artist-thumbnail:hover {
  transform: translateY(-2px);
}

.artist-link {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.artist-link:hover {
  background-color: rgba(138, 43, 226, 0.1);
}

.dark-mode .artist-link:hover {
  background-color: rgba(155, 95, 224, 0.2);
}

.artist-thumbnail-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}

.artist-image-container {
  width: 75px;
  height: 75px;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

.artist-image-container .wip-badge {
  color: #9370db;
  font-size: 0.9em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: none;
  background-color: transparent;
  border-radius: 50%;
}

.artist-thumbnail:hover .artist-image-container {
}

.artist-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artist-info {
  flex-grow: 1;
}

.artist-name {
  font-size: 1em;
  font-weight: 600;
  color: #333;
  display: block;
}

.dark-mode .artist-name {
  color: #fff;
}

.loading-artists,
.no-artists,
.error-loading {
  text-align: center;
  padding: 20px;
  color: #666;
  grid-column: 1 / -1;
}

.dark-mode .loading-artists,
.dark-mode .no-artists,
.dark-mode .error-loading {
  color: #ccc;
}

.wip-artist {
  cursor: not-allowed;
  opacity: 0.8;
}

.artist-placeholder {
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  border-radius: 50%;
}

.dark-mode .artist-placeholder {
  background-color: #333;
}

.coming-soon-badge {
  align-items: center;
  justify-content: center;
  font-size: 0.7em; /* smaller text */
  font-weight: bold;
  line-height: 1;
  color: #ffa500; /* orange-yellow */
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ===== MOBILE NAVIGATION STYLES ===== */
@media (max-width: 768px) {
  /* Hide the desktop navigation bar but keep the mobile popup */
  .center-nav:not(.active) {
    display: none;
  }

  /* Use logo as mobile menu toggle on the left */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: -2px;
    left: 15px;
    z-index: 1002;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 10px;
    transition: all var(--transition-normal);
    transform: translateY(0) !important;
  }

  .menu-logo img {
    width: 30vw;
  }

  .mobile-menu-toggle.active {
    background: rgba(108, 92, 231, 0.2);
  }

  .mobile-menu-toggle.active img {
    transform: rotate(180deg);
  }

  .mobile-menu-toggle:hover img {
    transform: scale(1.1);
  }

  .mobile-menu-toggle.active:hover img {
    transform: rotate(180deg);
  }

  /* Hide the desktop logo since we're using it as menu toggle */
  .header-top .logo-button {
    display: none;
  }

  /* Mobile menu popup - UPDATED */
  .center-nav {
    position: fixed;
    top: 5vh;
    bottom: auto;
    left: 50%;
    width: 90vw;
    max-width: 400px;
    height: auto;
    z-index: 1000;
    display: flex;
    background-color: var(--color-light);
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    border-radius: 25px;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--color-primary);
    padding: var(--space-xl);
    max-height: 80vh;
    overflow-y: auto;
  }

  .center-nav.active {
    padding: var(--space-lg);
    backdrop-filter: blur(10px);
    opacity: 1;
    visibility: visible;
    animation: slideInBounce 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  }

  .center-nav.closing {
    animation: menuSlideOut 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  }

  /* Mobile nav links */
  .center-nav.active ul {
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
    text-align: center;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .center-nav.active li {
    width: 100%;
  }

  .center-nav.active li a {
    font-size: 2.5rem;
    padding: var(--space-lg) var(--space-xl);
    display: block;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
    transition: all var(--transition-normal);
    border-radius: 15px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
  }

  .center-nav.active li a:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }

  .artists-dropdown {
    font-size: 2rem;
    position: fixed !important;
    top: 50vh !important; /* Position below the mobile menu */
    left: 50% !important;
    transform: translateX(-50%) translateY(-20px) scale(0.95) !important;
    max-width: 400px !important;
    border-radius: 12px !important;
    max-height: 60vh !important;
    padding: 15px !important;
    z-index: 1005 !important; /* Higher than mobile menu */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    opacity: 0;
    visibility: hidden;
  }

  .artists-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1) !important;
    animation: slideUpBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55)
      forwards !important;
  }

  /* When artists dropdown is open, dim the mobile menu background */
  body.dropdown-open .center-nav.active {
    opacity: 0.7;
    filter: blur(2px);
    pointer-events: none; /* Prevent clicking on menu while dropdown is open */
  }

  /* Make sure mobile menu backdrop covers everything including dropdown */
  .mobile-menu-backdrop.active {
    z-index: 1004;
  }

  .artists-grid {
    max-height: 50vh;
    grid-template-columns: 1fr;
  }

  .artists-dropdown-trigger .fa-chevron-down {
    transition: transform 0.3s ease;
  }

  .artists-dropdown-container.active
    .artists-dropdown-trigger
    .fa-chevron-down {
    transform: rotate(180deg);
  }

  /* Theme toggle positioning */
  .theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    display: flex;
    align-items: center;
  }

  .theme-toggle button {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .theme-toggle button:hover {
    background: var(--color-secondary);
    transform: scale(1.1);
  }
}

/* ===== TABLET STYLES (769px to 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Show desktop navigation in tablet view */
  .center-nav:not(.active) {
    display: flex !important;
  }

  /* Hide mobile menu toggle in tablet view */
  .mobile-menu-toggle {
    display: none !important;
  }

  /* Show desktop logo in tablet view */
  .header-top .logo-button {
    display: block !important;
  }

  /* Ensure theme toggle is positioned correctly */
  .theme-toggle-container {
    position: absolute !important;
    top: 30px !important;
    right: 20px !important;
    z-index: 1001 !important;
  }

  .theme-toggle button {
    background: none !important;
    border: none !important;
    border-radius: 50% !important;
    width: 45px !important;
    height: 45px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.3rem !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-normal) !important;
  }

  .theme-toggle button:hover {
    background: rgba(108, 92, 231, 0.1) !important;
    transform: scale(1.1) !important;
  }
}

/* ===== SMALLER MOBILE BREAKPOINTS ===== */
@media (max-width: 550px) {
  .mobile-menu-toggle {
    top: 10px;
    left: 10px;
  }

  .center-nav.active {
    top: 15vh;
    padding: var(--space-lg);
    max-width: 350px;
  }

  .center-nav.active ul {
    gap: var(--space-lg);
  }

  .center-nav.active li a {
    font-size: 2rem;
    padding: var(--space-md);
  }

  .mobile-menu-toggle {
    top: 10px;
    left: 10px;
  }

  .center-nav.active {
    top: 15vh;
    padding: var(--space-lg);
    max-width: 350px;
    backdrop-filter: blur(10px);
  }

  .center-nav.active ul {
    gap: var(--space-lg);
  }

  .center-nav.active li a {
    font-size: 2rem;
    padding: var(--space-md);
  }

  /* Adjust artists dropdown for smaller screens */
  .artists-dropdown {
    top: 25vh !important; /* Move it further down */
    width: 100% !important;
  }

  .theme-toggle-container {
    top: 30px;
    right: 30px;
  }

  .theme-toggle button {
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
  }

  /* Artists dropdown adjustments */
  .artists-grid {
    gap: 6px;
  }

  .artist-thumbnail-content {
    gap: 10px;
  }

  .artist-image-container {
    width: 35px;
    height: 35px;
  }

  .artist-name {
    font-size: 0.9em;
  }

  body.our-stickers-page .gallery-container.grid-mode {
    top: -2vh;
  }
}

@media (max-width: 420px) {
  .mobile-menu-toggle {
    top: 8px;
    left: 8px;
  }

  .center-nav.active {
    top: 10vh;
    padding: var(--space-sm) !important;
    max-width: 350px;
    -webkit-backdrop-filter: blur(10px);
  }

  .center-nav.active ul {
    gap: var(--space-sm) !important;
  }

  .center-nav.active li a {
    font-size: 2rem;
    line-height: 0.5;
    padding: var(--space-md);
  }

  /* Adjust artists dropdown for extra small screens */
  .artists-dropdown {
    top: 50vh !important;
    max-height: 50vh !important;
  }

  .theme-toggle-container {
    top: 13px;
    right: 35px;
  }

  .theme-toggle button {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }

  /* Artists dropdown adjustments */
  .artists-dropdown {
    font-size: 2.5rem;
  }
  .artist-image-container {
    width: 75px;
    height: 64px;
  }

  .artist-name {
    font-size: 0.85em;
  }
}

@media (max-width: 375px) {
  header {
    height: 75px !important;
  }

  .center-nav {
    max-height: 85vh;
  }

  .center-nav.active {
    top: 15vh !important;
  }

  .center-nav.active ul {
    gap: var(--space-sm) !important;
  }

  .artists-dropdown {
    top: 25vh !important;
    font-size: 2rem !important;
  }

  .artist-link {
    padding: 0;
  }
}

/* ===== DESKTOP STYLES (1025px and above) - COMPLETE RESET ===== */
@media (min-width: 1025px) {
  /* Completely disable mobile menu system */
  .mobile-menu-toggle {
    display: none;
    pointer-events: none;
  }

  .mobile-menu-backdrop {
    display: none;
    pointer-events: none;
  }

  /* Reset header structure */
  header {
    background: var(--color-light);
    box-shadow: var(--shadow-sm);
    height: 100px;
    position: sticky;
    top: 0;
  }

  .header-content {
    display: flex;
    flex-direction: column;
    height: 100px;
  }

  .header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0;
  }

  /* Ensure desktop logo is visible */
  .header-top .logo-button {
    display: block;
    height: 80px;
  }

  .header-top .logo-button img {
    height: 80px;
    width: auto;
  }

  /* Reset center-nav to desktop state */
  .center-nav {
    display: flex;
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    width: 100%;
    height: 30px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    margin-top: auto;
    padding-bottom: 10px;
    animation: none;
    justify-content: center;
    align-items: flex-end;
  }

  .center-nav.active,
  .center-nav:not(.active) {
    animation: none;
    transform: none;
  }

  /* Reset nav links to desktop */
  .center-nav ul {
    display: flex;
    flex-direction: row;
    gap: var(--space-xl);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .center-nav li {
    width: auto;
    height: auto;
  }

  .center-nav li a {
    font-size: 2.1rem;
    padding: var(--space-sm) var(--space-md);
    display: inline-block;
    background: transparent;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    width: auto;
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-normal);
  }

  .center-nav li a:hover {
    background: transparent;
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: none;
  }

  /* Theme toggle positioning */
  .theme-toggle-container {
    position: absolute;
    top: 30px;
    right: 20px;
    z-index: 1001;
    display: flex;
    align-items: center;
  }

  /* Reset theme toggle for desktop */
  .theme-toggle button {
    background: none;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--text-primary);
    transition: all var(--transition-normal);
  }

  .theme-toggle button:hover {
    background: rgba(108, 92, 231, 0.1);
    transform: scale(1.1);
  }
}

/* Artists Dropdown Active States */
.artists-dropdown-container.active .artists-dropdown-trigger {
  color: var(--color-primary);
}

.artists-dropdown-container.active .artists-dropdown-trigger .fa-chevron-down {
  transform: rotate(180deg);
}

nav ul li a::after,
.artists-dropdown-trigger::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-normal);
}

nav ul li a:hover::after,
.artists-dropdown-container.active .artists-dropdown-trigger::after {
  width: 100%;
}

/* Make sure the artists trigger has proper positioning */
.artists-dropdown-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Arrow transition */
.artists-dropdown-trigger .fa-chevron-down {
  font-size: 0.8em;
  transition: transform 0.3s ease;
  transform: rotate(0deg);
}

.artists-dropdown-container.active .artists-dropdown-trigger .fa-chevron-down {
  transform: rotate(180deg);
}

/* Animations */
@keyframes bounceScale {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Animation for mobile dropdown */
@keyframes slideUpBounce {
  0% {
    transform: translateX(-50%) translateY(-20px) scale(0.95);
    opacity: 0;
  }
  60% {
    transform: translateX(-50%) translateY(5px) scale(1.02);
    opacity: 1;
  }
  80% {
    transform: translateX(-50%) translateY(-2px) scale(0.98);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

/* Mobile dropdown specific styles */
@media (max-width: 1024px) {
  /* Prevent body scroll when dropdown is open on mobile */
  body.dropdown-open {
    overflow: hidden;
  }

  /* Update mobile menu backdrop to cover dropdown */
  .mobile-menu-backdrop.active {
    z-index: 1004;
  }

  body.mobile-menu-active .container {
    pointer-events: none;
    opacity: 0.5; /* Optional: visually dim the content */
    filter: blur(1px); /* Optional: slight blur effect */
    transition: opacity 0.3s ease, filter 0.3s ease;
  }

  /* Ensure header elements remain interactive */
  body.mobile-menu-active header,
  body.mobile-menu-active header .container,
  body.mobile-menu-active .mobile-menu-backdrop,
  body.mobile-menu-active .mobile-menu-toggle {
    pointer-events: auto;
    opacity: 1;
    filter: none;
  }

  /* Prevent scrolling on body */
  body.mobile-menu-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
}

/* ===== MOBILE MENU ANIMATION ===== */
@keyframes slideInBounce {
  0% {
    opacity: 0;
    transform: translateX(-50%) perspective(1200px) rotateX(-95deg) scale(0.7);
    filter: blur(15px);
  }
  40% {
    opacity: 0.8;
    transform: translateX(-50%) perspective(1200px) rotateX(45deg) scale(1.1);
    filter: blur(5px);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) perspective(1200px) rotateX(-15deg) scale(0.95);
    filter: blur(2px);
  }
  80% {
    transform: translateX(-50%) perspective(1200px) rotateX(8deg) scale(1.02);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) perspective(1200px) rotateX(0deg) scale(1);
    filter: blur(0px);
  }
}

@keyframes menuSlideOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) perspective(1200px) rotateX(0deg) scale(1);
    filter: blur(0px);
  }
  20% {
    transform: translateX(-50%) perspective(1200px) rotateX(-25deg) scale(1.05);
    filter: blur(2px);
  }
  50% {
    opacity: 0.8;
    transform: translateX(-50%) perspective(1200px) rotateX(65deg) scale(0.9);
    filter: blur(8px);
  }
  80% {
    opacity: 0.3;
    transform: translateX(-50%) perspective(1200px) rotateX(85deg) scale(0.8);
    filter: blur(12px);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) perspective(1200px) rotateX(95deg) scale(0.7);
    filter: blur(15px);
  }
}
