/* צבעי המותג – להחליף כשיגיעו הצבעים של החברה */
:root {
  --brand: #1f5fbf;
  --brand-dark: #133d7d;
  --brand-soft: #eaf1fd;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #5d6779;
  --border: #e3e8ef;
  --whatsapp: #128c7e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding-inline: 16px;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* חלק עליון */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 20px 0 72px;
}
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* הלוגו – הרקע שלו לבן, לכן הוא יושב על כרטיס לבן קטן */
.brand {
  display: inline-flex;
  padding: 4px 8px;
  background: #fff;
  border-radius: 12px;
}
.brand img {
  display: block;
  width: auto;
  height: 44px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-decoration: none;
  font-size: .95rem;
  opacity: .9;
}
.back:hover { opacity: 1; }
.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 36px 0 6px;
}
.hero p {
  margin: 0;
  font-size: 1.05rem;
  opacity: .85;
}

main {
  margin-top: -48px;
  padding-bottom: 32px;
}

/* כרטיס לבן */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
}

.icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.label {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.label strong { font-weight: 700; }
.label small { color: var(--muted); font-size: .88rem; }

/* בחירת דגם */
.model-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.model-link + .model-link { margin-top: 8px; }
.model-link:hover { border-color: var(--brand); background: var(--brand-soft); }
.model-link .arrow { margin-inline-start: auto; color: var(--muted); }

/* נושאים */
.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--muted);
  margin: 28px 4px 10px;
}
.topics { display: grid; gap: 10px; }
.topic {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.topic summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.topic summary::-webkit-details-marker { display: none; }
.topic summary:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; border-radius: var(--radius); }
.topic .chevron { margin-inline-start: auto; color: var(--muted); transition: transform .2s; }
.topic[open] .chevron { transform: rotate(180deg); }
.topic .body { padding: 0 16px 16px; }
.topic ol { margin: 0; padding-inline-start: 22px; }
.topic li { margin-bottom: 6px; }

/* תמונות הדגמים – 2 בשורה בטלפון, 4 במחשב */
.device-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.device-gallery a { color: inherit; text-decoration: none; }
.device-gallery a:hover img,
.device-gallery a:focus-visible img { border-color: var(--brand); }
.device-gallery a:hover figcaption { color: var(--brand); }
.device-gallery figure { margin: 0; text-align: center; }
.device-gallery img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 6 / 5;
  object-fit: contain;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.device-gallery figcaption { margin-top: 6px; font-weight: 700; font-size: .9rem; }

/* דף של דגם אחד: תמונה גדולה במקום הגלריה (model.js) */
.model-photo { text-align: center; }
.model-photo img {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  max-height: 300px;
  margin: 0 auto;
  object-fit: contain;
}
.model-photo a { display: inline-block; margin-top: 8px; color: var(--brand); font-size: .9rem; }

/* יצירת קשר */
.contact { margin-top: 28px; text-align: center; }
.contact h2 { margin: 0 0 4px; font-size: 1.25rem; }
.contact p { margin: 0 0 16px; color: var(--muted); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  flex: 1 1 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.whatsapp { background: var(--whatsapp); }
.btn.whatsapp:hover { background: #0e6f64; }

/* סימון תוכן זמני – להסיר כשמגיע התוכן האמיתי */
.todo {
  margin: 0;
  padding: 10px 12px;
  background: #fff8e1;
  color: #7a5c00;
  border: 1px dashed #e0b84d;
  border-radius: 10px;
  font-size: .95rem;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 8px 16px 96px; /* מקום לכפתור הצ'אט הצף */
}

/* שורת חיפוש בחלק העליון */
.ask {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  padding: 6px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.ask:focus-within { outline: 3px solid rgba(255, 255, 255, .5); }
.ask .search-icon { margin-inline-start: 8px; color: var(--muted); }
.ask input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  appearance: none;
}
.ask input::placeholder { font-size: .9rem; } /* שהדוגמה תיכנס גם בטלפון צר (360px) */

/* תוצאות החיפוש – נפתחות מתחת לשורת החיפוש */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 40;
  padding: 6px;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .2);
}
.search-results ul { list-style: none; margin: 0; padding: 0; }
.search-results ul a {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  line-height: 1.35;
}
.search-results ul a:hover,
.search-results ul a:focus-visible { background: var(--brand-soft); outline: none; }
.search-results small { color: var(--muted); font-size: .88rem; }
.search-results .search-empty { margin: 0; padding: 10px 12px; font-size: 1rem; opacity: 1; }
.search-empty a { color: var(--brand); font-weight: 700; white-space: nowrap; }
.search-notice { padding: 10px 12px; }
.search-results .search-notice p { margin: 0 0 4px; font-size: 1rem; opacity: 1; }
.search-notice a { color: var(--brand); font-weight: 700; }

