/**
 * Search feature styling — btm-revolution
 * @author em chair (Claude.ai) 27/05/2026
 * Components: header search button, overlay, homepage section, results page
 */

/* ===== CSS Variables (fallback if theme doesn't define) ===== */
:root {
  --btm-navy: #1A2332;
  --btm-navy-deep: #0f1620;
  --btm-cream: #F5F1E8;
  --btm-cream-darker: #E8DFC9;
  --btm-terracotta: #C8553D;
  --btm-terracotta-dark: #a8442f;
  --btm-text: #2a2a2a;
  --btm-text-muted: #6a6a6a;
  --btm-border: #d8d2c4;
  --btm-trans: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== HEADER SEARCH BUTTON ===== */
.btm-search-trigger {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--btm-border);
  background: #fff;
  color: var(--btm-navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--btm-trans);
  padding: 0;
}
.btm-search-trigger:hover {
  background: var(--btm-navy);
  color: #fff;
  border-color: var(--btm-navy);
}
.btm-search-trigger svg {
  width: 18px;
  height: 18px;
}
.nav__inner .btm-search-trigger {
  margin-right: 8px;
}

/* ===== SEARCH OVERLAY ===== */
.btm-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 32, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 24px 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
}
.btm-search-overlay.is-active {
  opacity: 1;
  visibility: visible;
}
.btm-search-overlay__close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(245, 241, 232, 0.2);
  background: transparent;
  color: var(--btm-cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--btm-trans);
  padding: 0;
}
.btm-search-overlay__close:hover {
  background: var(--btm-terracotta);
  border-color: var(--btm-terracotta);
}
.btm-search-overlay__content {
  width: 100%;
  max-width: 640px;
  text-align: center;
  transform: translateY(20px);
  transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btm-search-overlay.is-active .btm-search-overlay__content {
  transform: translateY(0);
}
.btm-search-overlay__eyebrow {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--btm-terracotta);
  font-weight: 600;
  margin-bottom: 18px;
}
.btm-search-overlay__title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(32px, 7vw, 52px);
  color: var(--btm-cream);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.btm-search-overlay__sub {
  color: rgba(245, 241, 232, 0.55);
  font-size: 13px;
  margin-bottom: 32px;
}
.btm-search-overlay__form {
  position: relative;
  margin-bottom: 32px;
}
.btm-search-overlay__input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(245, 241, 232, 0.3);
  padding: 14px 56px 14px 8px;
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(20px, 4vw, 28px);
  color: var(--btm-cream);
  outline: none;
  text-align: center;
  transition: border-color var(--btm-trans);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.btm-search-overlay__input::placeholder {
  color: rgba(245, 241, 232, 0.3);
  font-style: italic;
}
.btm-search-overlay__input:focus {
  border-color: var(--btm-terracotta);
}
.btm-search-overlay__submit {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--btm-cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--btm-trans);
}
.btm-search-overlay__submit:hover {
  color: var(--btm-terracotta);
}
.btm-search-overlay__popular-label {
  font-size: 10px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, 0.4);
  margin-bottom: 14px;
}
.btm-search-overlay__popular {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.btm-search-overlay__popular a {
  padding: 8px 16px;
  border: 1px solid rgba(245, 241, 232, 0.2);
  color: rgba(245, 241, 232, 0.75);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--btm-trans);
}
.btm-search-overlay__popular a:hover {
  background: rgba(245, 241, 232, 0.08);
  border-color: var(--btm-terracotta);
  color: var(--btm-cream);
}
body.btm-search-open { overflow: hidden; }

