/* ============================================================
   TheSEOLabs — Design System
   Dark mode · #ff4a06 accent · Vanilla CSS
   ============================================================ */

/* Fonts loaded via <link> tags in header.php */

/* ── Design Tokens ── */
:root {
    --bg: #0f0f0f;
    --bg-surface: #161616;
    --bg-card: #1c1c1c;
    --bg-input: #141414;
    --border: #252525;
    --border-hover: #3a3a3a;
    --accent: #ff4a06;
    --accent-hover: #e04005;
    --accent-dim: rgba(255, 74, 6, 0.12);
    --accent-glow: rgba(255, 74, 6, 0.25);
    --text: #e8e6e3;
    --text-muted: #8a8a8a;
    --text-dim: #3a3a3a;
    --text-link: #ff6a30;
    --success: #22c55e;
    --accent-border: rgba(255, 74, 6, 0.2);
    --row-alt: rgba(255, 255, 255, 0.015);
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --font: "DM Sans", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    --nav-h: 60px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-accent: 0 0 20px rgba(255, 74, 6, 0.15);
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Noise Texture ── */
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    background-repeat: repeat;
}

body > * {
    position: relative;
    z-index: 1;
}

/* ── Typography ── */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

h1 {
    font-size: 1.75rem;
}
h2 {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
}
h3 {
    font-size: 1rem;
    margin: 1.5rem 0 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}
ul,
ol {
    padding-left: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
li {
    margin-bottom: 0.25rem;
}

strong {
    color: var(--text);
    font-weight: 600;
}
em {
    color: var(--text-muted);
}

mark {
    background: none;
    color: var(--accent);
    font-weight: 600;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--accent);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

pre {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
}

/* ── Site Header / Navigation ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: rgba(15, 15, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.site-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text) !important;
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.site-logo span {
    color: var(--accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-nav a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition:
        color 0.15s ease,
        background 0.15s ease;
}
.site-nav a:hover {
    color: var(--text);
    background: var(--bg-surface);
}
.site-nav a.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* ── Page Wrapper — see app-layout section below for flex override ── */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── Tool Header ── */
.tool-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tool-header h1 {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-header .tool-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 680px;
}

/* ── Tool Form Card ── */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* ── Form Elements ── */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    min-width: 160px;
}

.form-group label,
form > label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    cursor: default;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.875rem;
    font-family: var(--font);
    font-size: 0.9rem;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

option {
    background: var(--bg-card);
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: var(--mono);
    font-size: 0.85rem;
}

/* Checkboxes */
input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-width: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
    margin-right: 0.3rem;
}

/* Number filter group */
.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

.filter-group input[type="number"] {
    width: 90px;
    min-width: 90px;
}

/* ── Buttons ── */
input[type="submit"],
button[type="submit"],
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.7rem 1.5rem;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.15s ease,
        transform 0.1s ease,
        box-shadow 0.15s ease;
    text-decoration: none;
    width: fit-content;
}

input[type="submit"]:hover,
button[type="submit"]:hover,
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}

input[type="submit"]:active,
button[type="submit"]:active,
.btn-primary:active {
    transform: scale(0.98);
}

input[type="submit"]:disabled,
button[type="submit"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary,
.export-csv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.55rem 1rem;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
    text-decoration: none;
}

.btn-secondary:hover,
.export-csv-btn:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--bg-surface);
}

/* ── Loader ── */
#loader {
    display: none;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem 0;
}

#loader::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Cloudflare Turnstile ── */
.cf-turnstile {
    margin-top: 0.25rem;
}

/* ── Results / Tables ── */
#results {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.results-header h3 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.results-count {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.results-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Table wrapper — enables horizontal scroll */
.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    background: var(--bg-surface);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

thead th:hover {
    color: var(--text);
    background: var(--bg-card);
}

thead th::after {
    content: " ⇅";
    color: var(--text-dim);
    font-size: 0.8em;
    font-weight: 400;
}

thead th.sorting-asc::after {
    content: " ↑";
    color: var(--accent);
}
thead th.sorting-desc::after {
    content: " ↓";
    color: var(--accent);
}
thead th.sorting-asc,
thead th.sorting-desc {
    color: var(--accent);
    background: var(--accent-dim);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s ease;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-surface);
}

tbody tr:nth-child(even) {
    background: var(--row-alt);
}

tbody tr:nth-child(even):hover {
    background: var(--bg-surface);
}

td {
    padding: 0.65rem 1rem;
    color: var(--text);
    vertical-align: top;
}

/* Numeric cells — scoped to results tables only */
.table-wrap td:nth-child(3),
.table-wrap td:nth-child(4) {
    font-family: var(--mono);
    font-size: 0.82rem;
    text-align: right;
    color: var(--text);
}

