/* =========================================================
   PALACE ORIENTAL RUGS — LUXURY PREDICTIVE SEARCH DRAWER
   Azad Design Inspiration • 5-Column Responsive Grid • Dark Luxury
   ========================================================= */

/* Mobile Horizontal Scroll Prevention without breaking desktop position:sticky */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }
}

.palace-search-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 1085;
}

.palace-search-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.palace-search-drawer {
  position: fixed;
  top: 124px;
  left: 0;
  width: 100%;
  max-height: calc(88vh - 40px);
  background: #151210;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.65);
  z-index: 1088;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-16px);
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.32s;
}

.palace-search-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.palace-search-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 36px;
  box-sizing: border-box;
  transition: padding 0.3s ease;
}

.palace-search-drawer.has-query .palace-search-container {
  padding: 26px 36px 40px;
}

/* Search Input Bar */
.palace-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 0;
  transition: padding-bottom 0.25s ease;
}

.palace-search-drawer.has-query .palace-search-bar {
  padding-bottom: 24px;
}

.palace-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.palace-search-icon {
  width: 22px;
  height: 22px;
  stroke: #ffffff;
  flex-shrink: 0;
  opacity: 0.85;
}

.palace-luxury-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fdfdfd;
  font-family: inherit;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 0;
}

.palace-luxury-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 300;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.palace-search-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.25s ease, opacity 0.2s ease;
  opacity: 0.8;
  flex-shrink: 0;
}

.palace-search-close-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(90deg);
}

/* Tabs (hidden until query typed) */
.palace-search-tabs {
  display: none;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 28px;
}

.palace-search-drawer.has-query .palace-search-tabs {
  display: flex;
}

.palace-search-tab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 10px 0 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.palace-search-tab:hover {
  color: #ffffff;
}

.palace-search-tab.active {
  color: #ffffff;
  font-weight: 600;
}

.palace-search-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #ffffff;
}

.palace-tab-count {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 4px;
  font-weight: 400;
}

/* Body / Results (hidden until query typed) */
.palace-search-body {
  display: none;
  min-height: 220px;
}

.palace-search-drawer.has-query .palace-search-body {
  display: block;
}

/* Products 5-Column Grid */
.palace-search-products-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
}

/* Rug Card */
.palace-search-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.palace-search-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #221e1a;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.palace-search-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.palace-search-card-img.img-main {
  position: relative;
  z-index: 1;
}

.palace-search-card-media.has-hover .palace-search-card-img.img-hover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.palace-search-card:hover .palace-search-card-img {
  transform: scale(1.05);
}

.palace-search-card:hover .palace-search-card-media.has-hover .palace-search-card-img.img-hover {
  opacity: 1;
}

.palace-search-card-info {
  padding-top: 12px;
  text-align: center;
}

.palace-search-card-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #eae6e0;
  margin: 0;
  line-height: 1.35;
  transition: color 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palace-search-card:hover .palace-search-card-title {
  color: #d4af37;
}

.palace-search-card-sub {
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collections Grid */
.palace-search-collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.palace-search-col-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 84px;
  padding: 14px 20px;
  background: #201c19;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  text-decoration: none;
  color: #f5f2ed;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease, color 0.2s ease;
}

.palace-search-col-card:hover {
  background: #2c2622;
  border-color: #d4af37;
  color: #d4af37;
  transform: translateY(-2px);
}

.palace-search-col-title {
  font-weight: 600;
  color: #ffffff;
  display: block;
}

.palace-search-col-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: none;
}

/* Empty State */
.palace-search-empty {
  padding: 48px 20px;
  text-align: center;
}

.palace-search-empty-title {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #f0ebe4;
  margin: 0 0 8px;
  font-weight: 500;
}

.palace-search-empty-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  letter-spacing: 0.5px;
}

/* Scrollbar for Drawer */
.palace-search-drawer::-webkit-scrollbar {
  width: 6px;
}
.palace-search-drawer::-webkit-scrollbar-track {
  background: #151210;
}
.palace-search-drawer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.palace-search-drawer::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 1100px) {
  .palace-search-products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .palace-search-container {
    padding: 20px 18px 28px;
  }
  .palace-search-bar {
    padding-bottom: 16px;
    gap: 12px;
  }
  .palace-search-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .palace-search-tabs {
    gap: 20px;
    margin-bottom: 20px;
  }
}
