:root {
  --navy: #16324f;
  --navy-dark: #0f2438;
  --gold: #a8763f;
  --bg: #f5f3ee;
  --card-bg: #ffffff;
  --border: #e2ddd0;
  --text: #1c2b38;
  --text-muted: #5b6b78;
  --error: #b23b3b;
}

* { box-sizing: border-box; }

/* בלי זה, כל class שמגדיר display:flex/grid (כמו .box-row, .box-subfields)
   "מנצח" את חוק ברירת המחדל של הדפדפן ל-[hidden], כי שתי הכללים באותה
   ספציפיות - התוצאה: אלמנט עם hidden="true" עדיין נראה על המסך. זו הייתה
   באג אמיתי כאן (division-subfields/panel-config-field/glass-thickness-field
   כולם נשארו גלויים למרות hidden), לא רק תיאורטי - חוק בטיחות גורף. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 24px 16px 64px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  direction: rtl;
}

.site-header {
  text-align: center;
  margin-bottom: 28px;
}

.site-header h1 {
  color: var(--navy);
  font-size: 32px;
  margin: 0 0 4px;
}

.site-header .accent { color: var(--gold); }

.site-header .tagline {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

.hero-section {
  max-width: 900px;
  margin: 0 auto 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.hero-image {
  flex: 0 0 42%;
}
.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}
.hero-text {
  flex: 1;
}
.hero-text h2 {
  color: var(--navy);
  font-size: 24px;
  margin: 0 0 12px;
  line-height: 1.35;
}
.hero-text p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

.factors-section {
  max-width: 900px;
  margin: 0 auto 40px;
}
.factors-title {
  color: var(--navy);
  font-size: 22px;
  text-align: center;
  margin: 0 0 8px;
}
.factors-intro {
  color: var(--text-muted);
  text-align: center;
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: 14px;
  line-height: 1.6;
}
.factor-row {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.factor-row-reverse {
  flex-direction: row-reverse;
}
.factor-image {
  flex: 0 0 200px;
}
.factor-image img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}
.factor-text {
  flex: 1;
}
.factor-text h3 {
  color: var(--navy);
  font-size: 17px;
  margin: 0 0 6px;
}
.factor-text p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 640px) {
  .hero-section {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
  }
  .hero-image { flex: none; width: 100%; }
  .factor-row, .factor-row-reverse {
    flex-direction: column;
  }
  .factor-image { flex: none; width: 100%; }
}

.card, .settings-card {
  max-width: 480px;
  margin: 0 auto 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.owner-lock-bar {
  max-width: 480px;
  margin: 0 auto 16px;
  text-align: center;
}
.owner-lock-bar button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.owner-pin-prompt {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.owner-pin-prompt input {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.owner-lock-bar-inline {
  margin: 12px auto 16px;
}
.owner-lock-bar-inline button {
  background: #fff8e6;
  border-color: #e6c56b;
  color: #8a6d1c;
  font-weight: 600;
}

.lead-gate-title {
  margin: 0 0 4px;
  font-size: 19px;
  color: var(--navy);
  text-align: center;
}

.lead-gate-subtitle {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
}

.lead-gate-privacy {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.field {
  margin-bottom: 16px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.box-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.box {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.box .field { margin-bottom: 0; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--navy);
}

.checkbox-label input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--navy);
}

.radio-row {
  display: flex;
  gap: 18px;
}

.box-subfields {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.box-subfields .field { flex: 1; margin-bottom: 0; }

.field-row .field {
  flex: 1;
}

/* עובי הזכוכית נפתח קומפקטי וצמוד לצד בחירת הסוג, לא במקום נפרד למטה -
   רוחב קבוע קטן (לא flex:1 שווה) כי "6 מ״מ" צריך הרבה פחות מקום מהשם. */
.glass-thickness-compact {
  flex: 0 0 110px;
}

/* שורה אחת, קבועה, לכל אורך הרוחב - "כמה כנפיים" + סוג כנף + סוג מסילה,
   שלוש קטגוריות זו-ליד-זו, *אף פעם* לא נשברת לשתי שורות (flex-wrap: nowrap
   בכוונה, לא wrap) - כל שדה מקבל חלק שווה מהרוחב (flex:1) ומתכווץ לפי הצורך
   (min-width:0) במקום לגלוש לשורה הבאה. */
