/*
 * GPL Anchor Text Ratio Calculator — tool-only UI.
 * Shared chrome (.gpl-tool shell, fields, cards, .mt-stat-card, .mt-results-card, .mt-dt-top,
 * .mt-result-table, .gpl-tag, buttons) comes from the GPL theme and is not duplicated here.
 * The result tabs, toolbar and sort headers match the GPL Keyword Density Checker.
 */

.gplatr-tool .hide {
    display: none !important;
}

/* Right-to-left: the shared shell aligns these left; follow the writing direction instead. */
.gplatr-tool .gpl-tool__notice,
.gplatr-tool .gpl-tool__collapse-text {
    text-align: start;
}

/* Settings could not be read (script.js): only the message is shown. */
.gplatr-tool.is-broken > :not(.gplatr-config-error) {
    display: none !important;
}

/* --- Form --- */

.gplatr-privacy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gplatr-privacy i {
    color: var(--gpl-tool-green, #0f9a7b);
}

.gplatr-tool .gpl-tool__hint {
    margin: 6px 0 0;
    color: var(--gpl-tool-text-soft, #666);
    font-size: 13px;
    line-height: 1.45;
}

.gplatr-tool .gplatr-field textarea {
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    line-height: 1.6;
    resize: vertical;
}

.gplatr-tool #gplatr-anchors {
    min-height: 240px;
}

.gplatr-tool #gplatr-generic {
    min-height: 140px;
    font-family: var(--gpl-tool-mono, monospace);
    font-size: 13px;
}

#gplatr-count.is-over {
    color: var(--gpl-tool-red, #dc2626);
    font-weight: 600;
}

.gplatr-input-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1em;
    margin-top: 0.6em;
    color: var(--gpl-tool-text-soft, #6b7280);
    font-size: 0.875rem;
    line-height: 1.45;
}

.gplatr-input-actions {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 1em;
}

.gplatr-tool .gplatr-text-button {
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--gpl-tool-blue, #3e63dd) !important;
    font: inherit;
    font-weight: 600;
    line-height: inherit;
    text-decoration: underline;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
}

.gplatr-tool .gplatr-text-button:hover {
    text-decoration: none;
}

.gplatr-tool .gplatr-text-button:focus-visible {
    outline: 3px solid var(--gpl-tool-focus-ring, rgba(65, 102, 225, .28));
    outline-offset: 2px;
}

.gplatr-advanced {
    margin: 0;
}

.gplatr-table-card .gplatr-copy-error {
    margin: 12px 16px 0;
}

.gplatr-tool .motta-alert {
    margin-bottom: 10px;
    text-align: start;
}

/* --- Results --- */

.gplatr-results {
    padding: 10px 0;
    color: var(--gpl-tool-ink, #1f2937);
    font-size: 14px;
    scroll-margin-top: 20px;
}

.gplatr-results:focus {
    outline: none;
}

.gplatr-results-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 0 16px;
}

.gplatr-source {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.gplatr-source .gpl-tag {
    gap: 6px;
}

.gplatr-results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gplatr-inline-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--gpl-tool-label, #374151);
    font-size: 13px;
    font-weight: 600;
}

.gplatr-tool .gplatr-inline-field select {
    width: auto;
    max-width: 100%;
    min-height: 34px;
    height: 34px;
    margin: 0;
    padding-block: 0;
    padding-inline: 10px 30px;
    font-size: 13px;
    font-weight: 400;
    box-shadow: none;
}

