/*!
 * Daminz — Tool Design System (tool-base.css)
 * لایه پایه یکدست برای همه ابزارها داخل #toolApp
 * قبل از CSS خودِ ابزار لود می‌شود؛ قوانین ابزار همیشه برنده‌اند.
 * همه رنگ‌ها از متغیرهای سایت می‌آیند → حالت روشن/تاریک خودکار.
 */
#toolApp{
  color:var(--body);
  font-size:15px;
  line-height:1.9;
  text-align:right;
}
#toolApp h1,#toolApp h2,#toolApp h3,#toolApp h4,#toolApp h5,#toolApp h6{color:var(--ink);line-height:1.6}
#toolApp b,#toolApp strong{color:var(--ink)}
#toolApp a{color:var(--accent);text-decoration:none}
#toolApp a:hover{text-decoration:underline}
#toolApp ::placeholder{color:var(--muted2);opacity:1}
#toolApp ::selection{background:rgba(0,195,137,.25)}
#toolApp .dark ::selection,#toolApp.dark ::selection{background:rgba(0,229,155,.22)}

/* ---------- کنترل‌های فرم: حداقل‌های یکدست (ابزار می‌تواند بازنویسی کند) ---------- */
#toolApp input:not([type]):not([class*="btn"]):not([class*="button"]),
#toolApp input[type=text],#toolApp input[type=search],#toolApp input[type=email],
#toolApp input[type=url],#toolApp input[type=tel],#toolApp input[type=password],
#toolApp input[type=number],#toolApp input[type=date],#toolApp input[type=time],
#toolApp input[type=datetime-local],#toolApp input[type=week],#toolApp input[type=month],
#toolApp select,#toolApp textarea{
  font-family:inherit;
  font-size:16px;              /* 16px = بدون زوم خودکار iOS */
  line-height:1.7;
  color:var(--ink);
  background:var(--card);
  border:1.5px solid var(--line);
  border-radius:12px;
  padding:10px 14px;
  outline:none;
  transition:border-color .2s,box-shadow .2s;
  box-sizing:border-box;
}
#toolApp input:not([type]):focus-visible,
#toolApp input[type=text]:focus,#toolApp input[type=search]:focus,#toolApp input[type=email]:focus,
#toolApp input[type=url]:focus,#toolApp input[type=tel]:focus,#toolApp input[type=password]:focus,
#toolApp input[type=number]:focus,#toolApp input[type=date]:focus,#toolApp input[type=time]:focus,
#toolApp input[type=datetime-local]:focus,#toolApp input[type=week]:focus,#toolApp input[type=month]:focus,
#toolApp select:focus,#toolApp textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 4px rgba(0,195,137,.13);
}
#toolApp input[type=number]{-moz-appearance:textfield}
#toolApp input[type=number]::-webkit-outer-spin-button,
#toolApp input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
#toolApp select{
  appearance:none;-webkit-appearance:none;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(0% + 18px) calc(50% - 2px),calc(0% + 23px) calc(50% - 2px);
  background-size:5px 5px,5px 5px;
  background-repeat:no-repeat;
  padding-left:34px;
}
#toolApp textarea{resize:vertical;min-height:96px}
#toolApp input[type=checkbox],#toolApp input[type=radio]{accent-color:var(--accent);width:17px;height:17px;cursor:pointer}
#toolApp input[type=range]{accent-color:var(--accent);cursor:pointer}
#toolApp input[type=color]{width:44px;height:34px;border:1.5px solid var(--line);border-radius:9px;background:var(--card);padding:2px;cursor:pointer}
#toolApp input[type=file]{font-family:inherit;font-size:13.5px;color:var(--body);max-width:100%}
#toolApp input[type=file]::file-selector-button{
  font-family:inherit;font-size:13px;font-weight:700;cursor:pointer;
  border:1.5px solid var(--line);border-radius:10px;
  background:var(--card);color:var(--ink);
  padding:8px 14px;margin-inline-end:10px;
  transition:border-color .2s,background .2s;
}
#toolApp input[type=file]::file-selector-button:hover{border-color:var(--accent);background:var(--accent-soft)}
#toolApp fieldset{border:1.5px solid var(--line);border-radius:14px;padding:14px}
#toolApp legend{color:var(--ink);font-weight:800;padding:0 8px}
#toolApp label{color:var(--body)}