.panel-config-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  width: 100%;
}

/* "כמה כנפיים" הוא רק מספר קצר (1-6) - לא צריך להיות רחב כמו "סוג כנף"/
   "סוג מסילה" (שיש בהם טקסט ארוך + אייקון). flex קבוע קטן, לא חולק שווה עם
   השניים האחרים - כדי לפנות להם יותר רוחב (ולאייקונים שלהם, ראו .icon-list-
   row img, מקום להיות קצת יותר גדולים). */
.panel-count-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 64px;
  min-width: 0;
}

.panel-count-field label { margin-bottom: 0; }
.panel-count-field input { width: 100%; min-width: 0; }

.track-count-inline-note {
  font-size: 11px;
  color: var(--text-muted);
}

.option-chip-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.option-chip-group-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* "icon select" - סגור: נראה ותופס מקום בדיוק כמו <select> רגיל (אותו
   border/padding/font כמו הכלל של select למטה). פתוח: נפתחת מעליו/מתחתיו
   תיבה צפה (overlay, לא דוחפת תוכן) עם רשימת האפשרויות (.icon-list-row). */
.icon-select {
  position: relative;
}

.special-accessory-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.special-accessory-row .icon-select {
  flex: 1;
  min-width: 0;
}

.special-accessory-clear {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--error);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.special-accessory-clear:hover { background: #f3e0e0; }

.icon-select-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: right;
}

/* הטקסט הנבחר יכול להיות ארוך ("מסילה רגילה - תחתונה 19 מ״מ (3 נתיבים)") -
   נחתך בשלוש נקודות בתוך השדה הצר (חלק משלושה מרוחב השורה האחת), לא דוחף
   את השורה החוצה. הכותרת המלאה עדיין נגישה ב-title (tooltip). */
.icon-select-trigger span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.icon-select-trigger:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.icon-select-arrow {
  color: var(--text-muted);
  font-size: 11px;
  flex: 0 0 auto;
}

.icon-select-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, 80vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(22, 50, 79, 0.18);
  padding: 6px;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}

/* רשימה קטנה - שורה אחת לכל אפשרות (אייקון קטן + טקסט זה-לצד-זה) בתוך
   הפופאובר של icon-select. */
.icon-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
}

/* מוצג בתוך תפריט icon-select ריק (אין אפשרויות עם מחיר>0 עדיין) - בלי זה
   התפריט "נפתח" אבל ריק לגמרי, שנראה בדיוק כמו "לא נפתח" ללקוח/למוכר. */
.icon-select-empty-state {
  padding: 10px 8px;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 220px;
  white-space: normal;
  line-height: 1.5;
}

.icon-list-row:hover { background: var(--bg); }

.icon-list-row input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.icon-list-row img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex: 0 0 auto;
}

.icon-list-row span {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}

.icon-list-row:has(input:checked) {
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--navy);
}

.icon-list-row:has(input:focus-visible) {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

/* גלריית "אביזרים" (ידית/סגר/מנעול) - אייקונים גדולים בהרבה מהשדות האחרים
   (50px). הלקוח ביקש שיהיה אפשר לזהות בבירור מה רואים - זו תמונת מוצר
   אמיתית (לא סמל סכמטי כמו מסילה/פרופיל-צד), חייבת להיות גדולה כדי להיראות. */
#special-accessory-grid.icon-select-panel {
  max-width: min(420px, 90vw);
}

#special-accessory-grid .icon-list-row img {
  width: 90px;
  height: 90px;
}

#special-accessory-grid .icon-list-row span {
  font-size: 13px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

select, input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

select:focus, input:focus {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.submit-btn:hover { background: var(--navy-dark); }

.error-msg {
  color: var(--error);
  font-size: 13px;
  min-height: 18px;
  margin: 4px 0 0;
}

.result {
  max-width: 480px;
  margin: 0 auto 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.result-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--navy);
  margin: 6px 0;
}

.result-detail {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.breakdown {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-muted);
}

.breakdown-row { margin: 4px 0; }

.disclaimer {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 14px 0 0;
}

.quote-list {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}

