/* פלטה ניטרלית עד שיש מותג: כחול כהה על נייטרלים קרים. החלפת מותג היא
   שינוי של --accent ו---accent-dark בלבד. שמות שאר המשתנים זהים לקמפיינים
   הקודמים. */
:root {
  --accent: #0b2a6b;
  /* שגיאות באדום ובולט (בקשת יוסי, 27.9.2026): כחול הכהה נבלע בטופס. */
  --error: #c62828;
  --error-bg: #fdecea;
  --accent-dark: #071b47;
  --text-dark: #14100e;
  --text-brown: #43413f;
  --text-muted: #86807b;
  --bg-cream: #f7f6f5;
  --bg-white: #ffffff;
  --border-light: #e4e1de;
  --gold-accent: #0b2a6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Segoe UI", sans-serif;
  background: var(--bg-cream);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

/* ===== גרסת דסקטופ: מיכל רחב ומרווח ===== */
.app-shell {
  width: 100%;
  max-width: 1080px;
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(26, 15, 8, 0.10);
  border: 1px solid var(--border-light);
  padding: 44px 56px 52px;
  position: relative;
}

/* לקובץ הלוגו יש שוליים לבנים מובנים - הגובה הקבוע + overflow קוצצים אותם */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  height: 63px;
  overflow: hidden;
  margin-bottom: 18px;
}

.brand-logo {
  width: 175px;
  max-width: 100%;
  height: auto;
}

/* לוגו מותג משני בכותרת - ממודד לפי גובה כדי לשבת לצד לוגו המילטון */
.brand-header .brand-logo--secondary {
  width: auto;
  height: 56px;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-light);
  transition: background 0.25s ease;
}

.dot.active {
  background: var(--accent);
}

.screen {
  display: none;
  animation: fade-in 0.3s ease;
}

.screen.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  text-align: center;
  margin-bottom: 36px;
}

.screen-header h1 {
  font-size: 2rem;
  color: var(--text-dark);
  margin: 0 0 10px;
}

.screen-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.05rem;
}

/* ===== טופס: שתי עמודות בדסקטופ ===== */
.details-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  max-width: 820px;
  margin: 0 auto;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* מאפשר לשדות להצטמצם בתוך תא ה-grid */
}

/* שדות שנפרסים על כל הרוחב (חשבונית, כפתורים) */
.field-group--full,
.details-form .form-actions {
  grid-column: 1 / -1;
}

.field-group label {
  font-size: 0.95rem;
  color: var(--text-brown);
  font-weight: 600;
}

.field-group input {
  width: 100%;
  min-width: 0; /* מונע גלישה של input[type=file] שרוחבו המובנה גדול מהתא */
  padding: 13px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--bg-white);
  outline: none;
  transition: border-color 0.2s ease;
}

.field-group input:focus {
  border-color: var(--accent);
}

.field-group input.invalid {
  border-color: var(--error);
  background: var(--error-bg);
}

.error-msg {
  color: var(--error);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  min-height: 1em;
}

/* עיגול "!" לפני כל הודעה שאינה ריקה */
.error-msg:not(:empty)::before {
  content: "!";
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--error);
  color: #ffffff;
  font-size: 0.8em;
  line-height: 1.1em;
  text-align: center;
  vertical-align: 0.05em;
}

/* שגיאת שליחה: הודעה ברוחב מלא מעל כפתור האישור, לא ליד שדה בודד */
.error-msg--submit {
  display: block;
  text-align: center;
  font-size: 1rem;
  padding: 10px 14px;
  border: 1.5px solid var(--error);
  border-radius: 8px;
  background: var(--error-bg);
  margin-bottom: 8px;
}

.error-msg--submit:empty {
  display: none;
}

/* בורר רשת שיווק */
/* auto-fit ולא מספר עמודות קבוע: הוספת רשת ל-stores.json לא תדרוש שוב
   עריכת CSS, כפי שקרה כשנוספה הרשת השישית.
   ה-min רחב כי כל אריח מציג לוגו של רשת ולא את שמה. */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.store-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 14px 18px;
  background: var(--bg-white);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

/* קופסה בגובה קבוע בכל אריח. הלוגואים נחתכים עד לדיו שלהם,
   ולכן גובה אחיד כאן מציב את כולם על אותו קו אמצע. */
.store-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
}

.store-logo {
  /* לא 100%: לוגו רחב כמו מחסני חשמל היה נוגע בשולי האריח. */
  max-width: 94%;
  max-height: 100%;
  object-fit: contain;
  /* מחסני חשמל וטרקלין מגיעים על רקע מותג אטום. */
  border-radius: 4px;
}