/* ===== HOMEPAGE SEARCH SECTION ===== */
.hp-search {
  background: linear-gradient(135deg, var(--btm-navy) 0%, var(--btm-navy-deep) 100%);
  padding: 64px 24px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hp-search::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(200, 85, 61, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(245, 241, 232, 0.06) 0%, transparent 50%);
  pointer-events: none;
}
.hp-search__inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}
.hp-search__eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--btm-terracotta);
  font-weight: 600;
  margin-bottom: 16px;
}
.hp-search__title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 5vw, 38px);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.hp-search__sub {
  font-size: 14px;
  color: rgba(245, 241, 232, 0.65);
  margin: 0 auto 28px;
  max-width: 480px;
}
.hp-search__form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.hp-search__form input[type="search"] {
  flex: 1;
  border: none;
  padding: 16px 20px;
  font-size: 15px;
  color: var(--btm-text);
  outline: none;
  min-width: 0;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.hp-search__form input::placeholder { color: #999; }
.hp-search__form button[type="submit"] {
  background: var(--btm-terracotta);
  color: #fff;
  border: none;
  padding: 0 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--btm-trans);
  text-transform: uppercase;
  flex-shrink: 0;
}
.hp-search__form button:hover {
  background: var(--btm-terracotta-dark);
}
.hp-search__chips {
  margin-top: 24px;
}
.hp-search__chips-label {
  font-size: 10px;
  color: rgba(245, 241, 232, 0.45);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hp-search__chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.hp-search__chip {
  padding: 6px 14px;
  border: 1px solid rgba(245, 241, 232, 0.2);
  background: transparent;
  color: rgba(245, 241, 232, 0.75);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--btm-trans);
}
.hp-search__chip:hover {
  background: rgba(245, 241, 232, 0.1);
  border-color: var(--btm-terracotta);
  color: #fff;
}
@media (max-width: 600px) {
  .hp-search__form { flex-direction: column; }
  .hp-search__form button { padding: 14px; }
}

/* ===== RESULTS PAGE (search.php) ===== */
.rp { background: #fff; }
.rp-hero {
  background: linear-gradient(180deg, #f8f5ee 0%, #fff 100%);
  padding: 48px 24px 28px;
  text-align: center;
  border-bottom: 1px solid var(--btm-border);
}
.rp-eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--btm-terracotta);
  font-weight: 600;
  margin-bottom: 12px;
}
.rp-title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 5vw, 36px);
  color: var(--btm-navy);
  margin: 0 0 8px;
  line-height: 1.2;
}
.rp-title em {
  color: var(--btm-terracotta);
  font-style: italic;
}
.rp-count {
  color: var(--btm-text-muted);
  font-size: 14px;
  margin: 0 0 18px;
}
.rp-refine {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--btm-border);
  font-size: 12px;
  color: var(--btm-text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.rp-refine:hover {
  border-color: var(--btm-terracotta);
  color: var(--btm-terracotta);
}
.rp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 28px 14px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .rp-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 40px 28px;
  }
}
.rp-card {
  background: #fff;
  border: 1px solid var(--btm-border);
  transition: all var(--btm-trans);
}
.rp-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26, 35, 50, 0.1);
}
.rp-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.rp-card-img {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e8dfc9 0%, #c5b89a 100%);
  position: relative;
}
.rp-card-body { padding: 14px 16px 18px; }
.rp-card-title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 17px;
  color: var(--btm-navy);
  margin: 0 0 6px;
  line-height: 1.3;
}
.rp-card-excerpt {
  font-size: 13px;
  color: var(--btm-text-muted);
  margin: 0;
  line-height: 1.5;
}
.rp-pagination {
  text-align: center;
  padding: 24px 16px 56px;
}
.rp-pagination .nav-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.rp-pagination a,
.rp-pagination .current {
  padding: 8px 14px;
  border: 1px solid var(--btm-border);
  color: var(--btm-text);
  text-decoration: none;
  font-size: 13px;
  background: #fff;
}
.rp-pagination .current {
  background: var(--btm-terracotta);
  color: #fff;
  border-color: var(--btm-terracotta);
}
.rp-pagination a:hover {
  border-color: var(--btm-terracotta);
  color: var(--btm-terracotta);
}

/* ===== EMPTY STATE ===== */
.rp-empty {
  text-align: center;
  padding: 64px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.rp-empty-icon {
  font-size: 48px;
  color: var(--btm-terracotta);
  margin-bottom: 16px;
}
.rp-empty-title {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 24px;
  color: var(--btm-navy);
  margin: 0 0 8px;
}
.rp-empty-sub {
  color: var(--btm-text-muted);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.6;
}
.rp-empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.rp-empty-cta,
.rp-empty-cta-secondary {
  display: inline-block;
  padding: 12px 24px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  font-family: inherit;
}
.rp-empty-cta {
  background: var(--btm-terracotta);
  color: #fff;
  border-color: var(--btm-terracotta);
}
.rp-empty-cta:hover {
  background: var(--btm-terracotta-dark);
}
.rp-empty-cta-secondary {
  background: #fff;
  color: var(--btm-text);
  border-color: var(--btm-border);
}
.rp-empty-cta-secondary:hover {
  border-color: var(--btm-terracotta);
  color: var(--btm-terracotta);
}


/* ============================================================
 * HOTFIX v1.1 — Nav layout for search icon (27/05/2026)
 * Fix: menu items wrap 2 dòng + CTA "Liên hệ" wrap on desktop
 * ============================================================ */

/* Shrink search button — minimal icon style */
.btm-search-trigger {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.btm-search-trigger svg {
  width: 20px;
  height: 20px;
}
.btm-search-trigger:hover {
  background: transparent;
  border-color: transparent;
  color: var(--btm-terracotta, #C8553D);
  transform: scale(1.1);
}
.nav__inner .btm-search-trigger {
  margin-right: 0;
}

/* Desktop only — tighten gaps + prevent text wrap */
@media (min-width: 768px) {
  .nav__inner {
    gap: 24px;
  }
  .nav__links {
    gap: 24px;
  }
  .nav__links a {
    white-space: nowrap;
  }
  .nav__cta {
    white-space: nowrap;
  }
}

/* ============================================================
 * HOTFIX v1.2 — Scope .btm-search-trigger rules to header only
 * Fix: nút "Tìm kiếm khác" trong search.php bị wrap vì size 36x36 ép
 * ============================================================ */

/* Reset hotfix v1.1 rules — apply to header context only */
.nav__inner .btm-search-trigger,
.nav__drawer .btm-search-trigger {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

/* Override hotfix v1.1 size for non-header context */
.rp-refine.btm-search-trigger,
.rp-empty-cta-secondary.btm-search-trigger {
  width: auto;
  height: auto;
  padding: 8px 16px;
}

/* Specific for results page "Tìm kiếm khác" button */
.rp-refine {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
 * HOTFIX v1.3 — Push search icon to right on mobile
 * Fix: icon 🔍 nằm giữa header (space-between flex)
 * Plan: icon sát hamburger góc phải
 * ============================================================ */
@media (max-width: 767px) {
  .nav__inner .btm-search-trigger {
    margin-left: auto;
  }
}
