/* -------------------------------------------------------
   Cu29 Site Analyzer – Styles
   Fungerar i både WP-admin och frontend
------------------------------------------------------- */

.cu29sa-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 960px;
}

.cu29sa-wrap h1 {
    font-size: 1.6em;
    margin-bottom: 1em;
}

/* Search box */
.cu29sa-search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1.5em;
    background: #fff;
    padding: 16px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cu29sa-search-box input[type="url"] {
    flex: 1;
    height: 42px;
    font-size: 15px;
    padding: 0 14px;
    border: 1px solid #c5c5c5;
    border-radius: 6px;
    outline: none;
    transition: border-color .15s;
}

.cu29sa-search-box input[type="url"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}

.cu29sa-btn {
    height: 42px;
    padding: 0 22px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}

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

/* Loader */
.cu29sa-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
    padding: 12px 0;
}

.cu29sa-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: cu29sa-spin .7s linear infinite;
    flex-shrink: 0;
}

.cu29sa-spinner.small {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

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

/* Error */
.cu29sa-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 12px 16px;
    color: #c0392b;
    font-size: 14px;
    margin-bottom: 16px;
}

/* Summary */
.cu29sa-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cu29sa-total-grade {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    color: #fff;
    font-size: 2.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cu29sa-summary-info h2 {
    margin: 0 0 4px;
    font-size: 1.2em;
    font-weight: 600;
}

.cu29sa-url-label {
    color: #777;
    font-size: 13px;
    margin: 0;
    word-break: break-all;
}

/* AI section */
.cu29sa-ai-section {
    background: #f0f6ff;
    border: 1px solid #bdd4f0;
    border-left: 4px solid #2271b1;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.cu29sa-ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.cu29sa-ai-icon { font-size: 16px; color: #2271b1; }

.cu29sa-ai-header strong {
    font-size: 14px;
    color: #1d2327;
}

.cu29sa-ai-text {
    font-size: 14px;
    line-height: 1.75;
    color: #2c3338;
    margin: 0;
}

.cu29sa-ai-error {
    font-size: 13px;
    color: #c0392b;
    margin: 0;
}

.cu29sa-ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

/* AI-undersektioner */
.cu29sa-ai-subsection {
    padding: 14px 0;
    border-bottom: 1px solid #d0e2f5;
}

.cu29sa-ai-subsection:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cu29sa-ai-subsection:first-child {
    padding-top: 0;
}

.cu29sa-ai-sub-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.cu29sa-ai-sub-header strong {
    font-size: 13px;
    color: #1d4f8a;
    white-space: nowrap;
}

.cu29sa-ai-subtitle {
    font-size: 12px;
    color: #7a9cc0;
    flex: 1;
}

.cu29sa-ai-model {
    font-size: 11px;
    font-weight: 400;
    color: #7a9cc0;
    letter-spacing: 0.01em;
}

/* Categories grid */
.cu29sa-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 14px;
}

.cu29sa-category {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cu29sa-cat-header {
    display: grid;
    grid-template-columns: 36px 1fr 52px;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.cu29sa-cat-grade {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: .95em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cu29sa-cat-label {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
}

.cu29sa-cat-score {
    font-size: 12px;
    color: #777;
    text-align: right;
    white-space: nowrap;
}

.cu29sa-bar-wrap {
    grid-column: 1 / -1;
    background: #f0f0f0;
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
    margin-top: -6px;
}

.cu29sa-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
}

/* Rows */
.cu29sa-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 13px;
    padding: 5px 0;
    border-bottom: 1px solid #f5f5f5;
    line-height: 1.5;
    color: #333;
}

.cu29sa-row:last-child { border-bottom: none; }

.cu29sa-icon { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.cu29sa-icon.issue { color: #c0392b; }
.cu29sa-icon.good  { color: #1a7f37; }

.cu29sa-no-data { font-size: 13px; color: #999; margin: 0; }

.cu29sa-fetch-status {
    font-size: 12px;
    margin: 4px 0 0;
}
.cu29sa-fetch-status.ok    { color: #1a7f37; }
.cu29sa-fetch-status.error { color: #c0392b; }
.cu29sa-fetch-status.plain { color: #999; }
.cu29sa-heading-tree {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e8eef5;
}

.cu29sa-heading-item {
    font-size: 12px;
    color: #444;
    padding: 2px 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    line-height: 1.5;
}

.cu29sa-h-label {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #6b7280;
    border-radius: 3px;
    padding: 1px 4px;
    flex-shrink: 0;
}

.cu29sa-heading-item.h1 .cu29sa-h-label { background: #2271b1; }
.cu29sa-heading-item.h2 .cu29sa-h-label { background: #3b82f6; }
.cu29sa-heading-item.h3 .cu29sa-h-label { background: #93c5fd; color: #1e3a5f; }
.cu29sa-heading-item.h4 .cu29sa-h-label { background: #dbeafe; color: #1e3a5f; }

@media (max-width: 640px) {
    .cu29sa-categories { grid-template-columns: 1fr; }
    .cu29sa-summary { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* After results */
.cu29sa-after {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.cu29sa-after-heading {
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 10px;
    color: #1d2327;
}

.cu29sa-after-text {
    font-size: 14px;
    line-height: 1.7;
    color: #4a5568;
    margin: 0 0 16px;
}

.cu29sa-after-shortcode {
    margin-top: 4px;
}

/* -------------------------------------------------------
   Radar chart
------------------------------------------------------- */
.cu29sa-radar-wrap {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    max-width: 480px;
}

/* -------------------------------------------------------
   Åtgärdslista
------------------------------------------------------- */
.cu29sa-actions {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #d0e2f5;
}

.cu29sa-actions-header {
    margin-bottom: 12px;
}

.cu29sa-action-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f4f8;
    align-items: flex-start;
}

.cu29sa-action-item:last-child { border-bottom: none; }

.cu29sa-action-num {
    width: 26px;
    height: 26px;
    background: #2271b1;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.cu29sa-action-body { flex: 1; }

.cu29sa-action-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.cu29sa-action-desc {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 6px;
}

.cu29sa-action-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cu29sa-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
}

/* PDF-knapp */
.cu29sa-summary-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.cu29sa-btn-secondary {
    height: 36px;
    padding: 0 16px;
    background: #fff;
    color: #2271b1;
    border: 1px solid #2271b1;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}

.cu29sa-btn-secondary:hover {
    background: #f0f6ff;
}

/* -------------------------------------------------------
   Print / PDF
------------------------------------------------------- */
@media print {
    body * { visibility: hidden; }
    .cu29sa-wrap, .cu29sa-wrap * { visibility: visible; }
    .cu29sa-wrap { position: absolute; left: 0; top: 0; width: 100%; }

    .cu29sa-btn, .cu29sa-btn-secondary,
    .cu29sa-search-box, .cu29sa-loader,
    .cu29sa-after-shortcode,
    #wpadminbar, #adminmenuwrap, #adminmenuback,
    #wpfooter, .notice { display: none !important; }

    .cu29sa-summary { border: 1px solid #ddd; border-radius: 0; box-shadow: none; }
    .cu29sa-ai-section { border: 1px solid #ddd; border-radius: 0; box-shadow: none; }
    .cu29sa-category { border: 1px solid #ddd; border-radius: 0; box-shadow: none; break-inside: avoid; }
    .cu29sa-categories { display: block; }
    .cu29sa-radar-wrap { max-width: 100%; break-inside: avoid; }

    .cu29sa-action-item { break-inside: avoid; }

    @page { margin: 1.5cm; }
}
