/* =========================================================
   SISIMO — Live Search / Search Mega Panel
   Faithful recreation of reference design (desktop ~970px)
   ========================================================= */

/* ─── 1. Backdrop Overlay ─── */
.search-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.30);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 590;
  cursor: pointer;
}
.search-overlay-backdrop.active {
  visibility: visible;
}

body.search-panel-open {
  /* Prevent background scrolling when search is active */
}

/* ─── 2. Search Bar Clear Button in Header ─── */
.gh-search-wrap {
  position: relative;
}
.gh-search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #EFEFEF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 3;
}
.gh-search-clear:hover {
  background: #DFDFDF;
  color: #111;
}

/* ─── 3. Mega Search Panel (Desktop ~970px) ─── */
.gh-search {
  position: relative;
}

.live-search-results.mega-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: 970px;
  max-width: calc(100vw - 40px);
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.04);
  border: none;
  padding: 34px 38px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s ease;
  z-index: 610;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.live-search-results.mega-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.search-mobile-bar {
  display: none;
}

/* Common titles */
.search-col-title {
  font-size: 16px;
  font-weight: 700;
  color: #333333;
  margin: 0 0 16px 0;
  letter-spacing: -0.2px;
  font-family: inherit;
}

/* ─── 4. Discovery State (Default) ─── */
.search-panel-default {
  display: block;
}

/* Top Row (Popular + Best Sellers) */
.search-panel-top-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: start;
}

/* Left Column: Most Popular */
.search-panel-col-popular {
  display: flex;
  flex-direction: column;
}
.search-popular-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.search-popular-tag {
  display: inline-block;
  background: #F5F5F6;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14.5px;
  font-weight: 500;
  color: #333333;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
  line-height: 1.2;
}
.search-popular-tag:hover {
  background: #E8E8E9;
  color: #000000;
}

/* Right Column: Our Best Sellers */
.search-panel-col-bestsellers {
  min-width: 0;
  position: relative;
}
.search-bestsellers-carousel-wrap {
  position: relative;
}
.search-bestsellers-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 2px;
  cursor: grab;
}
.search-bestsellers-track::-webkit-scrollbar {
  display: none;
}
.search-bestsellers-track:active {
  cursor: grabbing;
}

.search-bs-card {
  flex: 0 0 135px;
  width: 135px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: inherit;
}
.search-bs-img-box {
  width: 135px;
  height: 180px;
  border-radius: 7px;
  overflow: hidden;
  background: #F5F5F5;
  margin-bottom: 8px;
}
.search-bs-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.search-bs-card:hover .search-bs-img-box img {
  transform: scale(1.04);
}
.search-bs-name {
  font-size: 13px;
  line-height: 1.25;
  color: #333333;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 32px;
}
.search-bs-card:hover .search-bs-name {
  color: #000;
  text-decoration: underline;
}

/* Custom Green Scrollbar */
.search-bs-scrollbar {
  height: 3.5px;
  background: #E5EBE6;
  border-radius: 2px;
  margin-top: 12px;
  position: relative;
  overflow: hidden;
}
.search-bs-scrollbar-thumb {
  height: 100%;
  width: 35%;
  background: #76B98F;
  border-radius: 2px;
  transform: translateX(0);
  transition: transform 0.08s ease-out;
}

/* Optional Carousel Arrows */
.search-carousel-arrow {
  position: absolute;
  top: 90px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.15s ease, background 0.15s ease;
  opacity: 0;
  pointer-events: none;
}
.search-bestsellers-carousel-wrap:hover .search-carousel-arrow {
  opacity: 1;
  pointer-events: auto;
}
.search-carousel-arrow.prev {
  left: -12px;
}
.search-carousel-arrow.next {
  right: -12px;
}
.search-carousel-arrow:hover {
  background: #ffffff;
  color: #000;
}

/* ─── 5. Bottom Row: At The Moment ─── */
.search-moment-section {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #F0F0F2;
}