.quote-list-title {
  font-size: 15px;
  color: var(--navy);
  margin: 0 0 12px;
}

.quote-items {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-items-final {
  text-align: right;
}

.quote-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.quote-item-info { flex: 1; }

.quote-item-diagram {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.quote-item-diagram svg { display: block; }

.quote-item-desc {
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 2px;
}

.quote-item-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.quote-item-price-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.quote-item-qty {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cost-breakdown {
  margin-top: 6px;
}

.cost-breakdown summary {
  font-size: 11px;
  color: var(--navy);
  cursor: pointer;
  width: fit-content;
}

.cost-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0 2px 4px;
  max-width: 260px;
}

.quantity-field input {
  max-width: 120px;
}

.quote-item-remove {
  background: none;
  border: none;
  color: var(--error);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.quote-item-remove:hover { background: #f3e0e0; }

.quote-list-total {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  margin-bottom: 14px;
}

.quote-list-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  padding: 3px 0;
}

.quote-list-total-row-final {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.secondary-btn {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--navy);
  margin-top: 16px;
}

.secondary-btn:hover { background: var(--bg); }

.final-delivery-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.final-delivery-actions .submit-btn {
  flex: 1 1 0;
  margin-top: 0;
  font-size: 14px;
}

.pdf-btn {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.pdf-status {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  margin: 8px 0 0;
}

/* ===== תבנית ה-PDF (מוצגת מחוץ למסך, נלכדת ל-canvas ע"י html2canvas) =====
   מעוצבת כמסמך הצעת מחיר עצמאי - לא עותק של מסך האתר - עם לוגו/כותרת,
   פרטי לקוח, טבלת פריטים עם תרשים גדול לכל פריט, ופירוק מחיר בתחתית. */
.pdf-template {
  position: fixed;
  top: 0;
  left: -99999px;
  width: 780px;
  background: #ffffff;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  direction: rtl;
  padding: 40px;
  box-sizing: border-box;
}

.pdf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 3px solid var(--navy);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.pdf-brand-name {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
}

.pdf-brand-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pdf-doc-title {
  text-align: left;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.pdf-doc-date {
  text-align: left;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.pdf-customer-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  gap: 32px;
  font-size: 13.5px;
}

.pdf-customer-box b { color: var(--navy); }

.pdf-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.pdf-items-table th {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--navy);
  padding: 0 10px 10px;
}

.pdf-items-table td {
  border-bottom: 1px solid var(--border);
  padding: 14px 10px;
  font-size: 13.5px;
  vertical-align: middle;
}

.pdf-item-index {
  width: 28px;
  color: var(--text-muted);
  font-size: 13px;
}

.pdf-item-diagram-cell {
  width: 130px;
  text-align: center;
}

.pdf-item-diagram-cell svg { display: block; margin: 0 auto; }

.pdf-item-breakdown {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.pdf-item-qty {
  width: 50px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.pdf-item-price {
  width: 120px;
  text-align: left;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}

.pdf-item-unit-price {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.pdf-breakdown {
  margin-right: auto;
  width: 320px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.pdf-breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.pdf-breakdown-row-total {
  background: var(--navy);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border-bottom: none;
}

.pdf-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 22px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.pdf-footer-contact {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.tier-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 12px;
}

.tier-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.tier-row-label {
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.tier-field {
  flex: 1;
  min-width: 90px;
}

.tier-field label {
  font-size: 11.5px;
  margin-bottom: 3px;
}

.tier-field input { width: 100%; }

.settings-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  font-size: 14px;
}

.settings-body {
  margin-top: 16px;
}

.price-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price-row label {
  margin: 0;
  flex: 1;
  color: var(--text);
  font-size: 14px;
}

.price-row input {
  width: 110px;
}

.price-row-thumb {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--bg);
  flex: 0 0 auto;
}

.settings-subhead {
  font-size: 12.5px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 20px 0 8px;
}

.glass-type-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 0 14px;
}

.glass-type-group summary {
  padding: 10px 0;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.glass-type-group .price-list {
  padding-bottom: 12px;
}

.settings-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 24px;
}

.lead-backup-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.lead-backup-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.lead-backup-detail {
  font-size: 12px;
  color: var(--text-muted);
}
