/* 3omar.hs — Text Formatter (NEW-09) */
/* ---- shared tool UI (same block in every NEW-tool style.css so each folder is self-contained) ---- */
.nt { --nt-accent: var(--brand); --nt-accent-bg: color-mix(in srgb, var(--brand) 14%, transparent); --nt-accent-border: color-mix(in srgb, var(--brand) 40%, transparent); --nt-ok: #4ade80; --nt-warn: #fbbf24; --nt-err: #f87171; --nt-surface: rgba(255,255,255,.035); }
html.light-mode .nt { --nt-accent: var(--brand); --nt-accent-bg: rgba(79,70,229,.08); --nt-accent-border: rgba(79,70,229,.35); --nt-ok: #15803d; --nt-warn: #92400e; --nt-err: #b91c1c; --nt-surface: rgba(15,23,42,.03); }
.nt .tool-hero { padding-top: 12px; }
.nt .tool-hero h1 { margin-top: 12px; }
.nt-facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.nt-facts li { font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); color: var(--glass-text-muted); }
.nt-panel { margin-top: 18px; }
.nt-panel > h2, .nt-h2 { margin: 0 0 12px; font-size: 1.15rem; }
.nt-h3 { margin: 0 0 8px; font-size: 1rem; }
.nt-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.nt-fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.nt .field label { font-size: .86rem; }
.nt .field .hint { margin: 0; }
.nt .input, .nt .select { min-height: 44px; }
.nt .input[aria-invalid="true"] { border-color: var(--nt-err); }
.nt-err-msg { color: var(--nt-err); font-size: .82rem; min-height: 0; }
.nt-err-msg:empty { display: none; }
.nt-unit { position: relative; }
.nt-unit .input { padding-inline-end: 58px; }
.nt-unit__tag { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--glass-text-muted); pointer-events: none; }

/* tabs */
.nt-tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--glass-bg-subtle); border: 1px solid var(--glass-border); overflow-x: auto; scrollbar-width: none; }
.nt-tabs::-webkit-scrollbar { display: none; }
.nt-tab { flex: 1 0 auto; min-height: 42px; padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--glass-text-muted); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.nt-tab[aria-selected="true"] { background: var(--pill-gradient-active); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.3); }
.nt-tab:not([aria-selected="true"]):hover { background: var(--glass-bg-hover); color: var(--glass-text-main); }
[role="tabpanel"][hidden] { display: none; }

/* segmented radio control */
.nt-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--control-border); background: var(--control-bg); }
.nt-seg label { position: relative; cursor: pointer; }
.nt-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.nt-seg span { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px; border-radius: 9px; font-size: .85rem; font-weight: 700; color: var(--glass-text-muted); }
.nt-seg input:checked + span { background: var(--nt-accent-bg); color: var(--nt-accent); box-shadow: inset 0 0 0 1px var(--nt-accent-border); }
.nt-seg input:focus-visible + span { box-shadow: var(--focus-ring); }

