/*
 * Shared CSS for the "Keyword Tools" family.
 *
 * Per-tool branding (logo colours, header band, intro paragraph) lives
 * in code/<slug>-keyword-tool/assets/css/tool.css and overrides these
 * shared defaults.
 *
 * Composes shared primitives from code/assets/css/tools.css:
 *   .tool-form-card, .mode-toggle, .input-form, .text-input,
 *   .primary-btn, .ghost-btn, .results-region, .results-table,
 *   .quota-chip, .history-item, .toast.
 */

/* ----- mode-toggle: equal-width buttons so the sliding pill matches --
   The shared `.mode-toggle::before` pill is hardcoded at `calc(50% -
   pad)`, which only works when both buttons have equal natural widths.
   Asymmetric labels (e.g. "Single seed" vs "Bulk") make the active
   pill narrower than the active button's text. Forcing a min-width
   on both buttons makes them equal and the pill snaps to size. */
.kt-mode-toggle .mode-btn {
    min-width: 135px;
    text-align: center;
}

/* ----- input sizing on the form card -------------------------------- */

/* Single-seed and bulk inputs are the focal point of the form, so they
   need real presence. Default `.text-input` is ~38px tall; we bump that
   to ~52px for the seed input, and let the bulk textarea grow taller. */
.kt-text-input {
    box-sizing: border-box;
    width: 100%;
    font-size: 1.05em;
    padding: 14px 16px;
    flex: 0 0 auto;
}
textarea.kt-text-input {
    min-height: 130px;
    line-height: 1.55;
    resize: vertical;
}
.kt-input-panel {
    margin-top: 4px;
}
.kt-input-panel .input-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92em;
    color: var(--ink-700, #334155);
    font-weight: 500;
}

/* ----- country dropdown on the form card ---------------------------- */

