/* ==========================================================================
   3omar.hs — shared components for the tool pages under /services/
   Builds on /css/unified-glass.css tokens + /css/site-shell.css components.
   Dark theme by default, html.light-mode for light. Logical properties for RTL.
   ========================================================================== */

[hidden] { display: none !important; }
.tool-main { padding-block: 18px 8px; }
.tool-hero .eyebrow { margin-top: 4px; }
.tool-hero h1 { background: none; -webkit-text-fill-color: currentColor; color: var(--glass-text-main); }
.tool-hero h1 .text-gradient { -webkit-text-fill-color: transparent; }
.tool-facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.tool-facts li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); color: var(--glass-text-main); }
.tool-facts li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }

/* ---------- panels & layout ---------- */
.panel { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); padding: clamp(16px, 3vw, 26px); margin-top: 20px; min-width: 0; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.panel__title { margin: 0; font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.panel__sub { margin: 4px 0 0; color: var(--glass-text-muted); font-size: .92rem; }
.tool-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 980px) { .tool-layout--aside { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }
.tool-layout > .panel { margin-top: 0; }
.field-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.field-grid .full { grid-column: 1 / -1; }
.field .label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field input[type="range"] { width: 100%; accent-color: var(--accent-strong); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent-strong); }

/* ---------- buttons (extra variants) ---------- */
.btn--danger { background: rgba(239, 68, 68, .14); color: #fca5a5; border-color: rgba(239, 68, 68, .45); }
.btn--danger:hover { background: rgba(239, 68, 68, .24); }
html.light-mode .btn--danger { color: #b91c1c; background: rgba(239, 68, 68, .08); }
.btn--ok { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .45); }
html.light-mode .btn--ok { color: #15803d; background: rgba(34, 197, 94, .1); }
.btn-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); color: var(--glass-text-main); cursor: pointer; font-size: 1rem; }
.btn-icon:hover { background: var(--glass-bg-hover); }

/* ---------- output / copy ---------- */
.output-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--brand) 55%, transparent); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.output-box__value { flex: 1 1 220px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(1rem, 2.6vw, 1.3rem); font-weight: 700; color: var(--glass-text-main); overflow-wrap: anywhere; direction: ltr; text-align: start; }
[dir="rtl"] .output-box__value { text-align: right; }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .input { flex: 1; min-width: 0; direction: ltr; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); color: var(--glass-text-main); white-space: nowrap; }
.badge--ok { background: rgba(34, 197, 94, .14); border-color: rgba(34, 197, 94, .4); color: #86efac; }
.badge--new { background: rgba(56, 189, 248, .14); border-color: rgba(56, 189, 248, .4); color: #7dd3fc; }
.badge--warn { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .4); color: #fcd34d; }
.badge--danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.badge--muted { color: var(--glass-text-muted); }
html.light-mode .badge--ok { color: #15803d; }
html.light-mode .badge--new { color: #0369a1; }
html.light-mode .badge--warn { color: #92400e; }
html.light-mode .badge--danger { color: #b91c1c; }

/* ---------- stats / countdown ---------- */
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
.stat { padding: 12px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); text-align: center; }
.stat__value { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__label { display: block; font-size: .78rem; color: var(--glass-text-muted); margin-top: 2px; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 420px; }
.countdown .stat__value { font-size: clamp(1.15rem, 4vw, 1.6rem); }

/* ---------- dropzone / progress ---------- */
.dropzone { position: relative; display: grid; place-items: center; gap: 6px; text-align: center; padding: clamp(24px, 6vw, 44px) 16px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--brand) 5%, transparent); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--accent); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.dropzone__icon { font-size: 2.4rem; line-height: 1; }
.dropzone__title { font-weight: 800; font-size: 1.05rem; }
.dropzone__hint { color: var(--glass-text-muted); font-size: .88rem; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.progress { height: 10px; border-radius: 999px; background: var(--glass-bg-subtle); border: 1px solid var(--glass-border); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--btn-gradient-primary); transition: width .2s ease; }
.progress-row { display: flex; justify-content: space-between; font-size: .85rem; color: var(--glass-text-muted); margin-top: 6px; }

/* ---------- tabs (segmented) ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); }
.seg__btn { flex: 1 1 auto; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 0; background: none; color: var(--glass-text-muted); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.seg__btn:hover { color: var(--glass-text-main); background: var(--glass-bg-hover); }
.seg__btn[aria-selected="true"], .seg__btn.is-active { background: var(--pill-gradient-active); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent); }
.tab-panel[hidden] { display: none; }

/* ---------- tables ---------- */
.tool-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tool-table th, .tool-table td { padding: 10px 12px; border-bottom: 1px solid var(--glass-border); text-align: start; vertical-align: middle; }
.tool-table th { font-size: .8rem; color: var(--glass-text-muted); font-weight: 700; background: var(--glass-bg-subtle); }
.tool-table tr.is-unread td { font-weight: 700; }
.tool-table .cell-ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-table tbody tr.is-clickable { cursor: pointer; }
.tool-table tbody tr.is-clickable:hover { background: var(--glass-bg-subtle); }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 28px 12px; color: var(--glass-text-muted); }
.empty-state__icon { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.empty-state__title { color: var(--glass-text-main); font-weight: 800; margin: 0 0 4px; font-size: 1.05rem; }
.empty-state p { margin: 0; }

/* ---------- notes ---------- */
.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); }
.note strong { color: var(--glass-text-main); }
.note--ok { border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .08); }
.note--warn { border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); }
.note__icon { flex: none; font-size: 1.1rem; line-height: 1.4; }