.search-moment-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.search-promo-tile {
  display: flex;
  flex-direction: column;
  height: 185px;
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.search-promo-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* TYPE A: Solid Royal Blue */
.tile-type-basics {
  background: #0B24D9;
  color: #FFFFFF;
}
.tile-type-basics .tile-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
  box-sizing: border-box;
}
.tile-type-basics .tile-brand {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 12px;
}
.tile-type-basics .tile-offer {
  display: flex;
  align-items: flex-start;
  line-height: 0.9;
}
.tile-type-basics .tile-number {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
}
.tile-type-basics .tile-suffix {
  font-size: 13px;
  font-weight: 800;
  margin-left: 2px;
  text-align: left;
  line-height: 0.95;
}
.tile-type-basics .tile-suffix small {
  font-size: 9px;
  font-weight: 700;
}
.tile-type-basics .tile-sub {
  font-size: 11px;
  font-weight: 700;
  margin-top: 14px;
  letter-spacing: 0.2px;
  opacity: 0.95;
}

/* TYPE B: Clearance (Coral / Warm Red) */
.tile-type-clearance {
  background: #E85B58;
  color: #FFFFFF;
}
.tile-type-clearance .tile-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
  box-sizing: border-box;
}
.tile-type-clearance .tile-title-clearance {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1;
  margin-bottom: 4px;
}
.tile-type-clearance .tile-upto {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.9;
}
.tile-type-clearance .tile-offer {
  display: flex;
  align-items: flex-start;
  line-height: 0.9;
}
.tile-type-clearance .tile-number {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
}
.tile-type-clearance .tile-suffix {
  font-size: 13px;
  font-weight: 800;
  margin-left: 2px;
  text-align: left;
  line-height: 0.95;
}
.tile-type-clearance .tile-suffix small {
  font-size: 9px;
  font-weight: 700;
}
.tile-type-clearance .tile-sub {
  font-size: 10px;
  font-weight: 600;
  margin-top: 10px;
  opacity: 0.95;
}

/* TYPE C: Green Grid (Back to School) */
.tile-type-school {
  background: #00B574;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 10px 10px;
  color: #FFFFFF;
}
.tile-type-school .tile-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
  box-sizing: border-box;
}
.tile-type-school .tile-title-school {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.tile-type-school .tile-upto {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.9;
}
.tile-type-school .tile-offer {
  display: flex;
  align-items: flex-start;
  line-height: 0.9;
}
.tile-type-school .tile-number {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
}
.tile-type-school .tile-suffix {
  font-size: 13px;
  font-weight: 800;
  margin-left: 2px;
  text-align: left;
  line-height: 0.95;
}
.tile-type-school .tile-suffix small {
  font-size: 9px;
  font-weight: 700;
}
.tile-type-school .tile-sub {
  font-size: 10px;
  font-weight: 600;
  margin-top: 10px;
  opacity: 0.95;
}

/* TYPE D, E, F: Image Tile */
.tile-type-image {
  background: #EEEEEE;
  position: relative;
}
.tile-type-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.tile-type-image:hover img {
  transform: scale(1.05);
}
.tile-type-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
}
.tile-type-image .tile-overlay-text {
  position: absolute;
  bottom: 12px;
  left: 6px;
  right: 6px;
  text-align: center;
  color: #FFFFFF;
  z-index: 2;
}
.tile-type-image .tile-overlay-text span {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.tile-type-image .tile-subbrand {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  margin-top: 3px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.tile-type-image .tile-subbrand i {
  font-style: italic;
  font-family: serif;
}

/* ─── 6. Results State (Typing >= 1 Character) ─── */
.search-panel-results {
  display: block;
}

.search-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.search-results-title {
  font-size: 16px;
  font-weight: 700;
  color: #333333;
  margin: 0;
}
.search-results-all-link {
  font-size: 13.5px;
  font-weight: 600;
  color: #1B3FE0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.search-results-all-link:hover {
  text-decoration: underline;
}

/* Matching Categories */
.search-results-categories {
  margin-bottom: 22px;
}
.search-results-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888888;
  margin-bottom: 10px;
}
.search-results-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.search-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F5F5F6;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #333333;
  text-decoration: none;
  transition: background 0.15s ease;
}
.search-cat-chip:hover {
  background: #E8E8E9;
  color: #000;
}
.search-cat-chip svg {
  color: #777;
}