.store-tile:hover {
  transform: translateY(-2px);
  border-color: var(--gold-accent);
}

.store-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(11, 42, 107, 0.18);
  background: var(--bg-cream);
}

.store-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.store-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-brown);
  text-align: center;
}

.store-other-input {
  width: 100%;
  min-width: 0;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.store-other-input:focus {
  border-color: var(--accent);
}

@media (max-width: 900px) {
  /* 4 עמודות ל-12 רשתות => 4+4+4. */
  .store-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  .store-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .store-tile { min-height: 72px; padding: 12px 10px; }
  .store-logo-box { height: 36px; }
  .store-name { font-size: 0.85rem; }
}

.file-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.field-group input[type="file"] {
  padding: 11px 14px;
  font-size: 0.9rem;
  background: var(--bg-cream);
  cursor: pointer;
}

/* ===== כפתורים: ממורכזים ולא נמתחים לכל הרוחב ===== */
.form-actions {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  justify-content: center;
}

.primary-button, .secondary-button {
  flex: 0 1 240px;
  padding: 14px 28px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.primary-button {
  background: var(--accent);
  color: var(--bg-white);
}

.primary-button:not(:disabled):hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  background: var(--border-light);
  color: var(--text-muted);
  cursor: not-allowed;
}

.primary-button:not(:disabled):active {
  transform: scale(0.98);
}

.secondary-button {
  background: var(--bg-cream);
  color: var(--text-brown);
  border: 1.5px solid var(--border-light);
}

.secondary-button:hover {
  border-color: var(--gold-accent);
}

.secondary-button:active {
  transform: scale(0.98);
}

/* ===== רשת הדגמים =====
   שלושה כרטיסים לחיצים בראש הטופס. <button> ולא <div>: מקלדת צריכה להגיע
   אליהם. שלושה בשורה בדסקטופ, אחד מתחת לשני במובייל צר. */
.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.model-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 14px;
  background: var(--bg-white);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.model-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.model-card.selected {
  border-color: var(--accent);
  background: #f2f5fb;
  box-shadow: 0 6px 16px rgba(11, 42, 107, 0.16);
}

.model-card-image {
  width: 100%;
  max-width: 150px;
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 8px;
}

.model-card h3 {
  font-size: 0.95rem;
  line-height: 1.3;
  margin: 0 0 4px;
  color: var(--text-dark);
}

.model-card-sku {
  font-size: 0.78rem;
  color: var(--text-muted);
  direction: ltr;
}

/* ===== הסבר לפני הטופס =====
   השיווק ביקש שהדף יסביר בבירור שזו בקשת רישום ולא אישור. הבלוק יושב לפני
   הטופס ולא בפוטר, כדי שייקרא לפני שממלאים. */
.intro-note {
  max-width: 820px;
  margin: 0 auto 28px;
  padding: 16px 20px;
  border: 1px solid var(--border-light);
  border-right: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-cream);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-brown);
}

.intro-note p {
  margin: 0 0 10px;
}

.intro-note p:last-child {
  margin-bottom: 0;
}

.intro-note-secondary {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== מדריך IMEI =====
   <details> סגור כברירת מחדל מתחת לשדה. האיור רחב (960px) ומתכווץ לרוחב
   הטופס; במובייל הוא נהיה צר מדי לקריאה, ולכן שם הצעדים בטקסט הם העיקר. */
.imei-guide {
  margin-top: -6px;
  padding: 0;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-white);
}

.imei-guide summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.imei-guide summary::-webkit-details-marker {
  display: none;
}

.imei-guide summary::before {
  content: "▸";
  display: inline-block;
  margin-left: 8px;
  transition: transform 0.2s ease;
}

.imei-guide[open] summary::before {
  transform: rotate(-90deg);
}

.imei-guide-image {
  display: block;
  width: 100%;
  height: auto;
  padding: 0 12px;
}

.imei-guide-steps {
  margin: 12px 16px 0;
  padding-right: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-brown);
}

.imei-guide-steps li {
  margin-bottom: 4px;
}

.imei-guide-note {
  margin: 10px 16px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.store-notice a,
.intro-note a {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
}

/* הודעה שנפתחת כשנבחר אריח "אתר שיאומי / MI STORE" */
.store-notice {
  margin: 10px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-cream);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-brown);
}

.store-notice[hidden] {
  display: none;
}

