/* HussoTech AI Tools — scoped styles (all classes prefixed .ait-).
   Uses the site's CSS variables with fallbacks so it works with any active theme. */

.ait-hero, .ait-section, .ait-panel, .ait-card, .ait-form {
    --ait-primary: var(--primary, #8b5cf6);
    --ait-primary-light: var(--primary-light, #a78bfa);
    --ait-secondary: var(--secondary, #06b6d4);
    --ait-green: var(--accent-green, #10b981);
    --ait-amber: var(--accent, #f59e0b);
    --ait-danger: #ef4444;
    --ait-text: var(--text-primary, #f8fafc);
    --ait-text-2: var(--text-secondary, #cbd5e1);
    --ait-muted: var(--text-muted, #94a3b8);
    --ait-card: var(--bg-card, rgba(15, 23, 42, .8));
    --ait-card-2: var(--bg-tertiary, #1e293b);
    --ait-field: var(--bg-secondary, #0f172a);
    --ait-border: var(--border-subtle, rgba(255, 255, 255, .08));
    --ait-border-strong: rgba(148, 163, 184, .35);
    --ait-radius: 16px;
    --ait-gradient: var(--gradient-primary, linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%));
}

.ait-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.ait-hero { padding-bottom: 2.5rem; }
.ait-hero-tool { padding-bottom: 1.5rem; }
.ait-eyebrow { display: inline-flex; gap: .5rem; align-items: center; margin: 0 0 .75rem; padding: .35rem .8rem; border-radius: 999px; background: rgba(139, 92, 246, .15); color: var(--ait-primary-light); font-size: .85rem; font-weight: 600; }
.ait-hero-title { color: var(--ait-text); font-size: clamp(1.7rem, 4.5vw, 3rem); line-height: 1.15; font-weight: 800; margin: 0 0 .75rem; overflow-wrap: anywhere; }
.ait-hero-sub { color: var(--ait-text-2); font-size: clamp(1rem, 2.2vw, 1.15rem); max-width: 720px; margin: 0 0 1.5rem; line-height: 1.6; }
.ait-hero-sub a { color: var(--ait-primary-light); }
.ait-hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1rem; color: var(--ait-muted); font-size: .9rem; }
.ait-hero-meta i { color: var(--ait-green); margin-right: .25rem; }
.ait-hero-meta a { color: var(--ait-primary-light); text-decoration: none; }
.ait-hero-meta a:hover { text-decoration: underline; }

.ait-search { position: relative; max-width: 640px; }
.ait-search i { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--ait-muted); pointer-events: none; }
.ait-search input { width: 100%; box-sizing: border-box; padding: 1rem 1rem 1rem 2.9rem; font-size: 1.05rem; border-radius: 999px; border: 2px solid var(--ait-border-strong); background: var(--ait-field); color: var(--ait-text); outline: none; transition: border-color .2s, box-shadow .2s; }
.ait-search input:focus { border-color: var(--ait-primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, .25); }
.ait-search input::placeholder { color: var(--ait-muted); }

.ait-crumbs { font-size: .9rem; color: var(--ait-muted); margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.ait-crumbs a { color: var(--ait-primary-light); text-decoration: none; }
.ait-crumbs a:hover { text-decoration: underline; }
.ait-tool-head { display: flex; gap: 1rem; align-items: flex-start; }
.ait-tool-head .ait-hero-sub { margin-bottom: 0; }
.ait-tool-icon { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--ait-gradient); color: #fff; font-size: 1.6rem; box-shadow: 0 10px 30px rgba(139, 92, 246, .3); }

/* ── Sections / layout ────────────────────────────────────────────────── */
.ait-section { padding: 2rem 0 3rem; }
.ait-h2 { color: var(--ait-text); font-size: clamp(1.35rem, 3vw, 1.8rem); margin: 0 0 1.25rem; }
.ait-h3 { color: var(--ait-text); font-size: 1.05rem; margin: 0 0 .75rem; display: flex; gap: .5rem; align-items: center; }
.ait-h3 i { color: var(--ait-primary-light); }
.ait-muted { color: var(--ait-muted); }
.ait-note { color: var(--ait-text-2); margin-top: 1.5rem; }
.ait-note a, .ait-link { color: var(--ait-primary-light); }
.ait-link { display: inline-block; margin-top: .5rem; text-decoration: none; font-weight: 600; }
.ait-link:hover { text-decoration: underline; }

.ait-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
@media (min-width: 992px) { .ait-layout { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; } }
.ait-side { display: grid; gap: 1.25rem; }

.ait-panel { background: var(--ait-card); border: 1px solid var(--ait-border); border-radius: var(--ait-radius); padding: 1.5rem; color: var(--ait-text-2); }
@media (max-width: 480px) { .ait-panel { padding: 1rem; border-radius: 12px; } }

/* ── Category chips ───────────────────────────────────────────────────── */
.ait-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.ait-chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--ait-border-strong); background: transparent; color: var(--ait-text-2); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.ait-chip:hover { border-color: var(--ait-primary); color: var(--ait-text); }
.ait-chip.is-active { background: var(--ait-primary); border-color: var(--ait-primary); color: #fff; }
.ait-chip:focus-visible { outline: 3px solid var(--ait-secondary); outline-offset: 2px; }
.ait-chip-count { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(148, 163, 184, .2); }
.ait-chip.is-active .ait-chip-count { background: rgba(255, 255, 255, .25); }

/* ── Tool cards ───────────────────────────────────────────────────────── */
.ait-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.ait-card { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem; background: var(--ait-card); border: 1px solid var(--ait-border); border-radius: var(--ait-radius); text-decoration: none; color: var(--ait-text-2); transition: transform .2s, border-color .2s, box-shadow .2s; min-width: 0; }
.ait-card[hidden] { display: none; }
.ait-card:hover { transform: translateY(-3px); border-color: var(--ait-primary); box-shadow: 0 12px 32px rgba(139, 92, 246, .2); color: var(--ait-text-2); }
.ait-card:focus-visible { outline: 3px solid var(--ait-secondary); outline-offset: 2px; }
.ait-card-icon { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--ait-gradient); color: #fff; font-size: 1.2rem; }
.ait-card-icon-sm { width: 38px; height: 38px; border-radius: 10px; font-size: 1rem; }
.ait-card-body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; flex: 1; }
.ait-card-title { color: var(--ait-text); font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.ait-card-desc { font-size: .92rem; line-height: 1.5; }
.ait-card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.ait-card-go { color: var(--ait-muted); align-self: center; transition: transform .2s, color .2s; }
.ait-card:hover .ait-card-go { color: var(--ait-primary-light); transform: translateX(3px); }

.ait-tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: rgba(139, 92, 246, .14); color: var(--ait-primary-light); }
.ait-tag-green { background: rgba(16, 185, 129, .15); color: #34d399; }
.ait-tag-amber { background: rgba(245, 158, 11, .15); color: #fbbf24; }

.ait-empty { text-align: center; padding: 3rem 1rem; color: var(--ait-text-2); }
.ait-empty[hidden] { display: none; }
.ait-empty > i { font-size: 2.5rem; color: var(--ait-muted); margin-bottom: 1rem; display: block; }

/* How it works */
.ait-how { padding-top: 1rem; }
.ait-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.ait-steps li { display: flex; flex-direction: column; gap: .3rem; padding: 1.25rem; border-radius: var(--ait-radius); background: var(--ait-card); border: 1px solid var(--ait-border); color: var(--ait-text-2); }
.ait-steps strong { color: var(--ait-text); }
.ait-step-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ait-gradient); color: #fff; font-weight: 800; margin-bottom: .25rem; }

/* ── Form ─────────────────────────────────────────────────────────────── */
.ait-intro { margin: 0 0 1.25rem; font-size: 1.02rem; line-height: 1.6; color: var(--ait-text-2); }
.ait-form { display: grid; gap: 1.1rem; }
.ait-field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.ait-label, .ait-multi legend { color: var(--ait-text); font-weight: 600; font-size: 1rem; padding: 0; }
.ait-req { color: var(--ait-danger); margin-left: .15rem; }
.ait-input { width: 100%; box-sizing: border-box; padding: .85rem 1rem; font: inherit; font-size: 1rem; line-height: 1.5; color: var(--ait-text); background: var(--ait-field); border: 2px solid var(--ait-border-strong); border-radius: 12px; outline: none; transition: border-color .2s, box-shadow .2s; }
.ait-input::placeholder { color: var(--ait-muted); opacity: 1; }
.ait-input:focus { border-color: var(--ait-primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, .22); }
.ait-input.is-invalid { border-color: var(--ait-danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, .18); }
.ait-input:disabled { opacity: .6; cursor: not-allowed; }
textarea.ait-input { resize: vertical; min-height: 110px; }
select.ait-input { appearance: auto; min-height: 50px; cursor: pointer; }
select.ait-input option { background: var(--ait-card-2); color: var(--ait-text); }
.ait-input-short { max-width: 160px; }
.ait-color { width: 64px; height: 44px; padding: 2px; border-radius: 10px; border: 2px solid var(--ait-border-strong); background: var(--ait-field); cursor: pointer; }
.ait-help { margin: 0; font-size: .875rem; color: var(--ait-muted); }
.ait-counter { font-size: .8rem; color: var(--ait-muted); text-align: right; min-height: 1em; }
.ait-counter.is-near { color: var(--ait-amber); }

.ait-check { display: inline-flex; gap: .65rem; align-items: center; cursor: pointer; color: var(--ait-text); font-weight: 500; min-height: 44px; }
.ait-check input { width: 22px; height: 22px; accent-color: var(--ait-primary); cursor: pointer; }
.ait-field-check { gap: 0; }

.ait-multi { border: 0; margin: 0; padding: 0; min-width: 0; }
.ait-multi legend { margin-bottom: .5rem; }
.ait-multi-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.ait-pill { position: relative; cursor: pointer; }
.ait-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ait-pill span { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem 1rem; border-radius: 999px; border: 2px solid var(--ait-border-strong); color: var(--ait-text-2); font-weight: 600; transition: background .2s, border-color .2s, color .2s; }
.ait-pill input:checked + span { background: rgba(139, 92, 246, .2); border-color: var(--ait-primary); color: var(--ait-text); }
.ait-pill input:checked + span::before { content: "\2713"; margin-right: .4rem; color: var(--ait-primary-light); }
.ait-pill input:focus-visible + span { outline: 3px solid var(--ait-secondary); outline-offset: 2px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.ait-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: .25rem; }
.ait-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .65rem 1.2rem; border-radius: 999px; border: 2px solid var(--ait-border-strong); background: transparent; color: var(--ait-text); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.ait-btn:hover { border-color: var(--ait-primary); color: var(--ait-text); }
.ait-btn:focus-visible { outline: 3px solid var(--ait-secondary); outline-offset: 2px; }
.ait-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.ait-btn-primary { border: 0; background: var(--ait-gradient); color: #fff; font-size: 1.08rem; padding: .95rem 2rem; min-height: 54px; box-shadow: 0 10px 28px rgba(139, 92, 246, .35); }
.ait-btn-primary:hover:not(:disabled) { transform: translateY(-2px); color: #fff; box-shadow: 0 14px 36px rgba(139, 92, 246, .45); }
.ait-btn-ghost { border-color: transparent; color: var(--ait-primary-light); }
.ait-btn-ghost:hover { background: rgba(139, 92, 246, .12); border-color: transparent; color: var(--ait-primary-light); }
.ait-btn-small { min-height: 40px; padding: .45rem .9rem; font-size: .88rem; }
.ait-btn-danger:hover { border-color: var(--ait-danger); color: var(--ait-danger); }
.ait-btn.is-on { border-color: var(--ait-green); color: var(--ait-green); }
@media (max-width: 480px) {
    .ait-actions .ait-btn-primary { width: 100%; }
    .ait-actions .ait-btn-ghost { width: 100%; }
}

.ait-btn-busy { display: none; align-items: center; gap: .6rem; }
.ait-form.is-busy .ait-btn-label { display: none; }
.ait-form.is-busy .ait-btn-busy { display: inline-flex; }

.ait-spinner { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: ait-spin .75s linear infinite; vertical-align: -.15em; }
@keyframes ait-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ait-spinner { animation-duration: 2s; } .ait-card, .ait-btn { transition: none; } }

.ait-quota { margin: 0; font-size: .9rem; color: var(--ait-muted); }
.ait-quota i { margin-right: .3rem; }
.ait-quota a { color: var(--ait-primary-light); }

/* ── Alerts / status ──────────────────────────────────────────────────── */
.ait-alert, .ait-status { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.1rem; border-radius: 12px; margin-bottom: 1.1rem; line-height: 1.5; }
.ait-alert > i { margin-top: .2rem; }
.ait-alert div { display: flex; flex-direction: column; gap: .2rem; }
.ait-alert strong { color: var(--ait-text); }
.ait-alert a, .ait-status a { color: inherit; font-weight: 700; text-decoration: underline; }
.ait-alert-info { background: rgba(6, 182, 212, .12); border: 1px solid rgba(6, 182, 212, .35); color: var(--ait-text-2); }
.ait-alert-warn { background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); color: var(--ait-text-2); }
.ait-status { margin: 1.1rem 0 0; align-items: center; }
.ait-status[hidden] { display: none; }
.ait-status-busy { background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3); color: var(--ait-text); }
.ait-status-error { background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); color: #fecaca; display: block; }
.ait-status-info { background: rgba(6, 182, 212, .12); border: 1px solid rgba(6, 182, 212, .35); color: var(--ait-text); }

/* ── Result ───────────────────────────────────────────────────────────── */
.ait-result { margin-top: 1.5rem; border-top: 1px solid var(--ait-border); padding-top: 1.25rem; outline: none; }
.ait-result[hidden] { display: none; }
.ait-result-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.ait-result-title { margin: 0; font-size: 1.2rem; color: var(--ait-text); display: flex; gap: .5rem; align-items: center; }
.ait-result-title i { color: var(--ait-green); }
.ait-result-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.ait-result-body { background: var(--ait-field); border: 1px solid var(--ait-border); border-radius: 12px; padding: 1.25rem; color: var(--ait-text); line-height: 1.7; font-size: 1rem; overflow-wrap: anywhere; min-width: 0; }
.ait-result-body > :first-child { margin-top: 0; }
.ait-result-body > :last-child { margin-bottom: 0; }
.ait-result-body h3, .ait-result-body h4, .ait-result-body h5, .ait-result-body h6 { color: var(--ait-text); margin: 1.25rem 0 .5rem; line-height: 1.3; }
.ait-result-body h3 { font-size: 1.3rem; } .ait-result-body h4 { font-size: 1.12rem; } .ait-result-body h5, .ait-result-body h6 { font-size: 1rem; }
.ait-result-body p { margin: 0 0 .9rem; }
.ait-result-body ul, .ait-result-body ol { margin: 0 0 .9rem; padding-left: 1.4rem; }
.ait-result-body li { margin-bottom: .3rem; }
.ait-result-body strong { color: var(--ait-text); }
.ait-result-body a { color: var(--ait-primary-light); }
.ait-result-body blockquote { margin: 0 0 .9rem; padding: .5rem 1rem; border-left: 3px solid var(--ait-primary); color: var(--ait-text-2); }
.ait-result-body hr { border: 0; border-top: 1px solid var(--ait-border); margin: 1.25rem 0; }
.ait-result-body :not(pre) > code { background: rgba(148, 163, 184, .18); padding: .1rem .35rem; border-radius: 6px; font-size: .9em; }
.ait-result-foot { margin: .6rem 0 0; font-size: .85rem; color: var(--ait-muted); }

.ait-code { margin: 0 0 1rem; border-radius: 10px; overflow: hidden; border: 1px solid rgba(148, 163, 184, .25); background: #0d1117; }
.ait-code-head { display: flex; justify-content: space-between; align-items: center; padding: .35rem .75rem; background: #161b22; color: #8b949e; font-size: .8rem; }
.ait-code-copy { background: transparent; border: 1px solid #30363d; color: #c9d1d9; border-radius: 6px; padding: .25rem .6rem; font-size: .78rem; cursor: pointer; min-height: 32px; }
.ait-code-copy:hover { border-color: #8b949e; }
.ait-code pre { margin: 0; padding: 1rem; overflow-x: auto; color: #e6edf3; font-size: .88rem; line-height: 1.55; white-space: pre; }
.ait-code code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; background: none; padding: 0; }

.ait-image { margin: 0; text-align: center; }
.ait-image img { max-width: 100%; height: auto; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.ait-qr { display: inline-block; padding: 16px; background: #fff; border-radius: 12px; }
.ait-qr img, .ait-qr canvas { display: block; max-width: 100%; height: auto; }

.ait-pw { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.ait-pw li { display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: .6rem .8rem; border-radius: 10px; background: rgba(139, 92, 246, .08); border: 1px solid rgba(139, 92, 246, .2); }
.ait-pw code { font-size: 1rem; letter-spacing: .04em; word-break: break-all; background: none !important; }
.ait-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.ait-stats div { display: flex; flex-direction: column; padding: .8rem; border-radius: 10px; background: rgba(139, 92, 246, .08); border: 1px solid var(--ait-border); }
.ait-stats strong { font-size: 1.4rem; color: var(--ait-text); }
.ait-stats span { font-size: .82rem; color: var(--ait-muted); }
.ait-limits { list-style: none; padding: 0 !important; }
.ait-limits .is-ok i { color: var(--ait-green); }
.ait-limits .is-over i { color: var(--ait-danger); }
.ait-ok i { color: var(--ait-green); }

/* ── Side panels ──────────────────────────────────────────────────────── */
.ait-tips ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }
.ait-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.ait-recent a { color: var(--ait-text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ait-recent a:hover { color: var(--ait-primary-light); }
.ait-recent small { color: var(--ait-muted); font-size: .8rem; }
.ait-related { display: grid; gap: .5rem; }
.ait-related-item { display: flex; gap: .75rem; align-items: center; padding: .6rem; border-radius: 12px; text-decoration: none; color: var(--ait-text-2); transition: background .2s; }
.ait-related-item:hover { background: rgba(139, 92, 246, .1); color: var(--ait-text-2); }
.ait-related-item strong { display: block; color: var(--ait-text); font-size: .95rem; }
.ait-related-item small { display: block; font-size: .82rem; line-height: 1.4; }
.ait-back { margin-top: 0; }

/* ── History ──────────────────────────────────────────────────────────── */
.ait-history { display: grid; gap: 1.25rem; }
.ait-history-item[hidden] { display: none; }
.ait-history-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.ait-history-title { color: var(--ait-text); font-size: 1.1rem; margin: .4rem 0 .2rem; overflow-wrap: anywhere; }
.ait-history-input { margin-bottom: .75rem; }
.ait-history-input summary { cursor: pointer; color: var(--ait-primary-light); font-weight: 600; min-height: 32px; }
.ait-history-input pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; color: var(--ait-text-2); background: var(--ait-field); padding: .75rem; border-radius: 10px; margin: .5rem 0 0; }
.ait-history-body { max-height: 480px; overflow: auto; }

/* ── Small screens (down to 320px) ────────────────────────────────────── */
@media (max-width: 575px) {
    .ait-section { padding: 1.5rem 0 2rem; }
    .ait-tool-head { gap: .75rem; }
    .ait-tool-icon { width: 48px; height: 48px; font-size: 1.2rem; border-radius: 14px; }
    .ait-card { padding: 1rem; gap: .8rem; }
    .ait-card-icon { width: 42px; height: 42px; }
    .ait-card-go { display: none; }
    .ait-result-body { padding: 1rem; }
    .ait-result-tools .ait-btn-small { flex: 1 1 auto; }
    .ait-search input { font-size: 1rem; }
}