/* Matching Products Grid */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.search-prod-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-radius: 8px;
  transition: transform 0.2s ease;
}
.search-prod-card:hover {
  transform: translateY(-2px);
}
.search-prod-img-box {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: #F7F7F7;
  position: relative;
  margin-bottom: 8px;
}
.search-prod-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.search-prod-card:hover .search-prod-img-box img {
  transform: scale(1.04);
}
.search-prod-discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #E85B58;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 4px;
  line-height: 1;
}
.search-prod-brand {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #888888;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.search-prod-name {
  font-size: 13.5px;
  line-height: 1.25;
  color: #333333;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.search-prod-card:hover .search-prod-name {
  color: #000;
  text-decoration: underline;
}
.search-prod-pricing {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
}
.search-prod-price {
  font-size: 14px;
  font-weight: 700;
  color: #111111;
}
.search-prod-price--discounted {
  color: #E85B58;
}
.search-prod-old-price {
  font-size: 12.5px;
  color: #999999;
  text-decoration: line-through;
}

/* Skeleton Loading in Results */
.search-results-loading {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.search-skeleton-card {
  display: flex;
  flex-direction: column;
}
.search-skeleton-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: #F0F0F2;
  animation: searchSkeletonPulse 1.2s infinite ease-in-out;
  margin-bottom: 8px;
}
.search-skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: #F0F0F2;
  animation: searchSkeletonPulse 1.2s infinite ease-in-out;
  margin-bottom: 6px;
}
.search-skeleton-line.short {
  width: 50%;
}
@keyframes searchSkeletonPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Empty State */
.search-empty-state {
  padding: 40px 20px 20px;
  text-align: center;
}
.search-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #F5F5F7;
  color: #888888;
  margin-bottom: 16px;
}
.search-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #222222;
  margin: 0 0 8px;
}
.search-empty-hint {
  font-size: 14px;
  color: #666666;
  margin: 0 0 24px;
}
.search-empty-suggestions-wrap {
  border-top: 1px solid #F0F0F2;
  padding-top: 20px;
  max-width: 480px;
  margin: 0 auto;
}
.search-empty-suggestions-label {
  font-size: 13px;
  font-weight: 600;
  color: #888888;
  margin-bottom: 12px;
}
.search-empty-suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ─── 7. Mobile Responsive (< 992px) ─── */
@media (max-width: 991px) {
  .search-overlay-backdrop {
    display: block;
    z-index: 590;
  }

  /* In mobile version: live search panel width is exactly identical to the search bar */
  .live-search-results.mega-panel,
  .gh-search .live-search-results.mega-panel,
  .gh-mobile-search .live-search-results.mega-panel {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    transform: translateY(-4px) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 160px) !important;
    border-radius: 14px !important;
    padding: 18px 14px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.05) !important;
    background: #FFFFFF !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    z-index: 610 !important;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease !important;
  }

  .live-search-results.mega-panel.active,
  .gh-search .live-search-results.mega-panel.active,
  .gh-mobile-search .live-search-results.mega-panel.active {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .search-mobile-bar {
    display: none !important;
  }

  .search-panel-default,
  .search-panel-results {
    padding: 0 !important;
    overflow: visible !important;
  }

  .search-panel-top-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .search-popular-tags {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .search-popular-tag {
    padding: 6px 12px;
    font-size: 13px;
  }

  .search-bs-card {
    flex: 0 0 115px;
    width: 115px;
  }
  .search-bs-img-box {
    width: 115px;
    height: 145px;
  }

  .search-moment-section {
    margin-top: 18px;
    padding-top: 14px;
  }

  .search-moment-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .search-promo-tile {
    height: 145px;
  }

  .search-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
