/* ==========================================
   SEO TOOLS (shared by every SEO tool page; builds on calculators.css)
========================================== */

.seo-page {
    --seo-good: #16a34a;
    --seo-warn: #d97706;
    --seo-bad: #dc2626;
    --seo-info: #2563eb;
    --seo-muted: #6b7280;
    --seo-line: #eef2f7;
}

/* ---------- URL bar ---------- */
.seo-search {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.seo-search:focus-within {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.seo-search > .bi {
    display: flex;
    align-items: center;
    padding: 0 0 0 16px;
    color: var(--seo-muted);
    font-size: 1.1rem;
}

.seo-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 14px 12px;
    font-size: 1.05rem;
    background: transparent;
}

.seo-search .btn {
    border-radius: 0;
    padding: 0 26px;
    font-weight: 600;
    white-space: nowrap;
}

.seo-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    margin-top: 14px;
    font-size: 0.9rem;
}

.seo-options .form-select {
    width: auto;
    display: inline-block;
}

.seo-examples {
    font-size: 0.85rem;
    color: var(--seo-muted);
    margin-top: 10px;
}

.seo-examples button {
    border: 0;
    background: #f1f5f9;
    color: #334155;
    border-radius: 999px;
    padding: 2px 10px;
    margin: 2px 2px 2px 0;
    font-size: 0.8rem;
}

.seo-examples button:hover {
    background: #e2e8f0;
}

.seo-textarea {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    min-height: 180px;
}

