/**
 * Masluland Search CSS
 * ====================
 * Styles for the navbar dropdown + /search/ page.
 * Design tokens match main.css: --bg, --gold, --orange, --text, --text-mute, --border, --radius.
 * RTL throughout (dir="rtl" is on <html>).
 */

/* ══════════════════════════════════════════════════════════════════════════════
   DROPDOWN — overrides the basic .ml-search-results styles from main.css
   ══════════════════════════════════════════════════════════════════════════════ */

/* Widen the search box for richer results */
.ml-nav__search-box {
  width: 340px;
  overflow: visible; /* allow dropdown shadow to breathe */
}

/* Container holding group-rows inside the dropdown */
.ml-search-results {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  border-top: 1px solid #383838;
  scrollbar-width: thin;
  scrollbar-color: #383838 transparent;
}
.ml-search-results::-webkit-scrollbar { width: 4px; }
.ml-search-results::-webkit-scrollbar-thumb { background: #383838; border-radius: 4px; }

/* Loading pulse on input border */
.ml-nav__search-box.mls-loading input {
  animation: mls-pulse-border 1s ease-in-out infinite;
}
@keyframes mls-pulse-border {
  0%,100% { box-shadow: 0 0 0 0 rgba(221,184,139,0); }
  50%      { box-shadow: 0 0 0 2px rgba(221,184,139,0.35); }
}

/* ── Dropdown: empty prompt ─────────────────────────────────────────────────── */
.mls-dd-prompt {
  padding: 24px 16px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.mls-dd-prompt svg {
  opacity: 0.35;
}

/* ── Dropdown: group label ──────────────────────────────────────────────────── */
.mls-dd-group-label {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
}

/* ── Dropdown: result row ───────────────────────────────────────────────────── */
.mls-dd-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: #f4f1eb;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.12s;
  border-radius: 0;
  min-height: 44px; /* a11y tap target */
  cursor: pointer;
}
.mls-dd-result:hover,
.mls-dd-result[aria-selected="true"] {
  background: #2c2c2c;
}
.mls-dd-result:focus {
  outline: 2px solid #DDB88B;
  outline-offset: -2px;
}

/* ── Dropdown: result icon circle ──────────────────────────────────────────── */
.mls-dd-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mls-dd-icon--trails   { background: rgba(216,90,48,0.15);  color: #D85A30; }
.mls-dd-icon--maalot   { background: rgba(216,90,48,0.10);  color: #D85A30; }
.mls-dd-icon--sites    { background: rgba(221,184,139,0.15); color: #DDB88B; }
.mls-dd-icon--articles { background: rgba(221,184,139,0.10); color: #DDB88B; }
.mls-dd-icon--regions  { background: rgba(56,56,56,0.6);   color: #aaa; }
.mls-dd-icon svg { display: block; }

/* ── Dropdown: per-result featured thumbnail ────────────────────────────────────
   Rendered in place of .mls-dd-icon when the post has its own image. When absent,
   .mls-dd-icon above is used unchanged (fallback). Rounded square, object-fit cover. */
.maslu-search-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #2c2c2c; /* placeholder tone while the image loads */
}

/* ── Dropdown: result body ──────────────────────────────────────────────────── */
.mls-dd-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.mls-dd-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f4f1eb;
  font-size: 13px;
  line-height: 1.35;
}
.mls-dd-meta {
  display: block;
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Dropdown: no-results state ─────────────────────────────────────────────── */
.mls-dd-no-results {
  padding: 20px 16px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}
.mls-dd-no-results strong { color: #f4f1eb; }

/* ── Dropdown: footer "see all" link ────────────────────────────────────────── */
.mls-dd-footer {
  border-top: 1px solid #383838;
  padding: 0;
}
.mls-dd-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  font-size: 12px;
  color: #DDB88B;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  gap: 4px;
}
.mls-dd-footer a:hover {
  background: #2c2c2c;
  color: #f4f1eb;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TYPE CHIPS — shared between dropdown and /search/ page
   ══════════════════════════════════════════════════════════════════════════════ */

.mls-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
/* מסלול — solid orange */
.mls-chip--trails {
  background: #D85A30;
  color: #fff;
}
/* מעלה — orange outline */
.mls-chip--maalot {
  background: rgba(216,90,48,0.12);
  border: 1px solid #D85A30;
  color: #D85A30;
}
/* אתר — solid gold */
.mls-chip--sites {
  background: #DDB88B;
  color: #1a1a1a;
}
/* כתבה — gold outline */
.mls-chip--articles {
  background: rgba(221,184,139,0.12);
  border: 1px solid #DDB88B;
  color: #DDB88B;
}
/* אזור — dark */
.mls-chip--regions {
  background: #383838;
  color: #f4f1eb;
}

/* ══════════════════════════════════════════════════════════════════════════════
   /SEARCH/ PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.mls-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  direction: rtl;
  min-height: 60vh;
}

/* ── Page header ────────────────────────────────────────────────────────────── */
.mls-page__header {
  margin-bottom: 32px;
}
.mls-page__heading {
  font-size: 28px;
  font-weight: 700;
  color: #f4f1eb;
  margin: 0 0 20px;
  line-height: 1.3;
}
.mls-page__heading strong {
  color: #DDB88B;
}

/* ── Page search input ──────────────────────────────────────────────────────── */
.mls-page__input-wrap {
  position: relative;
  max-width: 560px;
}
.mls-page__input {
  width: 100%;
  padding: 14px 46px 14px 16px;
  background: #222;
  border: 1px solid #383838;
  border-radius: 12px;
  color: #f4f1eb;
  font-family: 'Rubik', sans-serif;
  font-size: 15px;
  direction: rtl;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.mls-page__input:focus {
  outline: none;
  border-color: #DDB88B;
}
.mls-page__input::placeholder { color: #666; }
.mls-page__input-icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: #666;
  pointer-events: none;
}
.mls-page__input.mls-loading {
  border-color: #DDB88B;
  animation: mls-pulse-border 1s ease-in-out infinite;
}

/* ── Summary line ───────────────────────────────────────────────────────────── */
.mls-page__summary {
  font-size: 14px;
  color: #aaa;
  margin: 0 0 28px;
}
.mls-page__summary strong { color: #f4f1eb; }

/* ── Result groups ──────────────────────────────────────────────────────────── */
.mls-page__results {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.mls-group__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #666;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #383838;
}

/* ── Result row ─────────────────────────────────────────────────────────────── */
.mls-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  color: #f4f1eb;
  text-decoration: none;
  border-bottom: 1px solid #2c2c2c;
  transition: opacity 0.15s;
  min-height: 44px;
}
.mls-row:last-child { border-bottom: none; }
.mls-row:hover { opacity: 0.7; }

/* ── Row thumbnail ──────────────────────────────────────────────────────────── */
.mls-row__thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #2c2c2c;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mls-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mls-row__thumb-icon {
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mls-row__thumb-icon svg { width: 28px; height: 28px; }

/* ── Row content ────────────────────────────────────────────────────────────── */
.mls-row__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mls-row__title {
  font-size: 15px;
  font-weight: 600;
  color: #f4f1eb;
  display: block;
  line-height: 1.4;
}
.mls-row__excerpt {
  font-size: 13px;
  color: #aaa;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mls-row__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.mls-row__meta {
  font-size: 12px;
  color: #666;
}

/* ── Empty / no-results states ──────────────────────────────────────────────── */
.mls-page__empty,
.mls-page__no-results {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}
.mls-page__empty svg,
.mls-page__no-results svg {
  display: block;
  margin: 0 auto 20px;
  opacity: 0.3;
}
.mls-page__empty-title,
.mls-page__no-results-title {
  font-size: 20px;
  font-weight: 600;
  color: #f4f1eb;
  margin: 0 0 8px;
}
.mls-page__no-results-title strong { color: #f4f1eb; }
.mls-page__empty-sub,
.mls-page__no-results-sub {
  font-size: 14px;
  color: #666;
  margin: 0 0 20px;
}
.mls-page__no-results-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.mls-page__no-results-chips .mls-chip {
  padding: 6px 14px;
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

  /* Page (dropdown positioning is handled once in the ≤768px block below) */
  .mls-page {
    padding: 24px 16px 60px;
  }
  .mls-page__heading {
    font-size: 22px;
  }
  .mls-row__thumb {
    width: 56px;
    height: 56px;
  }
  .mls-row__title {
    font-size: 14px;
  }
  .mls-row__excerpt {
    font-size: 12px;
  }
  .mls-page__empty,
  .mls-page__no-results {
    padding: 40px 16px;
  }
}

@media (max-width: 360px) {
  .mls-row {
    flex-wrap: wrap;
  }
  .mls-row__thumb {
    width: 48px;
    height: 48px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE FIT (≤768px) — keep the navbar search dropdown inside the viewport.
   The desktop panel is position:absolute; left:0 with a fixed width (main.css),
   which runs off the right edge on phones. Pin it to both screen edges with small
   symmetric margins so it can never overflow. !important defeats main.css's base
   rule (it loads after this file) and Hello Elementor's global resets.
   Mobile-only — the desktop search layout is unchanged.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ml-nav__search-box {
    position: fixed !important;
    top: var(--nav-h, 58px) !important;   /* just below the navbar */
    right: 8px !important;
    left: 8px !important;          /* both insets pinned → width = viewport − 16px */
    width: auto !important;        /* let the insets set width (100% would re-overflow) */
    max-width: 100% !important;
    box-sizing: border-box !important;
    max-height: 70vh;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 12px;
  }

  .ml-search-results {
    max-height: calc(70vh - 60px);
    overflow-x: hidden;
  }

  /* Long Hebrew titles must ellipsize, never widen the panel */
  .mls-dd-result { max-width: 100%; }
  .mls-dd-body   { min-width: 0 !important; }
  .mls-dd-title,
  .mls-dd-meta {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Slightly smaller thumbnail on phones */
  .maslu-search-thumb {
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   MASLULAND SEARCH — SCOPED STYLES (NUCLEAR REBUILD)
   All selectors prefixed with .ml-search-page to prevent leaks
   All SVGs forced to size+color with !important to defeat theme
   ============================================================ */

/* Outer wrapper */
.ml-search-page {
  background: #1a1a1a !important;
  color: #f4f1eb !important;
  font-family: 'Rubik', sans-serif !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}
.ml-search-page * { box-sizing: border-box; }

/* SVG global lockdown — defeats theme overrides */
.ml-search-page svg {
  display: inline-block !important;
  max-width: 100% !important;
  fill: none !important;
  flex-shrink: 0 !important;
}

/* HERO */
.ml-search-page .ml-hero {
  padding: 60px 32px 40px !important;
  background: linear-gradient(180deg, #2c2c2c 0%, #222 100%) !important;
  border-bottom: 1px solid #383838 !important;
  text-align: center !important;
  position: relative !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}
.ml-search-page .ml-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(221, 184, 139, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.ml-search-page .ml-hero::after {
  content: "";
  position: absolute;
  bottom: -50%;
  left: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(216, 90, 48, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.ml-search-page .ml-hero > * {
  position: relative !important;
  z-index: 1 !important;
  max-width: 100% !important;
}

.ml-search-page .ml-hero-icon {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: rgba(221, 184, 139, 0.1) !important;
  border: 1px solid rgba(221, 184, 139, 0.3) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 20px !important;
}
.ml-search-page .ml-hero-icon svg {
  width: 24px !important;
  height: 24px !important;
  stroke: #DDB88B !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.ml-search-page .ml-hero h1 {
  font-size: 32px !important;
  font-weight: 700 !important;
  color: #f4f1eb !important;
  margin: 0 0 10px 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
}
.ml-search-page .ml-hero-sub {
  font-size: 15px !important;
  color: #aaa !important;
  margin: 0 0 28px 0 !important;
}

.ml-search-page .ml-search-box {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  background: #1a1a1a !important;
  border: 1px solid #383838 !important;
  border-radius: 12px !important;
  padding: 16px 20px !important;
  width: 100% !important;
  max-width: 600px !important;
  margin: 0 auto !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}
.ml-search-page .ml-search-box:focus-within {
  border-color: #DDB88B !important;
  box-shadow: 0 0 0 3px rgba(221, 184, 139, 0.1) !important;
}
.ml-search-page .ml-search-box svg {
  width: 18px !important;
  height: 18px !important;
  stroke: #aaa !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}
.ml-search-page .ml-search-box input {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #f4f1eb !important;
  font-family: 'Rubik', sans-serif !important;
  font-size: 16px !important;
  text-align: right !important;
  direction: rtl !important;
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  box-shadow: none !important;
}
.ml-search-page .ml-search-box input::placeholder { color: #666 !important; }

/* SHORTCUTS SECTION */
.ml-search-page .ml-shortcuts {
  background: #1a1a1a !important;
  padding: 36px 32px 60px !important;
}
.ml-search-page .ml-shortcuts-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #666 !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  margin: 0 0 18px 0 !important;
  text-align: center !important;
  padding: 0 !important;
}

.ml-search-page .ml-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 14px !important;
  max-width: 720px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  list-style: none !important;
}

.ml-search-page .ml-card {
  background: #2c2c2c !important;
  border: 1px solid #383838 !important;
  border-radius: 12px !important;
  padding: 24px 16px !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  text-decoration: none !important;
  color: inherit !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}
.ml-search-page .ml-card:hover {
  background: #383838 !important;
  border-color: #DDB88B !important;
  transform: translateY(-2px) !important;
}
.ml-search-page .ml-card-icon {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  margin: 0 0 12px 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.ml-search-page .ml-card svg {
  width: 22px !important;
  height: 22px !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}
.ml-search-page .ml-card-trail .ml-card-icon { background: rgba(216, 90, 48, 0.15) !important; }
.ml-search-page .ml-card-trail svg { stroke: #D85A30 !important; }
.ml-search-page .ml-card-maale .ml-card-icon { background: rgba(216, 90, 48, 0.10) !important; }
.ml-search-page .ml-card-maale svg { stroke: #D85A30 !important; }
.ml-search-page .ml-card-atar .ml-card-icon { background: rgba(221, 184, 139, 0.15) !important; }
.ml-search-page .ml-card-atar svg { stroke: #DDB88B !important; }
.ml-search-page .ml-card-article .ml-card-icon { background: rgba(221, 184, 139, 0.10) !important; }
.ml-search-page .ml-card-article svg { stroke: #DDB88B !important; }

.ml-search-page .ml-card-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #f4f1eb !important;
  margin: 0 0 4px 0 !important;
}
.ml-search-page .ml-card-count {
  font-size: 12px !important;
  color: #aaa !important;
  margin: 0 !important;
}

/* MOBILE */
@media (max-width: 768px) {
  .ml-search-page { margin: 16px !important; }
  .ml-search-page .ml-hero { padding: 40px 20px 30px !important; }
  .ml-search-page .ml-hero h1 { font-size: 26px !important; }
  .ml-search-page .ml-shortcuts { padding: 28px 20px 40px !important; }
  .ml-search-page .ml-cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
