/* ============================================================
   Phoenix Family Law — site search (chat-style dialog)
   All search styles live here; style.css stays untouched.
   ============================================================ */

/* ---------- header button (styled like .navbtn) ---------- */
.search-open {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex: none;
  padding: .5rem .85rem;
  font: 600 .92rem var(--font-body);
  color: var(--teal-deep);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.search-open:hover { background: var(--paper-deep); border-color: var(--sage); }
.search-open svg { flex: none; color: var(--sage-deep); }

/* header-fit accommodation: the bar carries the brand, 6–7 top-level
   dropdown groups (7 once the Support group's custom pages exist) and now
   the search button. Measured fit point with 7 groups + full "Search"
   label ≈1213px, so collapse the nav to the existing burger menu below
   1221px (same rules as style.css's 920px block, which still applies). */
@media (max-width: 1220px) and (min-width: 921px) {
  .menu-toggle { display: block; flex: none; }
  nav.primary {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    max-height: calc(100vh - 70px);
    overflow: auto;
    padding: .8rem 1.2rem 1.4rem;
  }
  nav.primary.open { display: block; }
  nav.primary > ul { flex-direction: column; gap: 0; }
  nav.primary .dropdown { position: static; display: block; border: 0; box-shadow: none; background: none; padding: 0 0 0 1rem; }
  nav.primary .navbtn { width: 100%; text-align: left; }
}

/* ---------- overlay ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 80; }
.search-overlay[hidden] { display: none; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 69, 80, .45);
  backdrop-filter: blur(3px);
}

.search-panel {
  position: relative;
  margin: 7vh auto 0;
  width: min(660px, calc(100vw - 2rem));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, .45);
  overflow: hidden;
  animation: searchIn .25s ease both;
}
@keyframes searchIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- head ---------- */
.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.2rem;
  background: var(--teal-deep);
  color: #fff;
}
.search-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.1;
}
.search-title small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #9FBDB8;
}
.search-close {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  font: 600 .9rem var(--font-body);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
}
.search-close:hover { background: rgba(255, 255, 255, .22); }

/* ---------- conversation thread ---------- */
.search-thread {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  min-height: 9rem;
}
.search-bubble {
  max-width: 92%;
  padding: .8rem 1rem;
  border-radius: 16px;
  font-size: .95rem;
  line-height: 1.55;
}
.search-bubble.user {
  align-self: flex-end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 5px;
  font-weight: 600;
}
.search-bubble.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.search-bubble.assistant p { margin: 0 0 .5rem; }
.search-bubble.assistant p:last-child { margin-bottom: 0; }
.search-bubble mark {
  background: var(--gold-tint);
  color: var(--teal-deep);
  border-radius: 3px;
  padding: 0 .12em;
}

/* result cards inside an assistant bubble */
.search-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin: .55rem 0 0;
  padding: .75rem .9rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.search-card:hover {
  border-color: var(--apricot);
  background: var(--apricot-tint);
  transform: translateX(3px);
}
.search-card-kicker {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sage-deep);
}
.search-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--teal-deep);
}
.search-card-snippet { font-size: .88rem; color: var(--ink-soft); }
.search-card-more {
  font-size: .85rem;
  font-weight: 700;
  color: var(--apricot-deep);
  margin-top: .15rem;
}

/* no-results helpers */
.search-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  list-style: none;
  margin: .6rem 0;
  padding: 0;
}
.search-suggest a {
  display: inline-block;
  background: var(--apricot-tint);
  border: 1px solid #EFC79B;
  color: var(--apricot-deep);
  font-weight: 600;
  font-size: .85rem;
  padding: .38rem .8rem;
  border-radius: 999px;
  text-decoration: none;
}
.search-suggest a:hover { background: var(--apricot); color: #fff; }
/* persistent safety line: sits between the thread and the input row */
.search-safety {
  margin: 0;
  padding: .5rem 1.2rem;
  background: #F9E4DE;
  border-top: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  font-size: .84rem;
  color: var(--ink-soft);
}
.search-safety a { color: var(--teal-deep); font-weight: 600; }

/* ---------- input row ---------- */
.search-form {
  display: flex;
  gap: .6rem;
  padding: .9rem 1.2rem .5rem;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.search-form input {
  flex: 1 1 auto;
  min-width: 0;
  font: 500 1rem var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .65rem 1.1rem;
}
.search-form input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 92, 104, .15);
}
.search-form button {
  flex: none;
  background: var(--apricot);
  color: #fff;
  border: none;
  font: 700 .92rem var(--font-body);
  padding: .65rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
}
.search-form button:hover { background: var(--apricot-deep); }

.search-privacy {
  margin: 0;
  padding: .45rem 1.2rem .9rem;
  background: var(--card);
  font-size: .74rem;
  color: var(--sage-deep);
  text-align: center;
}

/* ---------- mobile: full-screen dialog ---------- */
@media (max-width: 640px) {
  .search-panel {
    margin: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }
  .search-open span { display: none; }        /* icon-only in the tight bar */
  .search-open { padding: .5rem .6rem; }
  .search-bubble { max-width: 100%; }
}

/* reduced motion: style.css already zeroes all animation/transition globally,
   this is a belt-and-braces guard for this file's own effects */
@media (prefers-reduced-motion: reduce) {
  .search-panel { animation: none; }
  .search-card, .search-open { transition: none; }
}
