/* =============================================
   override.css - Product Card & Layout Overrides
   Navigation styles moved to nav.css
   ============================================= */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================
   Album Card
   ============================================= */
.showindex__parent {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0 !important;
}

.showindex__children {
  width: 12.5% !important;
  max-width: 160px !important;
  padding: 6px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  float: none !important;
}

.album__imgwrap {
  position: relative !important;
  width: 100% !important;
  padding-bottom: 100% !important;
  height: 0 !important;
  overflow: hidden !important;
  background: #f5f5f5;
  border: 1px solid #f0f0f0;
}

.album__absolute {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.album__img[src=""],
.album__img:not([src]) {
  background: #f0f0f0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 24 24' fill='none' stroke='%23ccc' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E") center center no-repeat;
  background-size: 40px 40px;
}

.album__space { display: block; }
.album__photonumber { display: none !important; }

.album__title {
  font-size: 12px;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  margin: .5em 0;
  word-break: break-all;
  color: #494949;
}

.album__date {
  color: #999;
  font-size: 11px;
  line-height: 1.3;
  margin: -.2em 0 .55em;
  white-space: nowrap;
}

.album__main {
  display: block;
  text-decoration: none;
  color: inherit;
}

.album__main:hover {
  box-shadow: 0 1px 2px #9f9f9f;
}

.show-layout-category__catetitle {
  text-decoration: none;
  color: #494949;
}

.showalbum__wrap { max-width: 100%; }
.image__img { max-width: 100%; height: auto; }
img.autocover { object-fit: cover; }

/* =============================================
   Responsive: Product Grid
   Override ALL Yupoo showindex.css breakpoints
   ============================================= */
@media (max-width: 1200px) {
  .showindex__children { width: 14.28% !important; max-width: none !important; margin: 0 !important; }
  .showindex__parent { margin-right: 0 !important; }
}

@media (max-width: 1000px) {
  .showindex__children { width: 16.66% !important; max-width: none !important; margin: 0 !important; }
  .showindex__parent { margin-right: 0 !important; }
}

/* === Mobile: force 3 columns at ALL small screen sizes === */
/* Override Yupoo's (min-width:560px) and (max-width:720px) */
@media (max-width: 720px) {
  .showindex__parent {
    display: flex !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    gap: 0 !important;
  }
  .showindex__children {
    width: 33.33% !important;
    max-width: none !important;
    padding: 4px !important;
    margin: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    flex: 0 0 33.33% !important;
    box-sizing: border-box !important;
    float: none !important;
    display: block !important;
  }
  .header__main { padding: 0 10px !important; }
  .header__logo img { height: 26px !important; }
  .header__login { font-size: 12px; }
  .layout__wrap { flex-direction: column !important; padding: 10px !important; }
  .layout__sidebar { width: 100% !important; }
  .album__title { font-size: 11px !important; }
}

/* Override Yupoo's (min-width:400px) and (max-width:560px): width:30%, margin:3.33% */
@media (min-width: 400px) and (max-width: 560px) {
  .showindex__parent { margin-right: 0 !important; }
  .showindex__children {
    width: 33.33% !important;
    margin: 0 !important;
    margin-right: 0 !important;
    flex: 0 0 33.33% !important;
  }
}

/* Override Yupoo's (min-width:0) and (max-width:400px): width:45%, margin:5% → FORCE 3 col */
@media (max-width: 400px) {
  .showindex__parent { margin-right: 0 !important; }
  .showindex__children {
    width: 33.33% !important;
    margin: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    padding: 3px !important;
    flex: 0 0 33.33% !important;
  }
  .album__title { font-size: 10px !important; }
}

/* =============================================
   Navigation Menu: Mega Dropdown (Global)
   ============================================= */

/* Allow the menu list to wrap to multiple lines and have spacing globally */
.showheader__menuslist {
  display: flex !important;
  flex-wrap: wrap !important;
  height: auto !important;
  gap: 8px 16px !important; /* Spacing between rows and items */
}

/* Category dropdown wrapper: position relative for dropdown placement */
.nav-dropdown {
  position: relative !important;
  display: inline-block !important;
}

/* Each menu link */
.showheader__menuslink {
  white-space: nowrap !important;
  text-overflow: clip !important;
  overflow: visible !important;
  max-width: none !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 4px 8px !important; /* Added padding to ensure they don't bunch up */
}

/* Mega dropdown: hidden by default, show on hover */
.mega-drop {
  display: none !important;
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  z-index: 9999 !important;
  background: #fff !important;
  border: 1px solid #e5e5e5 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
  padding: 12px 16px !important;
  min-width: 180px !important;
  max-width: 360px !important;
  max-height: 400px !important;
  overflow-y: auto !important;
}

.mobile-dropdown-arrow {
  display: none !important;
}

.nav-dropdown:hover > .mega-drop {
  display: block !important;
}

/* Dropdown group styling */
.mega-drop__group {
  margin-bottom: 8px !important;
}

.mega-drop__title {
  display: block !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  color: #333 !important;
  text-decoration: none !important;
  padding: 4px 0 !important;
  border-bottom: 1px solid #f0f0f0 !important;
  margin-bottom: 4px !important;
}

.mega-drop__title:hover {
  color: #49bc85 !important;
}

.mega-drop__item {
  display: block !important;
  font-size: 12px !important;
  color: #666 !important;
  text-decoration: none !important;
  padding: 3px 8px !important;
  border-radius: 3px !important;
}

.mega-drop__item:hover {
  background: #f5f5f5 !important;
  color: #49bc85 !important;
}

/* =============================================
   Navigation Menu: Mobile Adjustments
   ============================================= */
@media (max-width: 991px) {
  .mobile-dropdown-arrow {
    display: inline-block !important;
  }

  /* Ensure header wrapper is above everything else so dropdowns aren't hidden behind content */
  .showheader__headerWrap,
  .showheader__header,
  .showheader__menus,
  .showheader__menuslistwrap,
  .showheader__menuslist {
    position: relative !important;
    z-index: 99999 !important;
    overflow: visible !important;
  }

  .layout__main, .layout__wrap {
    position: relative !important;
    z-index: 1 !important;
  }

  .showheader__menuslist {
    white-space: normal !important;
  }

  .showheader__menuslistwrap {
    height: auto !important;
  }

  .showheader__menus {
    height: auto !important;
  }

  .nav-dropdown {
    position: static !important;
  }

  /* Disable hover state on mobile so it requires explicit tap */
  .nav-dropdown:hover > .mega-drop {
    display: none !important;
  }

  /* Only show mega-drop on mobile when JS toggle adds js-mobile-open class */
  .nav-dropdown.js-mobile-open .mega-drop {
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10000 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border: none !important;
    border-top: 1px solid #eee !important;
    border-bottom: 2px solid #49bc85 !important;
    border-radius: 0 0 6px 6px !important;
    padding: 8px 12px !important;
    background: #fff !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 250px !important;
    overflow-y: auto !important;
  }

  /* Each menu link: stronger rules to prevent truncation on mobile */
  .showheader__menuslink, .nav-dropdown > .showheader__menuslink {
    max-width: none !important;
    width: auto !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

/* ============= PAGINATION ============= */
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #ddd;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}
.pagination-btn:hover {
  background: #49bc85;
  color: #fff;
  border-color: #49bc85;
}
.pagination-btn.active {
  background: #49bc85;
  color: #fff;
  border-color: #49bc85;
  font-weight: bold;
  pointer-events: none;
}
@media (max-width: 768px) {
  .pagination-btn { min-width: 32px; height: 32px; font-size: 13px; }
}