/* result tiles */
.nt-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-top: 16px; }
.nt-stat { padding: 14px 16px; border-radius: 16px; background: var(--nt-surface); border: 1px solid var(--glass-border); min-width: 0; }
.nt-stat__label { display: block; font-size: .8rem; font-weight: 600; color: var(--glass-text-muted); }
.nt-stat__value { display: block; margin-top: 4px; font-size: clamp(1.25rem, 3.4vw, 1.6rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.nt-stat__unit { font-size: .8rem; font-weight: 600; color: var(--glass-text-muted); margin-inline-start: 4px; }
.nt-stat--hero { background: linear-gradient(135deg, rgba(79,70,229,.22), rgba(6,182,212,.14)); border-color: var(--nt-accent-border); }
.nt-stat--hero .nt-stat__value { color: var(--nt-accent); }

/* chips & notes */
.nt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); }
.nt-chip--warn { color: var(--nt-warn); border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.1); }
.nt-chip--ok { color: var(--nt-ok); border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.1); }
.nt-chip--err { color: var(--nt-err); border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.1); }
.nt-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); font-size: .9rem; color: var(--glass-text-muted); margin: 12px 0 0; }
.nt-note--warn { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.08); color: var(--glass-text-main); }
.nt-note--ok { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.07); }
.nt-note[hidden] { display: none; }
.nt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.nt-iconbtn { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); color: var(--glass-text-main); font: inherit; font-weight: 700; cursor: pointer; }
.nt-iconbtn:hover { background: var(--glass-bg-hover); }
.nt-iconbtn[aria-pressed="true"] { background: var(--nt-accent-bg); color: var(--nt-accent); border-color: var(--nt-accent-border); }
.nt-iconbtn[disabled] { opacity: .45; cursor: not-allowed; }
.nt-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.nt-empty { color: var(--glass-text-muted); font-size: .9rem; margin: 8px 0 0; }
.nt .table td, .nt .table th { white-space: nowrap; }
.nt .table input { min-height: 38px; padding: 6px 10px; }
.nt-small { font-size: .82rem; color: var(--glass-text-muted); }
.nt a:not(.btn) { color: var(--nt-accent); }
@media (max-width: 560px) { .nt .btn { flex: 1 1 auto; } }
html.light-mode .nt .eyebrow { color: var(--nt-accent); background: var(--nt-accent-bg); border-color: var(--nt-accent-border); }