/* First column — keyword */
td:first-child {
    font-weight: 500;
    color: var(--text);
}

/* Category tags inside cells */
.tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}

/* Export button in results header */
.export-csv-btn {
    flex-shrink: 0;
}

/* ── Tool Grid (Homepage) ── */
.tools-section {
    margin: 2.5rem 0;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-heading h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-heading .section-count {
    font-size: 0.75rem;
    font-family: var(--mono);
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
}

.section-heading::before {
    content: "";
    display: block;
    width: 3px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
}

.tool-card-link {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.125rem 1.25rem;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.tool-card-link:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--accent-dim);
}

.tool-card-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.tool-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tool-card-desc {
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Hero Section ── */
.hero {
    padding: 0rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.hero h1 span {
    color: var(--accent);
}

.hero p {
    font-size: 1rem;
    color: var(--text-muted);
    /*! max-width: 560px; */
    margin-bottom: 0;
}

/* ── Main keyword tool on homepage ── */
.main-tool {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.main-tool h2 {
    font-size: 1.1rem;
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Info Content (marketing paragraphs) ── */
.info-content {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.info-content h2 {
    font-size: 1.1rem;
    color: var(--text);
    margin: 2rem 0 0.75rem;
}

.info-content h3 {
    font-size: 0.95rem;
    color: var(--text);
    margin: 1.5rem 0 0.5rem;
}

.info-content p,
.info-content li {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.info-content figure {
    margin: 1.5rem 0;
}

.info-content figure img {
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Comparison table inside info content */
.info-content figure table {
    font-size: 0.82rem;
}

.info-content figure table th {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.65rem 0.875rem;
    border: 1px solid var(--border);
}

.info-content figure table td {
    padding: 0.6rem 0.875rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}

.info-content figure table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* ── Blog Cards ── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition:
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
    text-decoration: none;
}

.blog-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--accent-dim);
}

.blog-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border);
}

.blog-card-body {
    padding: 0.875rem 1rem;
}

.blog-card-body h3 {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 600;
}

.blog-card-body p {
    margin: 0.4rem 0 0;
    font-size: 0.775rem;
    color: var(--text-muted);
}

/* ── Site Footer ── */
.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-inner span,
.footer-inner a {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--text);
}

/* ── Breadcrumb ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--accent);
}
.breadcrumb-sep {
    opacity: 0.4;
}

/* ── Notice / Alert ── */
.notice {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 1rem 0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    h1 {
        font-size: 1.5rem;
    }
    .hero h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 640px) {
    .page-wrapper {
        padding: 1.5rem 1rem 3rem;
    }
    .tool-grid {
        grid-template-columns: 1fr;
    }
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .hero {
        padding: 2rem 0 1.5rem;
    }
    .hero h1 {
        font-size: 1.5rem;
    }
    .main-tool {
        padding: 1.25rem;
    }
    .tool-card {
        padding: 1.25rem;
    }

    .header-inner {
        padding: 0 1rem;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.25rem;
    }

    .site-nav.open {
        display: flex;
    }
    .nav-toggle {
        display: block;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    input[type="submit"],
    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-group input[type="number"] {
        width: 100%;
    }

    td:nth-child(3),
    td:nth-child(4) {
        text-align: left;
    }
}

/* ── Filter inputs — disabled state ── */
.filter-group input[type="number"]:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Empty / no-results state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 2rem;
    background: var(--bg-card);
}

.empty-state .empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state .empty-desc {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ── Selection ── */
::selection {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── App Layout (header + left sidebar + content + right sidebar) ── */
.app-layout {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--nav-h));
}

/* ── Tool Sidebar (left, 68px) ── */
.tool-sidebar {
    width: 68px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    overflow: visible;
    z-index: 90;
}

.sidebar-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 0.25rem;
    gap: 0.3rem;
    cursor: pointer;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
    user-select: none;
}