/* ---------- دکمه‌ها ---------- */
#toolApp button{
  font-family:inherit;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
#toolApp button:disabled{opacity:.55;cursor:not-allowed}
#toolApp button:not(:disabled):active{transform:scale(.98)}

/* ---------- جدول‌ها ---------- */
#toolApp table{
  border-collapse:collapse;
  max-width:100%;
  font-size:13.5px;
  background:var(--card);
  color:var(--body);
}
#toolApp th,#toolApp td{border:1px solid var(--line);padding:8px 12px;text-align:right}
#toolApp th{background:var(--accent-soft);color:var(--ink);font-weight:800;white-space:nowrap}
#toolApp tr:hover td{background:color-mix(in srgb,var(--ink) 3%,transparent)}

/* ---------- رسانه‌ها: هرگز از محفظه بیرون نزنند ---------- */
#toolApp img,#toolApp canvas,#toolApp svg:not(.dz-i),#toolApp video,#toolApp iframe,#toolApp embed,#toolApp object{
  max-width:100%;
}
#toolApp img,#toolApp video{height:auto}
#toolApp pre{
  background:color-mix(in srgb,var(--ink) 4%,transparent);
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  overflow-x:auto;
  direction:ltr;text-align:left;
  font-size:13px;line-height:1.8;
  color:var(--ink);
}
#toolApp code{background:var(--accent-soft);color:var(--accent-ink);padding:2px 7px;border-radius:6px;font-size:.88em}
#toolApp .dark code,#toolApp.dark code{color:var(--accent-bright)}
#toolApp hr{border:none;border-top:1px solid var(--line);margin:16px 0}
#toolApp blockquote{border-inline-start:3px solid var(--accent);margin:10px 0;padding:6px 14px;color:var(--muted);background:var(--accent-soft);border-radius:0 12px 12px 0}
#toolApp ul,#toolApp ol{padding-inline-start:22px}
#toolApp .dark ul,#toolApp.dark ul{padding-inline-start:22px}

/* ---------- اسکرول‌بار محفظه ---------- */
#toolApp *::-webkit-scrollbar{width:9px;height:9px}
#toolApp *::-webkit-scrollbar-thumb{background:var(--muted2);border-radius:8px}
#toolApp *::-webkit-scrollbar-track{background:transparent}

/* ---------- فوکوس با کیبورد برای همه عناصر تعاملی ---------- */
#toolApp a:focus-visible,#toolApp button:focus-visible,#toolApp [tabindex]:focus-visible{
  outline:2.5px solid var(--accent);outline-offset:2px;border-radius:8px;
}

/* ---------- ایمنی موبایل (کلی) ---------- */
@media (max-width:640px){
  #toolApp{font-size:14.5px}
  #toolApp input:not([type]):not([class*="btn"]):not([class*="button"]),
  #toolApp input[type=text],#toolApp input[type=search],#toolApp input[type=email],
  #toolApp input[type=url],#toolApp input[type=tel],#toolApp input[type=password],
  #toolApp input[type=number],#toolApp input[type=date],#toolApp input[type=time],
  #toolApp input[type=datetime-local],#toolApp select,#toolApp textarea{
    font-size:16px;padding:9px 12px;
  }
  #toolApp th,#toolApp td{padding:6px 9px}
}
@media (prefers-reduced-motion:reduce){
  #toolApp *,#toolApp *::before,#toolApp *::after{animation-duration:.01ms!important;transition-duration:.01ms!important}
}