.link-button {
  background: none;
  border: none;
  padding: 0 4px;
  color: var(--accent);
  font: inherit;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

/* ===== מסך אישור ===== */
.confirm-panel {
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}

.confirm-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.confirm-details {
  background: var(--bg-cream);
  border-radius: 10px;
  padding: 22px 28px;
  margin: 26px 0;
  text-align: right;
  border: 1px solid var(--border-light);
}

.confirm-details div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.confirm-details div:last-child {
  border-bottom: none;
}

.confirm-details dt {
  color: var(--text-muted);
}

.confirm-details dd {
  margin: 0;
  font-weight: 600;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

/* ===== התאמה למסכים בינוניים (טאבלט) ===== */
@media (max-width: 900px) {
  body { padding: 32px 20px; }

  .app-shell {
    padding: 32px 28px 36px;
  }

  .screen-header h1 { font-size: 1.6rem; }

  .details-form {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ===== התאמה למסכים קטנים (מובייל) ===== */
@media (max-width: 560px) {
  body { padding: 20px 12px; }

  .app-shell {
    padding: 24px 18px 30px;
    border-radius: 12px;
  }

  .brand-header { height: 49px; gap: 14px; }
  .brand-logo { width: 133px; }
  .brand-header .brand-logo--secondary { height: 44px; }

  .screen-header { margin-bottom: 24px; }
  .screen-header h1 { font-size: 1.35rem; }
  .screen-header p { font-size: 0.95rem; }

  /* אחד מתחת לשני: שלושה בשורה היו מקטינים את התמונות עד שלא מבדילים
     בין Pro ל-Pro Max. */
  .model-grid { grid-template-columns: 1fr; gap: 10px; }
  .model-card { flex-direction: row; gap: 14px; text-align: right; padding: 10px 14px; }
  .model-card-image { width: 72px; margin-bottom: 0; }
  .intro-note { font-size: 0.9rem; padding: 14px 16px; }

  .form-actions { flex-direction: column-reverse; }
  .primary-button, .secondary-button { flex: 1 1 auto; width: 100%; }

  /* מונע זום אוטומטי ב-iOS Safari - שדה קלט מתחת ל-16px גורם להגדלה בפוקוס */
  .field-group input,
  .field-group input[type="file"] {
    font-size: 16px;
  }

  /* פרטי האישור: תווית מעל הערך, כדי שערכים ארוכים (אימייל) לא יגלשו מהתיבה */
  .confirm-details {
    padding: 16px 18px;
  }

  .confirm-details div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 0;
    font-size: 0.95rem;
  }
}

/* ===== תיבות אישור: תקנון (חובה) ודיוור (רשות) =====
   בתוך מסגרת אחת, כמו בדף של Melitta, כדי ששתיהן ייקראו כיחידה אחת
   בסוף הטופס ולא ייעלמו בין השדות. */
.consent-group {
  margin-top: 4px;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: normal;
  line-height: 1.5;
  color: var(--text-muted);
  cursor: pointer;
}

/* הודעת שגיאה ריקה לא תופסת מקום בתוך התיבה: בלעדיה יש שורה ריקה של 1em
   אחרי כל checkbox והמסגרת יוצאת גבוהה מלמטה. הגובה חוזר רק כשיש טקסט. */
.consent-group .error-msg {
  min-height: 0;
}

.consent-group .error-msg:empty {
  display: none;
}

.consent-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===== תנאי המבצע ===== */
.campaign-terms {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.campaign-terms p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ===== שער התצורה =====
   מופיע רק אם מק״ט או כתובת ה-webhook עדיין placeholder. בכוונה צעקני:
   הוא קיים כדי שדף חצי-מוגדר לא יגיע לאוויר בשקט. */
.config-banner {
  background: #7a1200;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1.5;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

/* שדה ה-IMEI מוצג משמאל לימין, כמו במכשיר. */
.field-group input[dir="ltr"] {
  text-align: left;
  letter-spacing: 0.06em;
}

/* קישורי התקנון והפרטיות - מודגשים בתוך משפט אפרפר, כדי שיהיה ברור
   שיש מה ללחוץ עליו לפני שמאשרים. */
.consent-label a {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
}

.consent-label a:hover {
  color: var(--accent-dark);
}

/* הערת מסך התודה. מסך זה הוא התיעוד היחיד שהלקוח מקבל כל עוד מייל
   האישור לא מגיע, ולכן ההערה בולטת מספיק כדי להיקרא ולא מספיק כדי
   להתחרות בפרטי ההרשמה עצמם. */
.confirm-note {
  margin: 18px auto 22px;
  max-width: 420px;
  padding: 12px 16px;
  background: var(--bg-cream);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-brown);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* פרטי החברה מתחת לשורת התנאים - נדרשים בתקנון וטוב שיהיו גלויים */
.campaign-terms-company {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.campaign-terms a {
  color: var(--text-muted);
  text-decoration: underline;
}
