/* Flexi Modeler - לפי UI-STYLE-GUIDE.md.
   הכל תחום תחת .flexi-app כדי לא להתנגש בערכת עיצוב של וורדפרס. */
.flexi-app {
  --bg: #0d1117;
  --panel: #12161e;
  --card: #161b24;
  --line: rgba(255,255,255,.14);
  --text: #e8ecf2;
  --muted: #98a2b3;
  --accent: #dca24a;
  --accent-soft: #d3a05a;
  --accent2: #2f86ff;
  --ok: #33bd6b;
  --input: #10151d;
  --on-brand: #201603;
  --flexi-height: 100vh;

  direction: rtl;
  display: flex; flex-direction: column;
  height: var(--flexi-height); min-height: 560px;
  background: var(--bg); color: var(--text);
  font-family: "Rubik", "Segoe UI", system-ui, sans-serif;
  font-size: 16px; line-height: 1.35;
  overflow: hidden;
}
.flexi-app *, .flexi-app *::before, .flexi-app *::after { box-sizing: border-box; }
.flexi-app [hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.flexi-app .topbar { flex-shrink: 0; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: baseline; gap: 14px; }
.flexi-app .topbar h1 { margin: 0; font-size: 20.8px; font-weight: 800; color: var(--accent); letter-spacing: .3px; }
.flexi-app .topbar .sub { font-size: 13.6px; color: var(--muted); }
.flexi-app .topbar { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.flexi-app .topbar .brand { display: flex; align-items: baseline; gap: 14px; }
.flexi-app .topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.flexi-app .topbar .topbar-actions button { width: auto; font-size: 12.8px; padding: 7px 12px; }
.flexi-app button.ghost.accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.flexi-app button.ghost.accent:hover:not(:disabled) {
  background: rgba(220,162,74,.12); border-color: var(--accent-soft); color: var(--accent-soft); }

/* ---------- Layout ---------- */
.flexi-app .main { display: flex; flex: 1; min-height: 0; }
.flexi-app .panel { width: 340px; flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 14px; }
.flexi-app .viewport { position: relative; flex: 1; min-width: 0; overflow: hidden;
  background: radial-gradient(ellipse at center, #121823 0%, var(--bg) 70%); }
.flexi-app .viewport canvas { display: block; width: 100%; height: 100%; }
.flexi-app .view2d, .flexi-app .view3d { position: absolute; inset: 0; }

/* ---------- Card ---------- */
.flexi-app .card { background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 12px; margin-bottom: 6px; }
.flexi-app .card h2 { font-size: 15.2px; color: var(--accent); margin: 0 0 8px;
  font-weight: 700; letter-spacing: .2px; }
.flexi-app .card.locked { opacity: .5; pointer-events: none; }
.flexi-app .card.locked h2 { color: var(--muted); }
.flexi-app .card.view-locked { opacity: .45; pointer-events: none; }
.flexi-app .card.view-locked h2 { color: var(--muted); }
.flexi-app details.card > summary { user-select: none; }
.flexi-app details.card:not([open]) > summary h2 { margin-bottom: 0; }
.flexi-app details.card > summary { cursor: pointer; list-style: none; }
.flexi-app details.card > summary::-webkit-details-marker { display: none; }
.flexi-app details.card > summary h2 { display: inline; }
.flexi-app details.card > summary::after { content: "▾"; float: left; color: var(--muted); font-size: 12.8px; }
.flexi-app details.card:not([open]) > summary::after { content: "◂"; }
.flexi-app details.card[open] > summary { margin-bottom: 8px; }

.flexi-app .info { font-size: 13.12px; color: var(--muted); line-height: 1.45; margin: 0 0 8px; }
.flexi-app .row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.flexi-app .row > * { flex: 1; min-width: 0; }
.flexi-app .check { display: flex; align-items: center; gap: 8px; font-size: 13.6px; margin: 4px 0; cursor: pointer; }

/* ---------- Buttons ---------- */
.flexi-app button { font-family: inherit; }
.flexi-app button.primary { width: 100%; background: var(--accent-soft); color: var(--on-brand); border: none;
  border-radius: 9px; padding: 11px; font-weight: 700; font-size: 14.72px; cursor: pointer; }
.flexi-app button.primary:hover { filter: brightness(1.06); }
.flexi-app button.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.flexi-app button.primary.alt { background: var(--ok); color: #fff; margin-top: 6px; }
.flexi-app button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 7px 10px; font-size: 13.12px; cursor: pointer; width: 100%; }
.flexi-app button.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent2); }
.flexi-app button.ghost:disabled { opacity: .45; cursor: not-allowed; }
.flexi-app .ghost.danger:not(:disabled) { color: #fff; background: #d9534f; border-color: #d9534f; }

/* ---------- Tabs ---------- */
.flexi-app .tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.flexi-app .tab { flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 6px; font-weight: 600; font-size: 14.08px; cursor: pointer; }
.flexi-app .tab:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.flexi-app .tab.active { color: var(--on-brand); background: var(--accent-soft); border-color: var(--accent-soft); }
.flexi-app .tab:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Inputs ---------- */
.flexi-app .select { width: 100%; background: var(--input); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 12px; font-size: 14.08px; cursor: pointer; appearance: none; font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%238a93a6' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: left 12px center; }
.flexi-app .select:hover, .flexi-app .select:focus { border-color: var(--accent); outline: none; }
.flexi-app .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.flexi-app .field input { width: 100%; background: var(--input); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 6px; font-size: 13.6px; font-family: inherit; }
.flexi-app .field input:focus { border-color: var(--accent); outline: none; }
.flexi-app .field input.bad { border-color: #ff5c72; }
.flexi-app .field-note { font-size: 12px; line-height: 1.4; color: var(--accent); margin: 4px 0 0; font-weight: 600; }
.flexi-app .field input.flash { animation: flexi-flash 1.6s ease-out; }
@keyframes flexi-flash { 0%, 40% { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(220,162,74,.35); } 100% { box-shadow: none; } }
.flexi-app .field-error { font-size: 12px; line-height: 1.4; color: #ffb4bd; margin: 4px 0 0; font-weight: 600; }
.flexi-app input[type=checkbox] { accent-color: var(--accent2); width: 15px; height: 15px; margin: 0; }
.flexi-app input[type=range] { accent-color: var(--accent); width: 100%; }
.flexi-app .range-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ---------- Stat tiles ---------- */
.flexi-app .dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.flexi-app .dim { background: var(--input); border: 1px solid var(--line); border-radius: 9px; padding: 6px; text-align: center; }
.flexi-app .dim-label { display: block; font-size: 11.2px; color: var(--muted); margin-bottom: 3px; }
.flexi-app .dim-val { display: block; font-size: 14.4px; font-weight: 600; color: var(--text); }

/* ---------- Drop zone ---------- */
.flexi-app .drop { border: 1.5px dashed var(--line); border-radius: 11px; padding: 14px 10px; text-align: center;
  color: var(--muted); font-size: 13.6px; cursor: pointer; transition: border-color .15s, color .15s; }
.flexi-app .drop:hover, .flexi-app .drop.over { border-color: var(--accent); color: var(--text); }
.flexi-app .drop strong { color: var(--accent); }
.flexi-app .drop { position: relative; }
.flexi-app .drop.has-file { border: 1.5px solid var(--ok); background: rgba(51,189,107,.06); color: var(--text); }
.flexi-app .drop.has-file strong { color: var(--ok); }
.flexi-app .drop-del { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer;
  background: rgba(30,36,48,.85); border: 1px solid var(--line); color: var(--muted); }
.flexi-app .drop-del:hover { color: #fff; background: #d9534f; border-color: #d9534f; }
.flexi-app .drop-del[hidden] { display: none; }
.flexi-app .file-name { font-size: 12.48px; color: var(--muted); margin-top: 6px; word-break: break-all; }

/* ---------- Warnings ---------- */
.flexi-app .warn-list { list-style: none; margin: 0; padding: 0; }
.flexi-app .warn-list li.error { color: #ffb4bd; background: rgba(255,92,114,.1); border-color: rgba(255,92,114,.45); font-weight: 600; }
.flexi-app .warn-list li { font-size: 12.8px; line-height: 1.45; color: #f0c674; background: rgba(220,162,74,.08);
  border: 1px solid rgba(220,162,74,.3); border-radius: 8px; padding: 6px 8px; margin-bottom: 5px; }

/* ---------- Empty state / Spinner / Banner / overlay ---------- */
.flexi-app .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 20px; pointer-events: none; }
.flexi-app .empty .big { font-size: 18.4px; font-weight: 700; color: var(--text); }
.flexi-app .empty svg { opacity: .55; }
.flexi-app .spinner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: rgba(16,19,26,.6); color: var(--text); z-index: 5; }
.flexi-app .spin { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: flexi-spin 1s linear infinite; }
@keyframes flexi-spin { to { transform: rotate(360deg); } }
.flexi-app .banner { position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
  background: linear-gradient(180deg, #3a2c0c, #2c2109); color: var(--accent);
  border-top: 1px solid rgba(220,162,74,.5); text-align: center; font-size: 14.4px; font-weight: 600;
  padding: 9px 16px; pointer-events: none; }
.flexi-app .overlay-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 3; }
.flexi-app .overlay-tools button { background: rgba(30,36,48,.8); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13.12px; cursor: pointer; }
.flexi-app .overlay-tools button:hover { border-color: var(--accent2); }
.flexi-app .overlay-tools button.on { border-color: var(--accent); color: var(--accent); }

/* ---------- Msgbox ---------- */
.flexi-app .msgbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(8,11,20,.66); }
.flexi-app .msgbox[hidden] { display: none !important; }
.flexi-app .msgbox-card { width: min(430px,100%); text-align: center; direction: rtl; background: #1e2438;
  border: 1px solid #2b3350; border-top: 4px solid #ff5c72; border-radius: 16px; padding: 26px 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: flexi-pop .16s ease-out; }
.flexi-app .msgbox-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: #e7eaf3; }
.flexi-app .msgbox-msg { margin: 0 0 20px; font-size: 14px; line-height: 1.65; color: #9aa3bd; }
.flexi-app .msgbox-actions { display: flex; gap: 10px; justify-content: center; }
.flexi-app .msgbox-btn.danger { background: #d9534f; }
.flexi-app .msgbox-btn.secondary { background: transparent; border: 1px solid #2b3350; color: #9aa3bd; }
.flexi-app .msgbox-btn { min-width: 130px; padding: 10px 18px; border-radius: 10px; border: none; font-weight: 700;
  font-size: 14px; color: #fff; cursor: pointer; background: linear-gradient(90deg, #5b8cff, #7c5cff); }
@keyframes flexi-pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flexi-app .msgbox-card, .flexi-app .spin { animation: none; } }

/* ---------- WordPress: בידוד מעיצוב ערכת הנושא ----------
   גופן וגובה שורה מאופסים ביחד (גובה השורה של התבנית זולג פנימה גם כשהגופן מאופס). */
.flexi-app, .flexi-app * { font-family: "Rubik", "Segoe UI", system-ui, sans-serif !important; line-height: normal !important; }
/* ---------- WordPress: איפוס עדין מול סגנונות ערכת העיצוב ---------- */
.flexi-app button, .flexi-app input, .flexi-app select {
  font-family: inherit; text-transform: none; letter-spacing: normal; line-height: normal;
  box-shadow: none; margin: 0; min-height: 0; }
.flexi-app h1, .flexi-app h2, .flexi-app h3 { font-family: inherit; text-transform: none; line-height: 1.3; }
.flexi-app img { max-width: none; box-shadow: none; border: 0; }

/* ---------- סליידר (range) - מצויר ידנית במלואו, לפי SLIDER-CSS-IN-HOST-PAGE-SNIPPET.md ----------
   כל !important הכרחי: מנצח את עיצוב ערכת הנושא בלי תלות בסדר טעינה. המילוי (--range-progress) מתעדכן מ-JS.
   האפליקציה RTL - המינימום בצד ימין, ולכן הגרדיאנט "to left". */
.flexi-app input[type=range] {
  --range-progress: 0%;
  -webkit-appearance: none !important; appearance: none !important;
  width: 100% !important; height: 16px !important; margin: 4px 0 !important; padding: 0 !important;
  background: none !important; border: none !important; box-shadow: none !important; outline: none;
  border-radius: 0 !important; cursor: pointer; }
.flexi-app input[type=range]:disabled { opacity: .4; cursor: not-allowed; }
.flexi-app input[type=range]::-webkit-slider-runnable-track {
  -webkit-appearance: none !important;
  height: 3px !important; border-radius: 999px !important;
  background: linear-gradient(to left,
    var(--accent) 0%, var(--accent) var(--range-progress),
    var(--line) var(--range-progress), var(--line) 100%) !important;
  border: none !important; box-shadow: none !important; }
.flexi-app input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 14px !important; height: 14px !important; border-radius: 50% !important;
  background: var(--accent) !important; border: none !important; box-shadow: none !important;
  margin-top: -5.5px !important; cursor: pointer; }
.flexi-app input[type=range]::-moz-range-track {
  height: 3px !important; border-radius: 999px !important;
  background: var(--line) !important; border: none !important; box-shadow: none !important; }
.flexi-app input[type=range]::-moz-range-progress {
  height: 3px !important; border-radius: 999px !important;
  background: var(--accent) !important; border: none !important; box-shadow: none !important; }
.flexi-app input[type=range]::-moz-range-thumb {
  width: 14px !important; height: 14px !important; border-radius: 50% !important;
  background: var(--accent) !important; border: none !important; box-shadow: none !important; }

/* ---------- הורדה בתשלום ---------- */
.flexi-app .dl-btn { width: 100%; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ok); border: none; color: #fff;
  border-radius: 9px; padding: 11px; font-weight: 700; font-size: 14.72px; cursor: pointer; font-family: inherit; }
.flexi-app .dl-btn:hover:not(:disabled) { filter: brightness(1.06); }
.flexi-app .dl-btn:disabled { opacity: .5; cursor: not-allowed; }
.flexi-app .dl-btn[hidden] { display: none !important; }
.flexi-app .dl-cost { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.flexi-app .credit-icon { width: 18px; height: 18px; vertical-align: middle; }

/* ---------- תצוגת 3D: תווית "השינויים לא נוצרו" ---------- */
.flexi-app .stale-note { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 6;
  width: min(460px, calc(100% - 32px)); text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center;
  background: linear-gradient(180deg, #3a2c0c, #2c2109); border: 1px solid rgba(220,162,74,.75);
  color: var(--accent); border-radius: 11px; padding: 12px 16px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.flexi-app .stale-note b { font-weight: 800; }
.flexi-app .stale-note button { margin-top: 4px; background: var(--accent-soft); color: var(--on-brand); border: none;
  border-radius: 8px; padding: 7px 16px; font-weight: 700; font-size: 13px; cursor: pointer; }
.flexi-app .stale-note[hidden] { display: none !important; }

/* ---------- "מחשב…" בזמן שהשרת מחשב חלוקה חדשה ---------- */
.flexi-app .calc-note { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 8px; background: rgba(30,36,48,.92); border: 1px solid var(--line);
  color: var(--text); border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 600; pointer-events: none; }
.flexi-app .calc-note[hidden] { display: none !important; }
.flexi-app .mini-spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: flexi-spin .8s linear infinite; }

/* ---------- "השרת מתעורר" ---------- */
.flexi-app .wake-note { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: rgba(30,36,48,.92); border: 1px solid rgba(220,162,74,.5); color: var(--accent);
  border-radius: 9px; padding: 8px 14px; font-size: 13.6px; font-weight: 600; pointer-events: none; }

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .flexi-app { height: auto; overflow: visible; }
  .flexi-app .main { flex-direction: column; }
  .flexi-app .panel { width: 100%; border-left: none; border-bottom: 1px solid var(--line); overflow: visible; }
  .flexi-app .viewport { min-height: 70vh; }
  .flexi-app .topbar { padding: 10px 16px; flex-wrap: wrap; }
}

/* ---------- אורח: הודעת התחברות (מדריך העיצוב 6.9) ---------- */
.flexi-login-note {
  direction: rtl; max-width: 760px; margin: 0 auto; padding: 30px 28px;
  text-align: center; border-radius: 16px; font-size: 19px; line-height: 1.6;
  font-family: "Rubik", "Segoe UI", system-ui, sans-serif;
  font-weight: 600; color: #e7ecff;
  background: linear-gradient(180deg, #0f1636, #0a1024);
  border: 1px solid rgba(255,214,120,.55);
  box-shadow: 0 0 0 1px rgba(255,214,120,.12), 0 0 34px rgba(120,150,255,.28),
              inset 0 0 26px rgba(120,150,255,.10);
}
.flexi-login-note a { color: #ffd66b; font-weight: 700; text-decoration: none;
  border-bottom: 1px solid rgba(255,214,120,.5); }

/* אישור הורדה בתשלום - ירוק כמו כפתור ההורדה */
.flexi-app .msgbox-btn.buy { background: var(--ok); }
.flexi-app .msgbox-btn.buy:hover { filter: brightness(1.06); }
.flexi-app .msgbox:has(.msgbox-btn.buy) .msgbox-card { border-top-color: var(--ok); }

/* ---------- גובה אחיד לשדות ולתיבות הבחירה (גובר על עיצוב התבנית) ---------- */
.flexi-app .field input, .flexi-app .select {
  height: 36px !important; min-height: 0 !important; max-height: none !important;
  box-sizing: border-box !important; line-height: 1.2 !important; margin: 0 !important; }
.flexi-app .field input { padding: 6px 10px !important; }
.flexi-app .select { padding-top: 0 !important; padding-bottom: 0 !important; }
.flexi-app .row button.ghost { height: 36px; box-sizing: border-box; }

/* ---------- כפתור "הדרכה" (קישור בעיצוב כפתור, בצבע המותג) ---------- */
.flexi-app .overlay-tools { align-items: center; }
.flexi-app .view-switch { display: flex; gap: 6px; }
.flexi-app .guide-btn { display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #201603 !important; font-weight: 700; font-family: inherit;
  border: 1px solid var(--accent-soft); border-radius: 8px; padding: 6px 18px; font-size: 13.12px;
  line-height: 1.2; text-decoration: none !important; white-space: nowrap; cursor: pointer; }
.flexi-app .guide-btn:hover { filter: brightness(1.06); }
.flexi-app .guide-btn[hidden] { display: none !important; }

/* ---------- הודעת "זמין במחשב בלבד" (סמארטפון) ---------- */
.flexi-app-mount .flexi-note {
  direction: rtl; max-width: 760px; margin: 24px auto; padding: 26px 24px; text-align: center;
  border-radius: 16px; font-size: 17px !important; line-height: 1.6 !important; font-weight: 600;
  font-family: "Rubik", "Segoe UI", system-ui, sans-serif !important;
  color: #e8ecf2; background: #161b24; border: 1px solid rgba(220,162,74,.55); box-sizing: border-box; }
