/* MeraTool More Tools - tool UI + content styles. All selectors are prefixed .mmt- to avoid touching theme styles. */
.mmt-wrap {
  --mmt-accent: var(--wp--preset--color--primary, #4f46e5);
  --mmt-accent-text: #fff;
  --mmt-border: rgba(127, 127, 127, .32);
  --mmt-soft: rgba(127, 127, 127, .09);
  --mmt-ok: #15803d;
  --mmt-err: #b91c1c;
  --mmt-radius: 12px;
  margin: 0 auto 2rem;
  max-width: 100%;
  box-sizing: border-box;
}
.mmt-wrap *, .mmt-wrap *::before, .mmt-wrap *::after { box-sizing: border-box; }

.mmt-tool {
  border: 1px solid var(--mmt-border);
  border-radius: var(--mmt-radius);
  padding: 1rem;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}
@media (min-width: 640px) { .mmt-tool { padding: 1.4rem; } }

.mmt-tool h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.mmt-tool p { margin: .4rem 0; }
.mmt-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: .75rem 0; }
.mmt-row > .mmt-field { flex: 1 1 160px; min-width: 0; }
.mmt-row--tight { gap: .5rem; }
.mmt-grow { flex: 1 1 auto; }
.mmt-field { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.mmt-label { font-size: .85rem; font-weight: 600; }
.mmt-hint { font-size: .78rem; opacity: .7; }

.mmt-tool input[type="text"], .mmt-tool input[type="number"], .mmt-tool input[type="date"],
.mmt-tool input[type="password"], .mmt-tool input[type="search"], .mmt-tool input[type="email"],
.mmt-tool input[type="tel"], .mmt-tool select, .mmt-tool textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--mmt-border);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  min-height: 2.6rem;
}
.mmt-tool select option { color: #111; background: #fff; }
.mmt-tool textarea { resize: vertical; min-height: 7rem; }
.mmt-tool input:focus-visible, .mmt-tool select:focus-visible, .mmt-tool textarea:focus-visible,
.mmt-btn:focus-visible, .mmt-tab:focus-visible {
  outline: 2px solid var(--mmt-accent);
  outline-offset: 2px;
}
.mmt-tool input[type="color"] { width: 3rem; height: 2.6rem; padding: 2px; border: 1px solid var(--mmt-border); border-radius: 8px; background: transparent; }
.mmt-tool input[type="range"] { width: 100%; accent-color: var(--mmt-accent); }
.mmt-check { display: inline-flex; gap: .45rem; align-items: center; font-size: .92rem; cursor: pointer; }
.mmt-check input { accent-color: var(--mmt-accent); width: 1.05rem; height: 1.05rem; }

.mmt-btn {
  appearance: none;
  border: 1px solid var(--mmt-accent);
  background: var(--mmt-accent);
  color: var(--mmt-accent-text);
  padding: .6rem 1rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.6rem;
  line-height: 1.2;
}
.mmt-btn:hover { filter: brightness(1.08); }
.mmt-btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.mmt-btn--ghost { background: transparent; color: inherit; border-color: var(--mmt-border); }
.mmt-btn--ghost:hover { border-color: var(--mmt-accent); filter: none; }
.mmt-btn--sm { padding: .3rem .6rem; min-height: 2rem; font-size: .85rem; }
.mmt-btn--danger { background: transparent; color: var(--mmt-err); border-color: var(--mmt-err); }

.mmt-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.mmt-tab {
  appearance: none; border: 1px solid var(--mmt-border); background: transparent; color: inherit;
  padding: .45rem .85rem; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer;
}
.mmt-tab.is-active { background: var(--mmt-accent); border-color: var(--mmt-accent); color: var(--mmt-accent-text); }

.mmt-msg { margin: .75rem 0; padding: .6rem .8rem; border-radius: 8px; background: var(--mmt-soft); font-size: .92rem; }
.mmt-msg--ok { border-left: 4px solid var(--mmt-ok); }
.mmt-msg--err { border-left: 4px solid var(--mmt-err); }

.mmt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: .75rem 0; }
.mmt-stat { background: var(--mmt-soft); border-radius: 10px; padding: .65rem .8rem; }
.mmt-stat b { display: block; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mmt-stat span { font-size: .78rem; opacity: .75; }

.mmt-drop {
  border: 2px dashed var(--mmt-border); border-radius: var(--mmt-radius); padding: 1.4rem 1rem;
  text-align: center; cursor: pointer; margin: 0 0 .75rem;
}
.mmt-drop.is-over, .mmt-drop:hover { border-color: var(--mmt-accent); background: var(--mmt-soft); }
.mmt-drop input { display: none; }

.mmt-files { list-style: none; margin: .75rem 0; padding: 0; display: grid; gap: .5rem; }
.mmt-file { display: flex; gap: .6rem; align-items: center; border: 1px solid var(--mmt-border); border-radius: 10px; padding: .45rem .6rem; }
.mmt-file img, .mmt-file .mmt-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex: none; background: var(--mmt-soft); }
.mmt-file .mmt-thumb { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.mmt-file .mmt-meta { flex: 1 1 auto; min-width: 0; }
.mmt-file .mmt-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmt-file .mmt-sub { font-size: .78rem; opacity: .7; }
.mmt-file .mmt-acts { display: flex; gap: .25rem; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.mmt-file .mmt-range { width: 7.5rem; min-height: 2rem; padding: .25rem .45rem; font-size: .85rem; }

.mmt-out { border: 1px solid var(--mmt-border); border-radius: 10px; padding: .8rem; background: var(--mmt-soft); word-break: break-word; white-space: pre-wrap; min-height: 3rem; }
.mmt-rtl { direction: rtl; text-align: right; font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Segoe UI", Tahoma, serif; line-height: 2.1; font-size: 1.15rem; }
.mmt-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mmt-center { text-align: center; }
.mmt-big { font-size: clamp(2rem, 8vw, 3.4rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }

.mmt-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.mmt-table th, .mmt-table td { border-bottom: 1px solid var(--mmt-border); padding: .4rem .5rem; text-align: left; }
.mmt-table input, .mmt-table select { min-height: 2.2rem; padding: .3rem .5rem; }
.mmt-scroll { overflow-x: auto; }

/* ---- QR ---- */
.mmt-qr-preview { display: flex; align-items: center; justify-content: center; background: var(--mmt-soft); border-radius: 10px; padding: 1rem; min-height: 220px; }
.mmt-qr-preview canvas { max-width: 100%; height: auto; image-rendering: pixelated; }
.mmt-split { display: grid; gap: 1.2rem; }
@media (min-width: 760px) { .mmt-split { grid-template-columns: 1fr 1fr; } }

/* ---- Typing test ---- */
.mmt-type-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; line-height: 1.9;
  border: 1px solid var(--mmt-border); border-radius: 10px; padding: .8rem 1rem; height: 8.6rem; overflow: hidden; position: relative;
  word-break: break-word; white-space: pre-wrap; user-select: none;
}
.mmt-c-ok { opacity: .95; color: var(--mmt-ok); }
.mmt-c-bad { color: var(--mmt-err); background: rgba(185, 28, 28, .14); border-radius: 2px; }
.mmt-c-cur { border-left: 2px solid var(--mmt-accent); margin-left: -2px; }
.mmt-c-todo { opacity: .6; }

/* ---- Calculator ---- */
.mmt-calc-display { font-size: 1.5rem; text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mmt-calc-result { text-align: right; min-height: 2.2rem; font-size: 1.7rem; font-weight: 700; word-break: break-all; }
.mmt-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-top: .6rem; }
.mmt-key {
  appearance: none; border: 1px solid var(--mmt-border); background: var(--mmt-soft); color: inherit; border-radius: 8px;
  min-height: 2.9rem; font: inherit; font-size: 1rem; cursor: pointer; padding: .2rem;
}
.mmt-key:hover { border-color: var(--mmt-accent); }
.mmt-key--op { background: rgba(127, 127, 127, .18); }
.mmt-key--eq { background: var(--mmt-accent); color: var(--mmt-accent-text); border-color: var(--mmt-accent); font-weight: 700; }
.mmt-key--clr { color: var(--mmt-err); }
.mmt-history { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 11rem; overflow: auto; font-size: .92rem; }
.mmt-history li { padding: .3rem .4rem; border-bottom: 1px solid var(--mmt-border); cursor: pointer; display: flex; justify-content: space-between; gap: .6rem; }
.mmt-history li:hover { background: var(--mmt-soft); }

/* ---- Password ---- */
.mmt-meter { height: 10px; border-radius: 999px; background: var(--mmt-soft); overflow: hidden; margin: .5rem 0; }
.mmt-meter > i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; background: var(--mmt-err); }

/* ---- Markdown ---- */
.mmt-md-grid { display: grid; gap: 1rem; }
@media (min-width: 860px) { .mmt-md-grid { grid-template-columns: 1fr 1fr; } }
.mmt-md-grid textarea { min-height: 22rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; }
.mmt-md-preview { border: 1px solid var(--mmt-border); border-radius: 10px; padding: .9rem 1.1rem; min-height: 22rem; max-height: 36rem; overflow: auto; word-break: break-word; }
.mmt-md-preview h1, .mmt-md-preview h2 { border-bottom: 1px solid var(--mmt-border); padding-bottom: .25rem; }
.mmt-md-preview pre { background: var(--mmt-soft); padding: .7rem; border-radius: 8px; overflow: auto; }
.mmt-md-preview code { background: var(--mmt-soft); padding: .1rem .3rem; border-radius: 4px; font-size: .92em; }
.mmt-md-preview pre code { background: transparent; padding: 0; }
.mmt-md-preview blockquote { margin: .8rem 0; padding: .1rem 1rem; border-left: 4px solid var(--mmt-border); opacity: .9; }
.mmt-md-preview table { border-collapse: collapse; margin: .8rem 0; }
.mmt-md-preview th, .mmt-md-preview td { border: 1px solid var(--mmt-border); padding: .35rem .6rem; }
.mmt-md-preview img { max-width: 100%; height: auto; }
.mmt-md-preview hr { border: 0; border-top: 1px solid var(--mmt-border); margin: 1.2rem 0; }

/* ---- Content below the tool ---- */
.mmt-content { margin-top: 2rem; }
.mmt-content h2 { margin: 1.8rem 0 .6rem; }
.mmt-content ol, .mmt-content ul { padding-left: 1.3rem; }
.mmt-content li { margin: .3rem 0; }
.mmt-faq details { border: 1px solid var(--mmt-border); border-radius: 10px; padding: .15rem .9rem; margin: .5rem 0; }
.mmt-faq summary { cursor: pointer; font-weight: 600; padding: .6rem 0; }
.mmt-faq details[open] summary { margin-bottom: .1rem; }
.mmt-faq details p { margin: .2rem 0 .8rem; }
.mmt-related { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; list-style: none; }
.mmt-related a { display: inline-block; padding: .35rem .75rem; border: 1px solid var(--mmt-border); border-radius: 999px; text-decoration: none; }
.mmt-related a:hover { border-color: var(--mmt-accent); }
.mmt-note { font-size: .85rem; opacity: .75; }

@media (prefers-reduced-motion: reduce) { .mmt-meter > i { transition: none; } }