.sidebar-item:hover,
.sidebar-item:focus-within {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.sidebar-item.active {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.sidebar-icon {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.sidebar-item:hover .sidebar-icon,
.sidebar-item:focus-within .sidebar-icon,
.sidebar-item.active .sidebar-icon {
    color: var(--accent);
}

.sidebar-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    transition: color 0.15s ease;
    text-align: center;
    line-height: 1.2;
}

.sidebar-item:hover .sidebar-label,
.sidebar-item:focus-within .sidebar-label,
.sidebar-item.active .sidebar-label {
    color: var(--accent);
}

/* ── Sidebar Flyout Panel ── */
.sidebar-flyout {
    display: none;
    position: fixed;
    left: 68px;
    top: var(--nav-h);
    width: 220px;
    height: calc(100vh - var(--nav-h));
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0.875rem;
    flex-direction: column;
    z-index: 89;
    overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
}

.sidebar-item:hover .sidebar-flyout,
.sidebar-item:focus-within .sidebar-flyout {
    display: flex;
}

.flyout-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    padding: 0 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.flyout-link {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition:
        color 0.12s ease,
        background 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flyout-link:hover {
    color: var(--text);
    background: var(--bg-surface);
}

/* ── Page Wrapper (main content, overrides base rule above) ── */
.app-layout > .page-wrapper {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── Sponsor Rail (right sidebar, 325px) ── */
.sponsor-rail {
    width: 325px;
    flex-shrink: 0;
    padding-top: 2.5rem;
    padding-right: 1.5rem;
}

.sponsor-rail-sticky {
    position: sticky;
    top: calc(var(--nav-h) + 1.5rem);
}

.sponsor-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.sponsor-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    align-self: flex-start;
}

@media (max-width: 1024px) {
    .sponsor-rail {
        display: none;
    }
}

/* ── Advertise slot ── */
.ad-advertise-slot {
    width: 300px;
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.25rem;
    background: var(--bg-surface);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-advertise-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
    color: var(--text-dim);
}

.ad-advertise-inner svg {
    color: var(--text-dim);
    flex-shrink: 0;
}

.ad-advertise-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.ad-advertise-desc {
    font-size: 0.775rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.ad-advertise-cta {
    display: inline-flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: transparent;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.ad-advertise-cta:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-dim);
}

@media (max-width: 768px) {
    .tool-sidebar {
        display: none;
    }
}

/* ── Filter Dropdown ── */
.filters-bar {
    position: relative;
}

.filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.875rem;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.filters-btn:hover,
.filters-btn--open {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--bg-surface);
}

.filters-btn--open .filters-chevron {
    transform: rotate(180deg);
}

.filters-chevron {
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.filters-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    z-index: 50;
    box-shadow: var(--shadow);
    min-width: 560px;
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-pill {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
}

.filter-pill--inline {
    min-width: auto;
}

.filter-pill-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.filter-pill-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-pill-inputs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-pill-inputs input[type="number"] {
    width: 72px;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
}

.filter-sep {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .filters-dropdown {
        min-width: 0;
        width: calc(100vw - 3rem);
        left: 0;
    }
    .filters-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-pill {
        width: 100%;
    }
}

/* ── Tool form subtitle (replaces inline style) ── */
.tool-form-subtitle {
    margin: -0.5rem 0 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Form group modifiers ── */
.form-group--wide {
    flex: 2;
    min-width: 220px;
}

.form-group--submit {
    min-width: 0;
    justify-content: flex-end;
    padding-top: 1.6rem;
}

/* ── Popular badge on tool cards ── */
.tag-popular {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent-glow);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Turnstile verification hint ── */
.turnstile-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.turnstile-hint::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

/* ── Nav Tools dropdown ── */
.nav-tools-wrap {
    position: relative;
}

.site-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    background: none;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    transition: color 0.15s ease, background 0.15s ease;
    text-decoration: none;
}

.site-nav-btn:hover {
    background: var(--bg-surface);
}

.site-nav-btn[aria-expanded="true"] {
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-tools-chevron {
    opacity: 0.5;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.site-nav-btn[aria-expanded="true"] .nav-tools-chevron {
    transform: rotate(180deg);
}

.nav-tools-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.625rem;
    min-width: 230px;
    z-index: 200;
    box-shadow: var(--shadow);
}

.nav-tools-all {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    padding: 0.3rem 0.5rem 0.55rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.375rem;
    transition: color 0.15s ease;
}

.nav-tools-all:hover {
    color: var(--accent-hover);
}

.nav-cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0.4rem 0.5rem;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: background 0.15s ease, color 0.15s ease;
    margin-top: 0.2rem;
}

.nav-cat-btn:hover {
    background: var(--bg-surface);
    color: var(--text);
}

.nav-cat-btn[aria-expanded="true"] {
    color: var(--text);
}

.nav-cat-chevron {
    opacity: 0.4;
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.nav-cat-btn[aria-expanded="true"] .nav-cat-chevron {
    transform: rotate(180deg);
    opacity: 0.7;
}

.nav-cat-links {
    padding: 0.15rem 0 0.25rem 0.625rem;
}

.nav-cat-links a {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.28rem 0.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: color 0.12s ease, background 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-cat-links a:hover {
    color: var(--text);
    background: var(--bg-surface);
}