.gplatr-note {
    margin: 0 0 12px;
    padding: 10px 16px;
    border: 1px solid #f5c78a;
    border-radius: 8px;
    background: #fff4e5;
    color: var(--gpl-tool-amber-text, #92400e);
    font-size: 13px;
    line-height: 1.45;
}

.gplatr-muted {
    color: var(--gpl-tool-muted, #6b7280);
    font-size: 13px;
}

.gplatr-small {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
}

.gplatr-card {
    margin: 0 0 18px;
    padding: 16px;
}

.gplatr-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.gplatr-tool .gplatr-card-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--gpl-tool-ink, #1f2937);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.gplatr-card-title i {
    color: var(--gpl-tool-blue, #4166e1);
}

.gplatr-card-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.gplatr-tool .gplatr-card-tools .dt-button,
.gplatr-tool .mt-dt-top .dt-button {
    white-space: nowrap;
}

.gplatr-tool .dt-button.is-success i {
    color: var(--gpl-tool-green, #0f9a7b);
}

/* --- Distribution bar + summary table --- */

.gplatr-bar {
    display: flex;
    width: 100%;
    height: 18px;
    margin: 0 0 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f6;
}

.gplatr-bar__seg {
    display: block;
    height: 100%;
    min-width: 3px;
    border-inline-end: 2px solid var(--gpl-tool-surface, #fff);
}

.gplatr-bar__seg:last-child {
    border-inline-end: 0;
}

.gplatr-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.gplatr-tool .gplatr-summary-wrap .gplatr-summary,
.gplatr-tool .mt-table-scroll .gplatr-kw-table {
    min-width: 0;
}

.gplatr-summary td,
.gplatr-summary th,
.gplatr-kw-table td,
.gplatr-kw-table th,
.gplatr-table td,
.gplatr-table th {
    vertical-align: middle;
}

.gplatr-cat-cell {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 220px;
}

.gplatr-cat-cell .gplatr-dot {
    margin-top: 5px;
}

.gplatr-cat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: start;
}

.gplatr-cat-text strong {
    font-weight: 600;
}

.gplatr-cat-text small {
    color: var(--gpl-tool-muted, #6b7280);
    font-size: 12px;
    line-height: 1.4;
}

.gplatr-summary tr.is-off .gplatr-cat-text strong,
.gplatr-summary tr.is-off .gplatr-num {
    color: var(--gpl-tool-muted, #6b7280);
}

.gplatr-summary tfoot th,
.gplatr-summary tfoot td {
    font-weight: 600;
}

.gplatr-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gplatr-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gplatr-minibar {
    position: relative;
    flex: 0 1 110px;
    min-width: 40px;
    height: 6px;
    overflow: hidden;
    border-radius: 4px;
    background: #e6e9f1;
}

.gplatr-minibar span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--gpl-tool-blue, #4166e1);
}

/* --- Insights --- */

.gplatr-insights {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin: 0 0 18px;
}

.gplatr-insights .gplatr-card {
    margin: 0;
}

.gplatr-tool .gplatr-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gplatr-tool .gplatr-list li {
    position: relative;
    margin: 0;
    padding-inline-start: 18px;
    line-height: 1.5;
}

.gplatr-tool .gplatr-list li::before {
    content: "";
    position: absolute;
    top: 0.6em;
    inset-inline-start: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gpl-tool-blue, #4166e1);
}

.gplatr-tool .gplatr-list li.is-warn::before {
    background: #edb200;
}

.gplatr-tool .gplatr-list li.is-ok::before {
    background: var(--gpl-tool-green, #0f9a7b);
}

/* --- Result tabs: same design as the Keyword Density / Broken Link checkers --- */

.gplatr-views {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 28px 36px;
    padding: 16px 16px 0;
    border-bottom: 1px solid #ecf0f4;
    background: #fff;
}

.gplatr-tool .gplatr-view {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #7c818b;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.gplatr-view-label {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.gplatr-view-count {
    color: inherit;
    font-size: 12.8px;
    font-weight: 400;
    line-height: 1;
}

.gplatr-tool .gplatr-view::after {
    content: "";
    position: absolute;
    z-index: 1;
    bottom: -1px;
    inset-inline-start: 0;
    width: 0;
    height: 2px;
    background: #1d2128;
    transition: width .3s;
}

.gplatr-tool .gplatr-view:hover,
.gplatr-tool .gplatr-view:focus,
.gplatr-tool .gplatr-view:active,
.gplatr-tool .gplatr-view.is-active {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #f97248 !important;
}

.gplatr-tool .gplatr-view:hover::after,
.gplatr-tool .gplatr-view:focus-visible::after,
.gplatr-tool .gplatr-view.is-active::after {
    width: 100%;
    background: #f97248;
}

.gplatr-tool .gplatr-view:focus-visible {
    outline: 2px solid #f97248;
    outline-offset: 2px;
}

/* --- Toolbar --- */

.gplatr-tool .mt-dt-top input,
.gplatr-tool .mt-dt-top select {
    min-height: 0;
    box-shadow: none;
}

.gplatr-tool .mt-dt-top .gplatr-dt-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    order: 0;
    margin-inline-end: auto;
}

.gplatr-tool .mt-dt-top .dt-buttons {
    order: 1;
}

.gplatr-tool .mt-dt-top .mt-dt-top-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    order: 2;
}

/* --- Anchor / phrase table --- */

/* The theme left-aligns .col-text with !important; text columns follow the writing direction. */
.gplatr-tool .mt-result-table th.col-text,
.gplatr-tool .mt-result-table td.col-text {
    text-align: start !important;
}

.gplatr-table .gplatr-col-index {
    width: 56px;
    color: var(--gpl-tool-muted, #6b7280);
}

.gplatr-tool .gplatr-table td.gplatr-anchor,
.gplatr-tool .gplatr-kw-table td.gplatr-anchor {
    font-weight: 500;
    text-align: start;
    word-break: break-word;
}

.gplatr-table td.gplatr-anchor .gplatr-dot {
    margin-inline-end: 8px;
    vertical-align: 1px;
}

.gplatr-flags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-inline-start: 8px;
    vertical-align: middle;
}

.gplatr-table .gplatr-col-share {
    min-width: 170px;
}

.gplatr-table .gplatr-col-cat {
    width: 230px;
}

.gplatr-tool .gplatr-cat-select {
    width: 100%;
    min-width: 200px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding-block: 0;
    padding-inline: 10px 28px;
    font-size: 13px;
    box-shadow: none;
}

.gplatr-tool .gplatr-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.gplatr-tool .gplatr-sort:hover,
.gplatr-tool .gplatr-sort:focus {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--gpl-tool-blue, #4166e1) !important;
}

.gplatr-tool .gplatr-sort:focus-visible {
    outline: 2px solid var(--gpl-tool-blue, #4166e1);
    outline-offset: 2px;
}

.gplatr-sort i {
    color: #b0b6c0;
    font-size: 11px;
}

.gplatr-sort.is-active i {
    color: inherit;
}

.gplatr-no-row td {
    padding: 24px;
    color: var(--gpl-tool-muted, #6b7280);
    text-align: center !important;
}

/* --- Responsive --- */

/* The theme gives every results table min-width: 960px below 1060px (DAPA has many columns).
   These tables have 4–7 columns, so they only need room for those. */
@media (max-width: 1060px) {
    .gplatr-tool .mt-table-scroll .gplatr-table {
        min-width: 0;
    }

    .gplatr-tool .mt-table-scroll .gplatr-table.is-anchors {
        min-width: 640px;
    }

    .gplatr-tool .mt-table-scroll .gplatr-kw-table {
        min-width: 560px;
    }
}

@media (max-width: 820px) {
    .gplatr-insights {
        grid-template-columns: minmax(0, 1fr);
    }

    .gplatr-views {
        gap: 14px 22px;
        padding: 12px 12px 0;
    }

    .gplatr-tool .gplatr-view {
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    .gplatr-input-meta {
        flex-direction: column;
        gap: 0.5em;
    }

    .gplatr-results-bar,
    .gplatr-card-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .gplatr-cat-cell {
        min-width: 150px;
    }

    .gplatr-table .gplatr-col-cat {
        width: auto;
    }

    .gplatr-tool .gplatr-cat-select {
        min-width: 175px;
    }

    .gplatr-cat-text small {
        display: none;
    }

    .gplatr-tool .gplatr-table thead th,
    .gplatr-tool .gplatr-table tbody td,
    .gplatr-tool .gplatr-summary th,
    .gplatr-tool .gplatr-summary td {
        padding-right: 8px;
        padding-left: 8px;
    }

    .gplatr-table .gplatr-col-index {
        width: 36px;
    }

    .gplatr-table .gplatr-col-share {
        min-width: 0;
    }

    .gplatr-minibar {
        display: none;
    }

    .gplatr-tool .mt-table-scroll .gplatr-table.is-anchors {
        min-width: 560px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gplatr-tool .gplatr-view::after {
        transition: none;
    }
}