/* ---------- modal (extends .modal from site-shell) ---------- */
.modal__box--wide { width: min(860px, 100%); }
.modal__close { flex: none; }
.modal__meta { display: grid; gap: 4px; font-size: .88rem; color: var(--glass-text-muted); margin-bottom: 12px; overflow-wrap: anywhere; }
.mail-frame { width: 100%; min-height: 55vh; border: 1px solid var(--glass-border); border-radius: 12px; background: #fff; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 0; padding: 14px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); max-height: 60vh; overflow: auto; }

/* ---------- QR preview box ---------- */
.qr-box { display: grid; justify-items: center; gap: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--glass-border); background: var(--glass-bg-subtle); }
.qr-box canvas, .qr-box img, .qr-box svg { width: 180px; height: 180px; background: #fff; border-radius: 10px; padding: 8px; }

/* ---------- related tools ---------- */
.related-tools { margin-block: 36px 8px; }
.related-tools__title { font-size: 1.25rem; margin: 0 0 14px; }
.related-tools__grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.related-card { flex-direction: row; align-items: flex-start; gap: 12px; padding: 16px; color: var(--glass-text-main); }
.related-card__icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--brand) 14%, transparent); font-size: 1.3rem; }
.related-card__body { display: grid; gap: 4px; min-width: 0; }
.related-card__title { font-weight: 800; }
.related-card__text { font-size: .86rem; color: var(--glass-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-tools__all { margin: 14px 0 0; }
.related-tools__all a { color: var(--accent); font-weight: 700; text-decoration: none; }
.related-tools__all a:hover { text-decoration: underline; }

/* ---------- misc ---------- */
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; display: inline-block; animation: tool-spin .8s linear infinite; vertical-align: middle; }
@keyframes tool-spin { to { transform: rotate(360deg); } }
.text-ok { color: var(--ok); }
.text-danger { color: #f87171; }
html.light-mode .text-danger { color: #b91c1c; }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 560px) {
  .copy-row { flex-direction: column; }
  .panel__head .inline-actions { width: 100%; }
  .tool-table .cell-ellipsis { max-width: 160px; }
}
/* Honeypot fields: the core .hp-field uses left:-10000px, which creates a horizontal scrollbar in RTL.
   Clip it in place instead (core fix suggested in the report). */
.tool-page .hp-field { position: absolute !important; left: auto !important; inset-inline-start: 0 !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap; opacity: 0; }