/* ---------- Status badges ---------- */
.seo-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 3px 8px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.seo-status.is-2xx { background: var(--seo-good); }
.seo-status.is-3xx { background: var(--seo-warn); }
.seo-status.is-4xx { background: var(--seo-bad); }
.seo-status.is-5xx { background: #7f1d1d; }
.seo-status.is-err { background: #475569; }

/* ---------- Verdict banner ---------- */
.seo-verdict {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    border-radius: 14px;
    padding: 16px 18px;
    border: 1px solid;
}

.seo-verdict > .bi {
    font-size: 1.6rem;
    line-height: 1;
}

.seo-verdict strong {
    display: block;
    font-size: 1.05rem;
}

.seo-verdict.is-good { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.seo-verdict.is-good > .bi { color: var(--seo-good); }
.seo-verdict.is-warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.seo-verdict.is-warn > .bi { color: var(--seo-warn); }
.seo-verdict.is-bad { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.seo-verdict.is-bad > .bi { color: var(--seo-bad); }
.seo-verdict.is-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.seo-verdict.is-info > .bi { color: var(--seo-info); }

/* ---------- Redirect chain ---------- */
.seo-chain {
    list-style: none;
    margin: 0;
    padding: 0;
}

.seo-hop {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--seo-line);
    border-radius: 12px;
}

.seo-hop + .seo-hop {
    margin-top: 28px;
}

/* Arrow between hops */
.seo-hop + .seo-hop::before {
    content: "\2193"; /* ↓ */
    position: absolute;
    top: -27px;
    left: 30px;
    color: #94a3b8;
    font-size: 1.15rem;
    font-weight: 700;
}

.seo-hop-body {
    min-width: 0;
    flex: 1 1 auto;
}

.seo-hop-url {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    word-break: break-all;
    color: var(--dark-color, #1f2937);
}

.seo-hop-meta {
    font-size: 0.78rem;
    color: var(--seo-muted);
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.seo-hop.is-final {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.seo-hop.is-error {
    border-color: #fecaca;
    background: #fef2f2;
}

.seo-chain-group + .seo-chain-group {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #e2e8f0;
}

.seo-chain-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 10px;
    word-break: break-all;
}

/* ---------- Tables ---------- */
.seo-table td.seo-url,
.seo-table th.seo-url {
    word-break: break-all;
    min-width: 220px;
}

.seo-table .seo-url {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
}

.seo-table tbody tr.is-clickable {
    cursor: pointer;
}

.seo-table tbody tr.is-clickable:hover td {
    background: #f8fafc;
}

.seo-table .seo-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--seo-muted);
    font-family: inherit;
}

/* ---------- Filters ---------- */
.seo-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seo-filter {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

.seo-filter span {
    color: var(--seo-muted);
    font-weight: 500;
    margin-left: 4px;
}

.seo-filter.active {
    background: var(--primary-color, #2563eb);
    border-color: var(--primary-color, #2563eb);
    color: #fff;
}

.seo-filter.active span {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Progress ---------- */
.seo-progress {
    height: 8px;
    border-radius: 999px;
    background: #e9ecef;
    overflow: hidden;
}

.seo-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.25s ease;
}

/* ---------- Score ring ---------- */
.seo-score {
    --score: 0;
    --score-color: var(--seo-good);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--score-color) calc(var(--score) * 1%), #e9ecef 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.seo-score span {
    width: 94px;
    height: 94px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.seo-score small {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--seo-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Check list ---------- */
.seo-checks {
    list-style: none;
    margin: 0;
    padding: 0;
}

.seo-checks li {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--seo-line);
}

.seo-checks li:last-child {
    border-bottom: 0;
}

.seo-checks li > .bi {
    font-size: 1.15rem;
    line-height: 1.3;
}

.seo-checks .is-pass > .bi { color: var(--seo-good); }
.seo-checks .is-warn > .bi { color: var(--seo-warn); }
.seo-checks .is-fail > .bi { color: var(--seo-bad); }
.seo-checks .is-info > .bi { color: var(--seo-info); }

.seo-checks strong {
    display: block;
    font-size: 0.95rem;
}

.seo-checks p {
    margin: 2px 0 0;
    font-size: 0.875rem;
    color: #475569;
    word-break: break-word;
}

.seo-checks code,
.seo-value {
    font-size: 0.82rem;
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 6px;
    padding: 1px 6px;
    word-break: break-all;
}

/* ---------- Search & social previews ---------- */
.seo-serp {
    font-family: Arial, Helvetica, sans-serif;
    max-width: 600px;
}

.seo-serp-site {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #202124;
}

.seo-serp-site img,
.seo-serp-site .seo-serp-fav {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f3f4;
    border: 1px solid #e8eaed;
    object-fit: contain;
    padding: 3px;
}

.seo-serp-site small {
    display: block;
    color: #4d5156;
    font-size: 12px;
}

.seo-serp-title {
    color: #1a0dab;
    font-size: 20px;
    line-height: 1.3;
    margin: 6px 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seo-serp-desc {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.58;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.seo-social {
    border: 1px solid #dadde1;
    border-radius: 10px;
    overflow: hidden;
    max-width: 520px;
    background: #fff;
}

.seo-social-img {
    aspect-ratio: 1.91 / 1;
    background: #f0f2f5 center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.seo-social-body {
    padding: 10px 12px;
    background: #f0f2f5;
    border-top: 1px solid #dadde1;
}

.seo-social-body small {
    text-transform: uppercase;
    color: #606770;
    font-size: 12px;
}

.seo-social-body strong {
    display: block;
    color: #1d2129;
    font-size: 16px;
    line-height: 1.3;
    margin: 2px 0;
}

.seo-social-body p {
    margin: 0;
    color: #606770;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Length meter under title/description */
.seo-meter {
    height: 6px;
    border-radius: 999px;
    background: #e9ecef;
    overflow: hidden;
    margin-top: 6px;
}

.seo-meter span {
    display: block;
    height: 100%;
}

/* ---------- robots.txt viewer ---------- */
.seo-code {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    max-height: 460px;
    overflow: auto;
    padding: 10px 0;
}

.seo-code-line {
    display: flex;
    padding: 0 14px 0 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.seo-code-line .ln {
    flex: 0 0 46px;
    text-align: right;
    padding-right: 12px;
    color: #64748b;
    user-select: none;
}

.seo-code-line .c-comment { color: #64748b; }
.seo-code-line .c-key { color: #93c5fd; font-weight: 600; }
.seo-code-line .c-bad { color: #fca5a5; }

.seo-code-line.is-allow {
    background: rgba(22, 163, 74, 0.28);
}

.seo-code-line.is-block {
    background: rgba(220, 38, 38, 0.32);
}

.seo-code-line.is-group {
    background: rgba(59, 130, 246, 0.14);
}

.seo-editor {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    min-height: 300px;
}

.seo-test-result {
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    color: #fff;
}

.seo-test-result.is-allowed { background: linear-gradient(135deg, #16a34a, #15803d); }
.seo-test-result.is-blocked { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.seo-test-result .seo-test-big {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
}

/* ---------- Empty state ---------- */
.seo-empty {
    text-align: center;
    color: var(--seo-muted);
    padding: 2.5rem 1rem;
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
}

.seo-empty .bi {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 10px;
    color: #cbd5e1;
}

/* ---------- Related tools ---------- */
.seo-related-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.seo-related-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

.seo-related-card > .bi {
    font-size: 1.3rem;
    color: #ea580c;
    background: #fff7ed;
    border-radius: 10px;
    padding: 6px 9px;
}

.seo-related-card strong {
    display: block;
    color: var(--dark-color, #1f2937);
}

.seo-related-card small {
    color: var(--seo-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 575px) {
    .seo-search {
        flex-wrap: wrap;
    }

    .seo-search input {
        flex-basis: calc(100% - 40px);
    }

    .seo-search .btn {
        flex: 1 1 100%;
        padding: 12px;
    }

    .seo-hop {
        padding: 10px;
        gap: 10px;
    }

    .seo-score {
        width: 100px;
        height: 100px;
    }

    .seo-score span {
        width: 78px;
        height: 78px;
        font-size: 1.6rem;
    }
}

/* ---------- Phone preview (Mobile-Friendly Test) ---------- */
.seo-phone {
    position: relative;
    width: 300px;
    height: 600px;
    margin: 0 auto;
    border: 10px solid #0f172a;
    border-radius: 38px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2);
}

/* Render at a real phone width (375px) and scale down to fit the frame */
.seo-phone iframe {
    width: 375px;
    height: 777px;
    border: 0;
    transform: scale(0.746);
    transform-origin: 0 0;
}

.seo-phone-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: var(--seo-muted);
    font-size: 0.85rem;
    background: #f8fafc;
}

.seo-phone-empty .bi {
    font-size: 2rem;
    color: #cbd5e1;
}

.seo-phone-empty strong {
    color: var(--dark-color, #1f2937);
    word-break: break-word;
}

@media (max-width: 575px) {
    .seo-phone {
        width: 260px;
        height: 520px;
    }

    .seo-phone iframe {
        transform: scale(0.64);
        height: 783px;
    }
}

/* ---------- Schema Generator ---------- */
.sg-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sg-type {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sg-type .bi {
    color: #ea580c;
}

.sg-type:hover {
    border-color: #fdba74;
}

.sg-type.active {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

.sg-type.active .bi {
    color: #fff;
}

.sg-item {
    border: 1px solid #eef2f7;
    border-radius: 12px;
    padding: 12px 14px 6px;
    margin-bottom: 10px;
    background: #f8fafc;
}

.sg-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--seo-muted);
}

.sg-code {
    margin: 0;
    padding: 14px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 520px;
}

.sg-code .j-key { color: #93c5fd; }
.sg-code .j-str { color: #86efac; }
.sg-code .j-num { color: #fcd34d; }
.sg-code .j-tag { color: #64748b; }

/* ---------- SEO audit: category scores ---------- */
.au-score {
    width: 140px;
    height: 140px;
}

.au-score span {
    width: 112px;
    height: 112px;
    font-size: 2.4rem;
}

.au-cats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px;
}

.au-cat {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.au-cat-name {
    flex: 0 0 104px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #334155;
}

.au-cat-name .bi {
    color: #94a3b8;
}

.au-cat .seo-meter {
    margin-top: 0;
    height: 8px;
}

.au-cat-score {
    flex: 0 0 30px;
    text-align: right;
    font-weight: 700;
}

@media (max-width: 575px) {
    .au-cats {
        grid-template-columns: 1fr;
    }
}