.chat-form button {
  flex-shrink: 0;
  width: 46px;
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.chat-form button:hover { background: var(--brand-dark); }
.chat-form button:disabled { opacity: .5; cursor: default; }
.send-icon { transform: scaleX(-1); }

/* כפתור צ'אט צף */
.chat-launcher {
  position: fixed;
  bottom: 16px;
  inset-inline-end: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(19, 61, 125, .35);
  cursor: pointer;
}
.chat-launcher:hover { background: var(--brand-dark); }

/* חלון הצ'אט – בטלפון מסך מלא */
.chat {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.chat:focus { outline: none; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}
.chat-head .label small { color: rgba(255, 255, 255, .8); }
.chat-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}
.chat-close {
  margin-inline-start: auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.chat-close:hover { background: rgba(255, 255, 255, .15); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 14px;
  background: var(--bg);
}
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  white-space: pre-line;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-start-start-radius: 4px;
}
.msg.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-start-end-radius: 4px;
}
.msg .sources {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .8rem;
}
/* תשובה מההוראות באתר (הבוט בלי AI) */
.msg.answer { white-space: normal; max-width: 92%; }
.answer-title { display: block; margin-bottom: 4px; }
.msg.answer p { margin: 0 0 6px; }
.msg.answer ol { margin: 0; padding-inline-start: 20px; }
.msg.answer ul { margin: 4px 0 0; padding-inline-start: 18px; }
.msg.answer li { margin-bottom: 4px; }
.answer-link { display: inline-block; margin-top: 4px; color: var(--brand); font-weight: 700; }
.answer-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
}
.msg a[href^="tel:"] { color: var(--brand); font-weight: 700; white-space: nowrap; }
.msg.typing { display: inline-flex; gap: 4px; padding-block: 14px; }
.msg.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite;
}
.msg.typing span:nth-child(2) { animation-delay: .2s; }
.msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 12px;
  background: var(--bg);
}
.chip {
  padding: 6px 12px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}
.chip:hover { background: var(--brand-soft); }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  font: inherit;
}
.chat-form input:focus { border-color: var(--brand); }
html.chat-open { overflow: hidden; }

/* דף ניהול */
.hero-small { padding-bottom: 64px; }
.hero-small h1 { font-size: 1.6rem; margin-top: 24px; }
button.back { background: none; border: 0; font: inherit; cursor: pointer; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-weight: 500; }
.stack input[type="text"],
.stack input[type="password"],
.stack select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.stack input[type="file"] { font: inherit; font-weight: 400; }
.stack input:focus,
.stack select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.stack .btn { justify-self: start; border: 0; font-family: inherit; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }
.form-msg { margin: 0; min-height: 1.2em; font-size: .95rem; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .95rem; cursor: pointer; }
.manual-list,
.question-list { list-style: none; margin: 0; padding: 0; }
.manual-list li,
.question-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.manual-list li:last-child,
.question-list li:last-child { border-bottom: 0; }
.manual-list .label,
.question-list .label { flex: 1; min-width: 0; }
.question-list strong { font-weight: 500; }
.question-list li.missing small { color: #b42318; }
.empty { color: var(--muted); }
.btn-delete {
  padding: 6px 12px;
  border: 1px solid #f0c2bd;
  border-radius: 8px;
  background: #fff5f4;
  color: #b42318;
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}
.btn-delete:hover { background: #fde8e6; }

@media (min-width: 600px) {
  .hero h1 { font-size: 2.4rem; }
  .brand img { height: 56px; }
  .panel { padding: 22px; }
  .device-gallery { grid-template-columns: repeat(4, 1fr); }

  /* במחשב – חלון קטן בפינה */
  .chat {
    inset: auto;
    bottom: 16px;
    inset-inline-end: 16px;
    width: 380px;
    height: min(600px, calc(100vh - 32px));
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(16, 24, 40, .25);
    overflow: hidden;
  }
  html.chat-open { overflow: auto; }
}
