/**
 * Safyeldin Tools — ستايل الحاسبات (مطابق لهوية الثيم v3.2).
 * الشورت كود بيستخدم كلاسات نفس الثيم؛ متغيرات افتراضية مدمجة تشتغل حتى لو الثيم مش معمول لها.
 */
.sf-tools, .sf-section:has(#panel-budget) {
  --st-accent: #365C6C;
  --st-accent-dark: #23424F;
  --st-accent-soft: #E9F1F5;
  --st-accent-shadow: rgba(54, 92, 108, 0.45);
  --st-ink: #0B131A;
  --st-ink-soft: #5B6B7A;
  --st-bg-soft: #F0F6FA;
  --st-border: #DCE6ED;
  --st-border-strong: #C7D6E0;
  --st-yellow: #FFDF00;
  --st-violet: #7C3AED;
  --st-sky: #00D2FF;

  /* ضمان الاتجاه — الحاسبات عربية حتى لو تستخدم داخل ثيم تاني مش RTL */
  direction: rtl;
}

/* Tabs */
.sf-tabs { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 34px; }
.sf-tab {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: 'Alexandria', sans-serif; font-weight: 700; font-size: 13px;
  padding: 14px 22px; border-radius: 8px; border: 1.5px solid var(--st-border-strong, #C7D6E0);
  background: var(--st-bg-soft, #F0F6FA); color: #3B4B5C; cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 8px 18px -12px rgba(11, 19, 26, 0.2);
}
.sf-tab svg { width: 16px; height: 16px; }
.sf-tab--violet svg { color: var(--st-violet, #7C3AED); }
.sf-tab--sky svg, .sf-tab--sky.is-active svg { color: #008DBF; }
.sf-tab--yellow svg { color: #B78900; }
.sf-tab:hover { background: #fff; border-color: var(--st-accent, #365C6C); color: var(--st-accent-dark, #23424F); }
.sf-tab.is-active { background: var(--st-accent, #365C6C); border-color: var(--st-accent, #365C6C); color: #fff; box-shadow: 0 14px 28px -14px var(--st-accent-shadow, rgba(54,92,108,.45)); transform: translateY(-1px); }
.sf-tab.is-active svg { color: var(--st-yellow, #FFDF00); }

/* الحاوية */
.sf-calc {
  background: var(--st-bg-soft, #F0F6FA); border: 1px solid var(--st-border-strong, #C7D6E0); border-radius: 14px;
  padding: 38px 34px; box-shadow: 0 28px 56px -32px rgba(11, 19, 26, 0.28);
}
.sf-calc__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.sf-calc__grid[hidden] { display: none !important; }
.sf-calc__out {
  background: #fff; border: 1px solid var(--st-border, #DCE6ED); border-radius: 14px;
  padding: 24px 22px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 12px 26px -18px rgba(11, 19, 26, 0.2);
  height: 100%;
}
.sf-calc__badge {
  align-self: flex-start; font-family: 'Alexandria', sans-serif; font-size: 11px; font-weight: 800;
  color: var(--st-accent-dark, #23424F); background: var(--st-accent-soft, #E9F1F5);
  padding: 5px 13px; border-radius: 999px;
}
.sf-calc__foot {
  margin-top: auto; border-top: 1px solid var(--st-border, #DCE6ED); padding-top: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--st-ink-soft, #5B6B7A);
}
.sf-calc__foot a {
  background: var(--st-yellow, #FFDF00); color: var(--st-ink, #0B131A) !important;
  padding: 10px 18px; border-radius: 9px; font-family: 'Alexandria', sans-serif; font-weight: 700; font-size: 11.5px;
  text-decoration: none; transition: all 0.2s ease;
}
.sf-calc__foot a:hover { background: #F0CE00; text-decoration: none; transform: translateY(-2px); }
.sf-tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--st-accent-soft, #E9F1F5); color: var(--st-accent-dark, #23424F);
  font-size: 9.5px; font-weight: 800; font-family: 'Alexandria', sans-serif;
  cursor: help; vertical-align: middle; margin-inline-start: 5px; outline: none;
}
.sf-tip:hover, .sf-tip:focus { background: var(--st-accent-dark, #23424F); color: #fff; }
.sf-tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); right: 50%;
  transform: translateX(50%);
  background: var(--st-ink, #0B131A); color: #fff;
  font-family: 'Readex Pro', sans-serif; font-weight: 400; font-size: 11px;
  line-height: 1.7; white-space: normal; width: max-content; max-width: 230px;
  padding: 8px 12px; border-radius: 8px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s ease; z-index: 30;
  box-shadow: 0 10px 24px -10px rgba(11, 19, 26, 0.5);
}
.sf-tip:hover::after, .sf-tip:focus::after { opacity: 1; visibility: visible; }
.sf-tip::before {
  content: '';
  position: absolute; bottom: calc(100% + 2px); right: 50%;
  transform: translateX(50%);
  border: 5px solid transparent; border-top-color: var(--st-ink, #0B131A);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s ease; z-index: 30;
}
.sf-tip:hover::before, .sf-tip:focus::before { opacity: 1; visibility: visible; }
.sf-calc__h { font-family: 'Alexandria', sans-serif; font-weight: 800; font-size: 18px; color: var(--st-ink, #0B131A); margin: 0 0 6px; }
.sf-calc__s { font-size: 12.5px; color: var(--st-ink-soft, #5B6B7A); margin: 0 0 22px; }
.sf-field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--st-ink, #0B131A); margin-bottom: 7px; }
.sf-field .sf-strong { color: var(--st-accent-dark, #23424F); font-family: 'Alexandria', sans-serif; }
.sf-qcard { background: #fff; border: 1px solid var(--st-border, #DCE6ED); border-radius: 8px; padding: 15px 17px; }
.sf-qcard--full { border-radius: 10px; padding: 16px 18px 14px; }
.sf-qcard--full label { display: block; line-height: 1.8; }
.sf-qcard__hint { margin: 4px 0 0; font-size: 12px; color: var(--st-ink-soft, #5B6B7A); line-height: 1.75; }
.sf-qcard__hint b { color: var(--st-accent-dark, #23424F); font-family: 'Alexandria', sans-serif; font-weight: 700; }
.sf-qcard__hint--scale { border-top: 1px dashed var(--st-border, #DCE6ED); margin-top: 7px; padding-top: 7px; font-size: 11.5px; }
.sf-qcard + .sf-qcard { margin-top: 12px; }
.sf-qcard label { margin-bottom: 8px; }

/* المخرجات */
.sf-out-card { background: var(--st-bg-soft, #F0F6FA); border: 1px solid var(--st-border, #DCE6ED); border-radius: 8px; padding: 16px; }
.sf-out-card > span:first-child { font-size: 11px; color: var(--st-ink-soft, #5B6B7A); display: block; }
.sf-out-card b { display: block; font-family: 'Alexandria', sans-serif; font-weight: 900; font-size: 22px; color: var(--st-ink, #0B131A); margin-top: 6px; }
.sf-out-ratio-good { color: #157F3D; }
.sf-out-ratio-warn { color: #B7791F; }

/* البارات */
.sf-bars { margin-top: 24px; }
.sf-bar-row + .sf-bar-row { margin-top: 13px; }
.sf-bar-tops { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.sf-bar-tops span { color: var(--st-ink-soft, #5B6B7A); }
.sf-bar-tops b { font-family: 'Alexandria', sans-serif; color: var(--st-accent-dark, #23424F); }
.sf-bar-track { height: 9px; background: var(--st-border, #DCE6ED); border-radius: 999px; overflow: hidden; }
.sf-bar-fill { height: 100%; border-radius: 999px; background: var(--st-accent, #365C6C); transition: width 0.35s ease; }
.sf-bar-fill--violet { background: var(--st-violet, #7C3AED); }
.sf-bar-fill--sky { background: var(--st-sky, #00D2FF); }
.sf-bar-fill--amber { background: #F59E0B; }

/* Range sliders */
.sf-input-range { width: 100%; height: 7px; -webkit-appearance: none; appearance: none; background: var(--st-border, #DCE6ED); border-radius: 999px; outline: none; margin: 8px 0 2px; }
.sf-input-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--st-accent, #365C6C); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15, 39, 64, 0.35); cursor: pointer; }
.sf-input-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--st-accent, #365C6C); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15, 39, 64, 0.35); cursor: pointer; }

/* القرص والنتيجة */
.sf-quiz-dial { display: flex; align-items: center; justify-content: center; flex-direction: column; width: 128px; height: 128px; margin: 18px auto; border-radius: 50%; border: 5px solid var(--st-accent-soft, #E9F1F5); background: #fff; }
.sf-quiz-dial b { font-family: 'Alexandria', sans-serif; font-weight: 900; font-size: 34px; color: var(--st-ink, #0B131A); }
.sf-quiz-dial span { font-size: 11px; color: var(--st-ink-soft, #5B6B7A); }
.sf-quiz-box { border-radius: 8px; border: 1.5px solid #E7D18A; background: #FBF4DC; padding: 18px; }
.sf-quiz-box.is-good { border-color: #9BDDB1; background: #EAF9F0; }
.sf-quiz-box.is-bad { border-color: #F3ACB0; background: #FDF0F0; }
.sf-quiz-box h4 { font-family: 'Alexandria', sans-serif; font-weight: 800; font-size: 14.5px; margin: 0 0 6px; color: #9C6F0A; }
.sf-quiz-box.is-good h4 { color: #157F3D; }
.sf-quiz-box.is-bad h4 { color: #C0392B; }
.sf-quiz-box p { margin: 0; font-size: 12.5px; color: var(--st-ink-soft, #5B6B7A); line-height: 1.9; }

/* Highlight في العنوان (لو الثيم مش معرّف .hl) */
.sf-section .hl { background: rgba(255, 223, 0, 0.35); box-shadow: inset 0 -0.45em 0 rgba(255, 223, 0, 0.35); padding-inline: 0.08em; border-radius: 2px; }

/* الموبايل */
@media (max-width: 860px) {
  .sf-calc__grid { grid-template-columns: 1fr; gap: 24px; }
  .sf-calc { padding: 26px 20px; }
  .sf-tab { padding: 11px 15px; font-size: 12px; }
}