.kt-country-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: var(--ink-700, #334155);
}
.kt-country-label {
    font-weight: 500;
    color: var(--ink-700, #334155);
}
.kt-country-select {
    appearance: auto;
    background: #fff;
    border: 1px solid var(--ink-200, #e2e8f0);
    color: var(--ink-700, #334155);
    padding: 8px 12px;
    font: inherit;
    font-size: 0.94em;
    border-radius: 8px;
    cursor: pointer;
    min-width: 200px;
}
.kt-country-select:hover {
    border-color: var(--ink-300, #cbd5e1);
}
.kt-country-select:focus {
    outline: 2px solid var(--kt-brand, #4285f4);
    outline-offset: 1px;
    border-color: var(--kt-brand, #4285f4);
}
.kt-country-hint {
    color: var(--ink-500, #64748b);
    font-size: 0.85em;
}

/* Country code suffix in the column headers ("Volume (US)" etc.). */
.kt-th-country {
    color: var(--ink-500, #64748b);
    font-weight: 500;
    margin-left: 3px;
}

/* ----- example seed chips on the form card -------------------------- */

.kt-example-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 0.84em;
    color: var(--ink-600, #475569);
}
.kt-example-row .kt-example-label {
    color: var(--ink-500, #64748b);
}
/* The chips are programmatically appended into #kt-example-seeds without
   text nodes between them, so they'd render flush by default. Make the
   container a flex with gap so each pill gets breathing room. */
.kt-example-row > #kt-example-seeds {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.kt-example-chip {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--ink-200, #e2e8f0);
    background: #fff;
    color: var(--ink-700, #334155);
    padding: 4px 10px;
    font: inherit;
    font-size: 0.84em;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.kt-example-chip:hover {
    background: var(--ink-50, #f8fafc);
    border-color: var(--ink-300, #cbd5e1);
}

/* ----- progress region ---------------------------------------------- */

.kt-progress {
    margin-top: 18px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--ink-200, #e2e8f0);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kt-progress[hidden] {
    display: none;
}
.kt-progress-bar {
    height: 6px;
    background: var(--ink-100, #f1f5f9);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.kt-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 10%;
    background: linear-gradient(90deg, #4285f4 0%, #34a853 100%);
    border-radius: 999px;
    transition: width 0.5s ease-out;
}
.kt-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.kt-progress-msg {
    font-size: 0.94em;
    color: var(--ink-700, #334155);
}
.kt-progress-meta {
    font-size: 0.84em;
    color: var(--ink-500, #64748b);
    white-space: nowrap;
}

/* ----- results region overrides ------------------------------------- */

.results-region[hidden] {
    display: none;
}
/* Results-header strip layout: ensure pagination, page-size selector,
   and Export button line up horizontally with breathing room. */
.results-region .results-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.kt-results-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}
.kt-results-table th[data-sort]:hover {
    background: var(--ink-50, #f8fafc);
}
.kt-results-table th[data-sort].is-sorted-asc::after,
.kt-results-table th[data-sort].is-sorted-desc::after {
    margin-left: 4px;
    font-size: 0.7em;
    opacity: 0.55;
}
.kt-results-table th[data-sort].is-sorted-asc::after { content: '▲'; }
.kt-results-table th[data-sort].is-sorted-desc::after { content: '▼'; }

/* Column alignment: keyword left, everything else centered. */
.kt-results-table th.kt-th-keyword,
.kt-results-table td.kt-cell-keyword {
    text-align: left;
}
.kt-results-table th.kt-th-center,
.kt-results-table td.kt-cell-num,
.kt-results-table td.kt-cell-trend {
    text-align: center;
}

/* Row striping + hover state. Adds visual density when each cell only
   carries one value, and gives the eye a horizontal "rail" to follow. */
.kt-results-table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.kt-results-table tbody tr:hover {
    background: var(--kt-brand-tint, #e8f0fe);
}

/* Cell padding: more vertical, comfortable rhythm. */
.kt-results-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ink-100, #f1f5f9);
}
.kt-results-table thead th {
    padding: 14px 14px;
}

/* Keyword column: primary text, slight emphasis. */
.kt-results-table td.kt-cell-keyword {
    font-weight: 500;
    color: var(--ink-900, #0f172a);
    font-size: 0.96em;
}

/* Volume is the hero metric: biggest, boldest. */
.kt-results-table td.kt-cell-volume {
    font-size: 1.12em;
    font-weight: 600;
    color: var(--ink-900, #0f172a);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* CPC: tabular numbers, mid-weight. */
.kt-results-table td.kt-cell-cpc {
    font-variant-numeric: tabular-nums;
    color: var(--ink-700, #334155);
    font-weight: 500;
}

/* Competition: rendered as a pill badge via the JS, so the td itself is
   centered but doesn't carry the color. The badge does that. */
.kt-results-table td.kt-cell-competition {
    font-variant-numeric: tabular-nums;
}

.kt-comp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    min-width: 56px;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.84em;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}
.kt-comp-badge.is-comp-low {
    background: #d1fae5;
    color: #047857;
}
.kt-comp-badge.is-comp-med {
    background: #fef3c7;
    color: #b45309;
}
.kt-comp-badge.is-comp-high {
    background: #fee2e2;
    color: #b91c1c;
}

/* Trend column: bigger sparkline + breathing room. */
.kt-results-table td.kt-cell-trend {
    width: 150px;
}
.kt-results-table td.kt-cell-trend .kt-trend {
    margin: 0 auto;
    display: block;
}
.kt-results-table td.is-muted {
    color: var(--ink-400, #94a3b8);
}
.kt-results-table tr.is-no-data {
    opacity: 0.65;
}

/* Mobile column hiding. Every keyword-tool family member ships the same
   5-column thead (Keyword | Volume | CPC | Competition | Trend). On a
   narrow viewport the Competition + Trend columns drop out at <=640px,
   then CPC also drops at <=420px, leaving Keyword + Volume as the two
   columns that matter most. The nth-child approach lets us cover all
   9 tools with one CSS block (no per-tool tagging needed) because they
   share the .kt-results-table class. */
@media (max-width: 640px) {
    .kt-results-table thead th:nth-child(4),
    .kt-results-table tbody td:nth-child(4),
    .kt-results-table thead th:nth-child(5),
    .kt-results-table tbody td:nth-child(5) {
        display: none;
    }
}
@media (max-width: 420px) {
    .kt-results-table thead th:nth-child(3),
    .kt-results-table tbody td:nth-child(3) {
        display: none;
    }
}

.kt-trend {
    display: block;
}

/* results-filter input + count strip */
.kt-results-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.kt-results-filter {
    flex: 0 0 auto;
    min-width: 200px;
}
.kt-results-filter .text-input {
    width: 220px;
    box-sizing: border-box;
    flex: 0 0 auto;
}
.kt-results-count-badge {
    padding: 2px 10px;
    background: var(--ink-50, #f8fafc);
    border: 1px solid var(--ink-200, #e2e8f0);
    border-radius: 999px;
    font-size: 0.86em;
    color: var(--ink-700, #334155);
    font-variant-numeric: tabular-nums;
}

/* volume disclosure footer below the table */
.kt-volume-footer {
    padding: 12px 18px;
    background: #fafbfc;
    border-top: 1px solid var(--ink-100, #f1f5f9);
    font-size: 0.82em;
    color: var(--ink-500, #64748b);
}

/* ----- pagination strip ---------------------------------------------- */

.kt-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kt-pagination[hidden] {
    display: none;
}

/* Bottom pagination is its own block at the foot of the table. */
.kt-pagination-bottom {
    justify-content: center;
    gap: 16px;
    padding: 14px 18px;
    background: #fafbfc;
    border-top: 1px solid var(--ink-100, #f1f5f9);
}

/* Top pagination lives inside the results-header alongside Filter
   and Export. Compact icon buttons, info shown between them. */
.kt-pagination-top {
    gap: 4px;
}
.kt-pagination-top .kt-page-btn {
    padding: 6px 8px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kt-pagination-top .kt-page-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}
.kt-pagination-top .kt-page-info {
    min-width: 90px;
    text-align: center;
}

.kt-page-btn {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid var(--ink-200, #e2e8f0);
    color: var(--ink-700, #334155);
    padding: 6px 14px;
    font: inherit;
    font-size: 0.88em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.kt-page-btn:hover:not(:disabled) {
    background: var(--ink-50, #f8fafc);
    border-color: var(--ink-300, #cbd5e1);
}
.kt-page-btn:disabled {
    color: var(--ink-400, #94a3b8);
    background: #fff;
    cursor: not-allowed;
    opacity: 0.5;
}
.kt-page-info {
    font-size: 0.88em;
    color: var(--ink-700, #334155);
    font-variant-numeric: tabular-nums;
}

/* Page-size selector in the results-header. */
.kt-page-size {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86em;
    color: var(--ink-600, #475569);
}
.kt-page-size-label {
    white-space: nowrap;
}
.kt-page-size-select {
    appearance: auto;
    background: #fff;
    border: 1px solid var(--ink-200, #e2e8f0);
    color: var(--ink-700, #334155);
    padding: 5px 8px 5px 10px;
    font: inherit;
    font-size: 0.92em;
    border-radius: 6px;
    cursor: pointer;
}
.kt-page-size-select:hover {
    border-color: var(--ink-300, #cbd5e1);
}

/* errors region */
.kt-errors {
    margin-top: 14px;
    padding: 12px 18px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 10px;
    color: #9a3412;
    font-size: 0.88em;
}
.kt-errors[hidden] {
    display: none;
}
.kt-errors ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

/* form card extras */
.kt-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}
.kt-cancel-btn[hidden] {
    display: none;
}

/* Stop button: prominent red so it reads as an active "interrupt the
   running harvest" affordance, not a passive secondary button. */
.kt-stop-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.kt-stop-btn:hover {
    background: #dc2626;
}
.kt-stop-btn:active {
    transform: translateY(1px);
}
.kt-stop-btn .kt-stop-icon {
    width: 12px;
    height: 12px;
    display: block;
    flex: 0 0 12px;
}

/* per-tool brand band on the page header. Each tool overrides
   --kt-brand and --kt-brand-fade. */
:root {
    --kt-brand: #4285f4;
    --kt-brand-fade: #e8f0fe;
}
.kt-brand-band {
    background: linear-gradient(135deg, var(--kt-brand) 0%, var(--kt-brand-fade) 130%);
    color: #fff;
    padding: 22px 0;
    margin-bottom: 22px;
}
.kt-brand-band .container {
    display: flex;
    align-items: center;
    gap: 18px;
}
.kt-brand-band .kt-brand-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.kt-brand-band .kt-brand-title {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}
.kt-brand-band .kt-brand-tagline {
    margin: 4px 0 0;
    font-size: 0.94em;
    opacity: 0.92;
}