/* ---- text formatter ---- */
.tf-topbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; }
.tf-platform { flex: 1 1 320px; max-width: 520px; }
.tf-platform .select { font-weight: 700; }
.tf-warnings { display: flex; flex-wrap: wrap; gap: 6px; }
.tf-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.tf-side { display: grid; gap: 0; }
@media (max-width: 960px) { .tf-layout { grid-template-columns: 1fr; } }
.tf-toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; border-radius: 14px 14px 0 0; border: 1px solid var(--control-border); border-bottom: 0; background: var(--glass-bg-subtle); }
.tf-group { display: flex; gap: 4px; padding-inline-end: 8px; border-inline-end: 1px solid var(--glass-border); }
.tf-group:last-child { border: 0; padding: 0; }
.tf-ic-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.tf-editor { min-height: 240px; max-height: 60vh; overflow-y: auto; padding: 14px 16px; border: 1px solid var(--control-border); border-radius: 0 0 14px 14px; background: var(--control-bg); color: var(--glass-text-main); font-size: 1.05rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; unicode-bidi: plaintext; }
.tf-editor:focus { border-color: var(--glass-border-focus); box-shadow: var(--focus-ring); }
.tf-editor { position: relative; }
.tf-editor.is-empty::before { content: attr(data-placeholder); color: var(--glass-text-dim); pointer-events: none; position: absolute; inset-inline: 14px; top: 12px; white-space: normal; }
html.light-mode .tf-editor.is-empty::before { color: #64748b; }
.tf-editor blockquote, .tf-bubble blockquote { margin: 4px 0; padding-inline-start: 10px; border-inline-start: 3px solid var(--nt-accent); color: var(--glass-text-muted); }
.tf-editor ul, .tf-editor ol, .tf-bubble ul, .tf-bubble ol { margin: 4px 0; padding-inline-start: 26px; }
.tf-editor code, .tf-bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; padding: 1px 5px; border-radius: 5px; background: rgba(148,163,184,.18); }
.tf-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.tf-spoiler { background: rgba(148,163,184,.35); border-radius: 4px; padding: 0 2px; }
.tf-bubble .tf-spoiler { background: #64748b; color: transparent; transition: color .2s; cursor: pointer; }
.tf-bubble .tf-spoiler:hover, .tf-bubble .tf-spoiler:focus { color: inherit; background: rgba(100,116,139,.35); }
.tf-blank-hint { margin: 10px 0 0; }
.tf-emoji { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; padding: 8px; border: 1px solid var(--control-border); border-bottom: 0; background: var(--glass-bg); }
.tf-emoji[hidden] { display: none; }
.tf-emoji__btn { height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 1.3rem; cursor: pointer; }
.tf-emoji__btn:hover, .tf-emoji__btn:focus-visible { background: var(--glass-bg-hover); }

/* preview "phone" */
.tf-phone { padding: 16px 14px; border-radius: 16px; min-height: 120px; display: flex; flex-direction: column; align-items: flex-end; background: #0b141a; background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); background-size: 14px 14px; }
[dir="rtl"] .tf-phone { align-items: flex-start; }
.tf-bubble { position: relative; max-width: 92%; padding: 8px 12px 20px; border-radius: 12px; font-size: .97rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; min-width: 90px; }
.tf-bubble .tf-meta { position: absolute; inset-inline-end: 8px; bottom: 3px; font-size: .68rem; opacity: .75; white-space: nowrap; }
.tf-bubble .tf-ph { opacity: .75; font-style: italic; }
.tf-bubble .tf-plain { white-space: pre-wrap; }
.tf-phone[data-platform="whatsapp"] .tf-bubble { background: #005c4b; color: #e9edef; border-start-end-radius: 2px; }
.tf-phone[data-platform="telegram"] { background: #0e1621; }
.tf-phone[data-platform="telegram"] .tf-bubble { background: #2b5278; color: #fff; }
.tf-phone[data-platform="discord"] { background: #313338; align-items: stretch; }
.tf-phone[data-platform="discord"] .tf-bubble { background: transparent; color: #dbdee1; max-width: 100%; padding-inline: 4px; }
.tf-phone[data-platform="slack"] { background: #1a1d21; align-items: stretch; }
.tf-phone[data-platform="slack"] .tf-bubble { background: transparent; color: #d1d2d3; max-width: 100%; }
.tf-phone[data-platform="sms"] { background: #111827; }
.tf-phone[data-platform="sms"] .tf-bubble { background: #34c759; color: #04210f; }
.tf-phone[data-platform="general"], .tf-phone[data-platform="social"], .tf-phone[data-platform="markdown"], .tf-phone[data-platform="html"] { background: #f1f5f9; align-items: stretch; }
.tf-phone[data-platform="general"] .tf-bubble, .tf-phone[data-platform="social"] .tf-bubble, .tf-phone[data-platform="markdown"] .tf-bubble, .tf-phone[data-platform="html"] .tf-bubble { background: #fff; color: #0f172a; max-width: 100%; box-shadow: 0 2px 10px rgba(15,23,42,.08); }
.tf-phone[data-platform="discord"] .tf-bubble blockquote, .tf-phone[data-platform="slack"] .tf-bubble blockquote, .tf-phone[data-platform="whatsapp"] .tf-bubble blockquote, .tf-phone[data-platform="telegram"] .tf-bubble blockquote { color: inherit; opacity: .85; border-color: rgba(255,255,255,.5); }
.tf-out-label { display: block; margin-top: 14px; }
.tf-output { min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; unicode-bidi: plaintext; }
.tf-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tf-limit-field { margin-top: 14px; }
.tf-meter { margin-top: 10px; }
.tf-meter__bar { height: 10px; border-radius: 999px; background: var(--glass-bg-subtle); border: 1px solid var(--glass-border); overflow: hidden; }
.tf-meter__bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, var(--olive)); transition: width .25s; }
.tf-meter__bar.is-near span { background: linear-gradient(90deg, #f59e0b, #f97316); }
.tf-meter__bar.is-over span { background: #ef4444; }
.tf-meter p { margin: 6px 0 0; }
html[dir="rtl"] .tf-editor.is-empty::before { direction: rtl; text-align: right; unicode-bidi: isolate; }
.tf-ph { display: block; unicode-bidi: isolate; }
