/*
 * AJ Agent Crawl Optimizer — admin settings page styles.
 *
 * Loaded only on the Settings → AJ Agent Crawl Optimizer screen via admin_enqueue_scripts.
 * Dynamic per-render values (score color + progress offset) are set as inline
 * style attributes on the <circle> element in the markup.
 */

/* Score card */
.ajaco-score-card {
    display: flex;
    align-items: center;
    gap: 25px;
    background: linear-gradient(135deg, #1d2327 0%, #2c3e50 100%);
    padding: 25px 30px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ajaco-score-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.ajaco-score-circle svg {
    transform: rotate(-90deg);
}

.ajaco-score-circle .score-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.ajaco-score-circle .score-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251.2;
    transition: stroke-dashoffset 1s ease-out;
}

.ajaco-score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ajaco-score-value .number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.ajaco-score-value .label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.ajaco-score-info h2 {
    margin: 0 0 5px 0;
    color: #fff;
    font-size: 22px;
}

.ajaco-score-info p {
    margin: 0 0 10px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.ajaco-features-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ajaco-feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 11px;
    color: #fff;
}

.ajaco-feature-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ajaco-feature-badge .dot.enabled {
    background: #00a32a;
}

.ajaco-feature-badge .dot.disabled {
    background: #d63638;
}

/* Read More link next to each feature description */
.ajaco-read-more {
    margin-left: 8px;
    font-size: 12px;
    font-style: italic;
    color: #2271b1;
    text-decoration: none;
}

.ajaco-read-more:hover {
    text-decoration: underline;
}

/* Testing section */
.ajaco-test-block {
    margin: 0 0 18px 0;
    padding: 12px 14px;
    background: #fbfbfc;
    border: 1px solid #f0f0f1;
    border-left: 3px solid #f0f0f1;
    border-radius: 4px;
    transition: border-left-color 0.15s ease, background 0.15s ease;
}

.ajaco-test-block:hover {
    background: #fff;
    border-left-color: #2271b1;
}

.ajaco-test-block h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* .ajaco-test-section styles consolidated with .ajaco-section-heading above. */

.ajaco-test-block p {
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
}

.ajaco-code-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.ajaco-code-wrapper code {
    flex: 1;
    display: block;
    padding: 12px 50px 12px 15px;
    background: #f6f7f7;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #1d2327;
    word-break: break-all;
}

.ajaco-copy-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.ajaco-copy-btn:hover {
    background: #135e96;
}

.ajaco-copy-btn.copied {
    background: #00a32a;
}

.ajaco-note {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Per-test-block "View output" / "Open in [validator]" links. */
.ajaco-validate {
    margin: 6px 0 0 0;
    font-size: 12px;
}

.ajaco-validate a {
    color: #2271b1;
    text-decoration: none;
}

.ajaco-validate a:hover {
    text-decoration: underline;
}

/* Decorative external-link arrow added via pseudo-element so screen readers
 * don't read "north east arrow" — pseudo-element content is generally not
 * announced. */
.ajaco-validate a[target="_blank"]::after {
    content: " \2197";
    speak: never;
}

/* First-activation Quick Setup wizard. Replaces the normal settings UI. */
.ajaco-wizard-wrap h1 {
    margin-bottom: 8px;
    font-size: 24px;
}

.ajaco-wizard {
    max-width: 760px;
    margin-top: 12px;
    padding: 24px 28px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ajaco-wizard-intro {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #50575e;
}

.ajaco-wizard-section {
    margin: 24px 0 8px;
    padding: 4px 0 4px 12px;
    border-left: 4px solid #2271b1;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.ajaco-wizard-section:first-of-type {
    margin-top: 12px;
}

.ajaco-wizard-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ajaco-wizard-row:hover {
    background: #f6f7f7;
    border-color: #e5e5e5;
}

.ajaco-wizard-row input[type="checkbox"] {
    margin: 4px 0 0 0;
    flex-shrink: 0;
}

.ajaco-wizard-label {
    display: block;
}

.ajaco-wizard-label strong {
    display: block;
    color: #1d2327;
}

.ajaco-wizard-description {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: #50575e;
    font-weight: 400;
}

.ajaco-wizard-actions {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f0f0f1;
    display: flex;
    gap: 10px;
}

/* Screen-reader-only utility — used to give the settings page an accessible
 * heading even though WP doesn't render an h1 for add_options_page() screens. */
.ajaco-screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.ajaco-validate-sep {
    margin: 0 6px;
    color: #8c8f94;
}

/* Details section */
.ajaco-details h4 {
    margin: 18px 0 6px 0;
    padding-left: 10px;
    border-left: 2px solid #c3c4c7;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1d2327;
    /* Offset for the WP admin bar so Read More anchor jumps don't hide the heading. */
    scroll-margin-top: 50px;
}

/* .ajaco-details-section styles consolidated with .ajaco-section-heading above. */

.ajaco-details ul {
    margin: 0 0 5px 22px;
    list-style: disc;
}

.ajaco-details ul li {
    margin-bottom: 4px;
    font-size: 13px;
    color: #3c434a;
}

.ajaco-details code {
    background: #f0f0f1;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

/* Section headings shared across Form (h2), Testing (h3), and Details (h3).
 * Blue left accent bar so they read clearly as group dividers without being
 * heavy. Same treatment everywhere keeps the page visually coherent. */
.ajaco-section-heading,
.ajaco-test-section,
.ajaco-details-section {
    margin: 32px 0 6px;
    padding: 6px 0 6px 14px;
    border: 0;
    border-left: 4px solid #2271b1;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: #1d2327;
    /* Anchor offset for the WP admin bar so fragment jumps land below it. */
    scroll-margin-top: 50px;
}

/* First section in each group shouldn't have huge top margin. */
.ajaco-section-heading:first-of-type,
.ajaco-details > .ajaco-details-section:first-of-type {
    margin-top: 18px;
}

/* Section description text: indented to align with the heading text, smaller
 * and softer than the heading so the eye reads them as a unit. */
.ajaco-section-heading + .description,
.ajaco-test-section + .description,
.ajaco-details-section + .description {
    margin: 0 0 14px 18px;
    font-size: 13px;
    color: #50575e;
}

/* Reset-to-Defaults form. Sits below the main Save button, visually separated. */
.ajaco-reset-form {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.ajaco-reset-form .description {
    margin: 0 0 8px 0;
}

/* Tone the destructive button down — secondary look, but with the WP "delete" red text. */
.ajaco-reset-form .button.delete {
    color: #b32d2e;
    border-color: #b32d2e;
}

.ajaco-reset-form .button.delete:hover {
    color: #fff;
    background: #b32d2e;
    border-color: #b32d2e;
}

/* ---------- v2: level banner (replaces the toggle-count score card) ------- */

.ajaco-level-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #dcdcde;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 16px 0 12px;
}

.ajaco-level-pill {
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    border-radius: 999px;
    padding: 3px 12px;
    white-space: nowrap;
}

.ajaco-level-name {
    font-weight: 600;
}

.ajaco-level-meta {
    color: #8c8f94;
    font-size: 12px;
}

/* ---------- v2: inline dependency hints ---------- */

.ajaco-hint {
    color: #996800;
    margin-top: 5px;
}

.ajaco-warn {
    color: #d63638;
    margin-top: 5px;
}

/* ---------- v2: AI bot policy table ---------- */

.ajaco-bot-policy {
    margin-top: 10px;
}

.ajaco-bot-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.ajaco-bot-table {
    border-collapse: collapse;
    margin-top: 4px;
}

.ajaco-bot-table th,
.ajaco-bot-table td {
    text-align: left;
    padding: 4px 16px 4px 0;
    font-size: 13px;
}

.ajaco-bot-table th {
    color: #8c8f94;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------- v2: content-signal selects ---------- */

.ajaco-signal-fields {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-top: 10px;
}

.ajaco-signal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    color: #50575e;
}

.ajaco-signal-fields .description {
    flex-basis: 100%;
    margin: 4px 0 0;
}

/* ---------- v2: feature guide links (open the contextual Help panel) ------ */

.ajaco-read-more {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    text-decoration: none;
}

.ajaco-read-more::after {
    content: " ›";
}

.ajaco-help-flash {
    background: #fcf9e8;
    box-shadow: 0 0 0 6px #fcf9e8;
    border-radius: 2px;
    transition: background 0.4s ease-out, box-shadow 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .ajaco-help-flash {
        transition: none;
    }
}

/* ---------- v2: live endpoint "View" links ---------- */

.ajaco-view-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px !important;
}

.ajaco-view-label {
    color: #8c8f94;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.ajaco-view-off {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 12px;
}

.ajaco-view-links a {
    text-decoration: none;
}

.ajaco-view-links code {
    font-size: 11.5px;
}

.ajaco-view-sep {
    color: #c3c4c7;
}

.ajaco-ext {
    font-size: 11px;
    opacity: 0.7;
}

.ajaco-view-note {
    color: #8c8f94;
    font-size: 12px;
}

/* ---------- v2: llms.txt curation ---------- */

.ajaco-llms-lede {
    max-width: 820px;
    font-size: 13px;
}

.ajaco-llms-off-notice {
    margin: 15px 0;
}

.ajaco-llms-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.ajaco-llms-col-form {
    flex: 1 1 640px;
    min-width: 0;
}

.ajaco-llms-col-preview {
    flex: 1 1 380px;
    min-width: 0;
}

/* Section rows: a native widefat table, tightened so seven columns fit. */
.ajaco-llms-sections {
    margin-top: 10px;
}

.ajaco-llms-sections td,
.ajaco-llms-sections th {
    vertical-align: middle;
}

.ajaco-llms-sections .ajaco-llms-col-enabled {
    width: 60px;
    text-align: center;
}

.ajaco-llms-heading {
    width: 100%;
    max-width: 220px;
}

.ajaco-llms-slug {
    font-size: 11px;
    color: #646970;
    background: transparent;
    padding: 0;
}

.ajaco-llms-na {
    color: #a7aaad;
}

/* Preview pane — sticks alongside the form while you scroll the sections. */
.ajaco-llms-preview-pane {
    position: sticky;
    top: 46px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 12px 16px 16px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.ajaco-llms-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ajaco-llms-preview-head h2 {
    margin: 0;
    font-size: 14px;
}

.ajaco-llms-counters {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin: 12px 0;
    padding: 8px 12px;
    background: #f6f7f7;
    border-radius: 3px;
}

.ajaco-llms-counters li {
    margin: 0;
    font-size: 12px;
    color: #646970;
}

.ajaco-llms-counters strong {
    display: block;
    font-size: 16px;
    line-height: 1.3;
    color: #1d2327;
    font-variant-numeric: tabular-nums;
}

.ajaco-llms-status {
    min-height: 18px;
    margin: 0 0 8px;
    font-size: 12px;
    color: #646970;
}

.ajaco-llms-status.is-error {
    color: #d63638;
    font-weight: 600;
}

.ajaco-llms-preview {
    margin: 0;
    padding: 12px;
    max-height: 60vh;
    overflow: auto;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #1d2327;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    tab-size: 4;
}

.ajaco-llms-preview.is-loading {
    opacity: 0.55;
}

@media screen and (max-width: 1100px) {
    .ajaco-llms-preview-pane {
        position: static;
    }

    .ajaco-llms-preview {
        max-height: 420px;
    }
}
