/* wpSEO Frontend Styles - v0.3.0
 * Complete UI for shortcode, report, sticky nav, email modal, asset popout
 */

:root {
    --wpseo-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --wpseo-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    --wpseo-brand: #6366f1;
    --wpseo-brand-hover: #4f46e5;
    --wpseo-sev-high: #ef4444;
    --wpseo-sev-medium: #f59e0b;
    --wpseo-sev-low: #64748b;
    --wpseo-sev-pass: #10b981;
    --wpseo-grade-a: #10b981;
    --wpseo-grade-b: #22c55e;
    --wpseo-grade-c: #eab308;
    --wpseo-grade-d: #f97316;
    --wpseo-grade-f: #ef4444;
    --wpseo-bg-page: #f8fafc;
    --wpseo-bg-card: #ffffff;
    --wpseo-bg-subtle: #f1f5f9;
    --wpseo-text-primary: #0f172a;
    --wpseo-text-body: #334155;
    --wpseo-text-muted: #64748b;
}

/* ========== Base ========== */
.wpseo-checker, .wpseo-report, .wpseo-tool {
    font-family: var(--wpseo-font-sans);
    color: var(--wpseo-text-body);
    line-height: 1.5;
    max-width: 1200px;
    margin: 0 auto;
}

.wpseo-report a { color: var(--wpseo-brand); }

/* ========== Query Box (短代码) ========== */
.wpseo-checker {
    background: var(--wpseo-bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    margin: 2rem 0;
}
.wpseo-checker-header { text-align: center; margin-bottom: 1.5rem; }
.wpseo-checker-title { font-size: 1.5rem; font-weight: 600; color: var(--wpseo-text-primary); margin: 0 0 0.5rem 0; }
.wpseo-checker-subtitle { color: var(--wpseo-text-muted); margin: 0; }
.wpseo-checker-form { margin-top: 1.5rem; }
.wpseo-checker-input-wrap {
    display: flex; align-items: center;
    border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    background: #fff; transition: border-color 0.15s;
}
.wpseo-checker-input-wrap:focus-within { border-color: var(--wpseo-brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.wpseo-checker-input-icon { margin-right: 0.5rem; color: var(--wpseo-text-muted); }
.wpseo-checker-input { flex: 1; border: 0; outline: 0; padding: 0.75rem 0; font-size: 1rem; background: transparent; }
.wpseo-checker-submit {
    background: var(--wpseo-brand); color: #fff;
    border: 0; border-radius: 6px; padding: 0.6rem 1.25rem;
    font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.wpseo-checker-submit:hover { background: var(--wpseo-brand-hover); }
.wpseo-checker-mode { margin-top: 1rem; display: flex; gap: 1rem; align-items: center; font-size: 0.9rem; flex-wrap: wrap; }
.wpseo-mode-option { display: flex; align-items: center; gap: 0.25rem; cursor: pointer; }

/* ========== Loading ========== */
.wpseo-loading { text-align: center; padding: 3rem 1rem; }
.wpseo-loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid #e2e8f0; border-top-color: var(--wpseo-brand);
    border-radius: 50%; margin: 0 auto 1rem;
    animation: wpseo-spin 0.8s linear infinite;
}
@keyframes wpseo-spin { to { transform: rotate(360deg); } }
.wpseo-loading-text { color: var(--wpseo-text-muted); margin: 0 0 1rem 0; }
.wpseo-loading-progress {
    width: 200px; height: 4px; background: #e2e8f0;
    border-radius: 2px; margin: 0 auto; overflow: hidden;
}
.wpseo-loading-bar {
    height: 100%; background: var(--wpseo-brand); width: 30%;
    animation: wpseo-progress 1.5s ease-in-out infinite;
}
@keyframes wpseo-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ========== Sticky Nav ========== */
.wpseo-sticky-nav {
    position: sticky; top: 0; z-index: 100;
    background: var(--wpseo-bg-card);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    margin: 0 0 1.5rem 0;
    padding: 0;
}
.wpseo-nav-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; justify-content: space-around;
}
.wpseo-nav-list li { flex: 1; }
.wpseo-nav-tab {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 1rem; color: var(--wpseo-text-body);
    text-decoration: none; font-weight: 500; font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
.wpseo-nav-tab:hover { color: var(--wpseo-brand); }
.wpseo-nav-tab.is-active { color: var(--wpseo-brand); border-bottom-color: var(--wpseo-brand); }
.wpseo-badge {
    display: inline-block; min-width: 22px; padding: 0 6px;
    border-radius: 9999px; color: #fff;
    font-size: 0.7rem; font-weight: 600; line-height: 18px;
    text-align: center;
}
.wpseo-badge-high { background: var(--wpseo-sev-high); }
.wpseo-badge-medium { background: var(--wpseo-sev-medium); }
.wpseo-badge-low { background: var(--wpseo-sev-low); }

@media (max-width: 768px) {
    .wpseo-nav-list { flex-direction: column; }
    .wpseo-nav-list li { border-bottom: 1px solid var(--wpseo-bg-subtle); }
    .wpseo-nav-tab { padding: 0.75rem 1rem; }
}

/* ========== Card Base ========== */
.wpseo-card {
    background: var(--wpseo-bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    margin: 1.5rem 0;
    overflow: hidden;
    scroll-margin-top: 80px;
}
.wpseo-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; border-bottom: 1px solid #e2e8f0;
}
.wpseo-card-title { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--wpseo-text-primary); }
.wpseo-card-meta { font-size: 0.875rem; color: var(--wpseo-text-muted); }
.wpseo-card-body { padding: 1.5rem; }
.wpseo-card-footer { padding: 1rem 1.5rem; background: #f8fafc; }
.wpseo-card-footer:not(:last-child) { border-bottom: 1px solid #e2e8f0; }

/* ========== Overview ========== */
.wpseo-overview-grid { display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: start; }
@media (max-width: 768px) { .wpseo-overview-grid { grid-template-columns: 1fr; } }

.wpseo-score-rings { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.wpseo-score-ring {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--wpseo-bg-subtle);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-weight: 600; color: #fff;
}
.wpseo-score-ring-num { font-size: 1.25rem; }
.wpseo-score-ring-label { font-size: 0.7rem; opacity: 0.9; margin-top: 2px; }
.wpseo-score-overall { width: 80px; height: 80px; }
.wpseo-score-overall .wpseo-score-ring-num { font-size: 1.75rem; }
.wpseo-grade-a { background: var(--wpseo-grade-a); }
.wpseo-grade-b { background: var(--wpseo-grade-b); }
.wpseo-grade-c { background: var(--wpseo-grade-c); }
.wpseo-grade-d { background: var(--wpseo-grade-d); }
.wpseo-grade-f { background: var(--wpseo-grade-f); }

.wpseo-overview-host { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.5rem 0; color: var(--wpseo-text-primary); }
.wpseo-overview-url { color: var(--wpseo-brand); text-decoration: none; word-break: break-all; font-size: 0.9rem; }
.wpseo-overview-url:hover { text-decoration: underline; }
.wpseo-overview-title { color: var(--wpseo-text-muted); font-size: 0.9rem; margin: 0.5rem 0; }
.wpseo-overview-wp { font-size: 0.85rem; color: var(--wpseo-text-body); margin: 0.5rem 0; }
.wpseo-overview-screenshot { margin-top: 1rem; }
.wpseo-overview-screenshot img { max-width: 100%; height: auto; border-radius: 4px; border: 1px solid #e2e8f0; }
.wpseo-screenshot-failed { background: var(--wpseo-bg-subtle); border: 1px dashed #cbd5e1; padding: 2rem; text-align: center; color: var(--wpseo-text-muted); font-size: 0.875rem; }

/* Logo & Favicon 按钮 */
.wpseo-asset-button {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem;
    margin: 0.75rem 0; color: var(--wpseo-text-body);
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.wpseo-asset-button:hover { background: var(--wpseo-bg-subtle); }
.wpseo-asset-popout {
    background: var(--wpseo-bg-subtle); border-radius: 8px;
    padding: 1rem; margin-bottom: 1rem;
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 640px) { .wpseo-asset-popout { grid-template-columns: 1fr; } }
.wpseo-asset-popout h4 { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--wpseo-text-primary); }
.wpseo-asset-popout img { max-width: 100%; max-height: 80px; background: #fff; border: 1px solid #e2e8f0; border-radius: 4px; padding: 4px; }
.wpseo-asset-popout p { font-size: 0.75rem; color: var(--wpseo-text-muted); word-break: break-all; margin: 0.5rem 0; }
.wpseo-asset-popout a.button { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

/* 严重度条 */
.wpseo-card-footer:not(:last-child) { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) { .wpseo-card-footer:not(:last-child) { grid-template-columns: repeat(2, 1fr); } }
.wpseo-severity-bar-label { font-size: 0.85rem; margin-bottom: 0.25rem; }
.wpseo-progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.wpseo-progress-bar { height: 100%; transition: width 0.5s; }
.wpseo-sev-high  .wpseo-progress-bar { background: var(--wpseo-sev-high); }
.wpseo-sev-medium .wpseo-progress-bar { background: var(--wpseo-sev-medium); }
.wpseo-sev-low    .wpseo-progress-bar { background: var(--wpseo-sev-low); }
.wpseo-sev-pass   .wpseo-progress-bar { background: var(--wpseo-sev-pass); }

/* Metric strip */
.wpseo-metric-strip { display: flex; gap: 2rem; flex-wrap: wrap; align-items: center; }
.wpseo-metric-strip > div { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--wpseo-text-body); }
.wpseo-metric-icon { color: var(--wpseo-text-muted); }

/* ========== Section Cards ========== */
.wpseo-section-score { font-weight: 600; font-size: 0.95rem; padding: 0.2rem 0.6rem; border-radius: 9999px; color: #fff; }
.wpseo-section-score.wpseo-grade-a, .wpseo-section-score.wpseo-grade-b { color: #fff; }
.wpseo-checks { display: flex; flex-direction: column; }

/* Check Row */
.wpseo-check-row {
    padding: 0.75rem 0; border-bottom: 1px solid #f1f5f9;
}
.wpseo-check-row:last-child { border-bottom: 0; }
.wpseo-check-summary {
    display: grid; grid-template-columns: 28px 180px 1fr;
    gap: 1rem; align-items: start;
}
@media (max-width: 768px) {
    .wpseo-check-summary { grid-template-columns: 28px 1fr; }
    .wpseo-check-name, .wpseo-check-message { grid-column: 2; }
}
.wpseo-check-icon {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #fff;
}
.wpseo-check-pass .wpseo-check-icon { background: var(--wpseo-sev-pass); }
.wpseo-check-fail.wpseo-sev-high   .wpseo-check-icon { background: var(--wpseo-sev-high); }
.wpseo-check-fail.wpseo-sev-medium .wpseo-check-icon { background: var(--wpseo-sev-medium); }
.wpseo-check-fail.wpseo-sev-low    .wpseo-check-icon { background: var(--wpseo-sev-low); }
.wpseo-check-warn .wpseo-check-icon { background: var(--wpseo-sev-medium); }
.wpseo-check-skip .wpseo-check-icon { background: var(--wpseo-sev-low); }
.wpseo-check-name { font-weight: 500; color: var(--wpseo-text-primary); }
.wpseo-check-message { color: var(--wpseo-text-body); font-size: 0.9rem; }
.wpseo-check-value {
    display: block; color: var(--wpseo-text-muted);
    font-size: 0.8rem; margin-top: 0.25rem;
    font-family: var(--wpseo-font-mono);
}
.wpseo-check-row.wpseo-sev-high { background: rgba(239, 68, 68, 0.04); }
.wpseo-check-row.wpseo-sev-medium { background: rgba(245, 158, 11, 0.04); }

/* Fix Guides */
.wpseo-check-guides { margin-top: 0.5rem; padding-left: 44px; display: flex; flex-direction: column; gap: 0.75rem; }
.wpseo-guide {
    background: var(--wpseo-bg-subtle);
    border-left: 3px solid var(--wpseo-brand);
    padding: 0.75rem 1rem; border-radius: 0 6px 6px 0;
}
.wpseo-guide-system { border-left-color: #3b82f6; }
.wpseo-guide-admin { border-left-color: #8b5cf6; }
.wpseo-guide-suggestion { border-left-color: #f59e0b; }
.wpseo-guide-title { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--wpseo-text-primary); }
.wpseo-guide-summary { margin: 0 0 0.5rem 0; font-size: 0.875rem; color: var(--wpseo-text-body); }
.wpseo-guide-steps { margin: 0 0 0.5rem 1.25rem; font-size: 0.875rem; }
.wpseo-guide-steps li { margin: 0.25rem 0; }
.wpseo-guide-learn-more { font-size: 0.85rem; }
.wpseo-guide-body { font-size: 0.875rem; }
.wpseo-guide-body a { color: var(--wpseo-brand); }
.wpseo-suggestion-html {
    background: #fff; padding: 0.75rem; border-radius: 4px;
    font-family: var(--wpseo-font-mono); font-size: 0.8rem;
    color: var(--wpseo-text-body); overflow-x: auto;
    border: 1px solid #e2e8f0; white-space: pre-wrap;
}

/* ========== Actions ========== */
.wpseo-actions {
    padding: 1rem 1.5rem; background: var(--wpseo-bg-card);
    border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    margin: 1.5rem 0; display: flex; gap: 0.75rem; flex-wrap: wrap;
    justify-content: flex-end;
}

/* ========== Email Modal ========== */
.wpseo-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.wpseo-modal[hidden] { display: none; }
.wpseo-modal-content {
    background: #fff; border-radius: 12px; padding: 2rem;
    max-width: 480px; width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.wpseo-modal-content h3 { margin: 0 0 1rem 0; color: var(--wpseo-text-primary); }
.wpseo-modal-email { width: 100%; padding: 0.6rem; border: 1px solid #cbd5e1; border-radius: 6px; margin: 0.5rem 0; }
.wpseo-modal-turnstile { color: var(--wpseo-text-muted); font-size: 0.8rem; }
.wpseo-modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ========== Tools ========== */
.wpseo-tool { background: var(--wpseo-bg-card); border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); margin: 1rem 0; }
.wpseo-tool-header h3 { margin: 0 0 0.25rem 0; font-size: 1.1rem; color: var(--wpseo-text-primary); }
.wpseo-tool-description { color: var(--wpseo-text-muted); font-size: 0.9rem; margin: 0 0 1rem 0; }
.wpseo-tool-input-wrap { display: flex; gap: 0.5rem; }
.wpseo-tool-input { flex: 1; padding: 0.6rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.wpseo-tool-submit { background: var(--wpseo-brand); color: #fff; border: 0; padding: 0.6rem 1.25rem; border-radius: 6px; cursor: pointer; }
.wpseo-tool-result { margin-top: 1rem; }
.wpseo-tool-result[hidden] { display: none; }
.wpseo-tool-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.wpseo-tool-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--wpseo-bg-subtle); vertical-align: top; }
.wpseo-tool-table td:first-child { width: 35%; color: var(--wpseo-text-muted); }
.wpseo-tool-table code { font-family: var(--wpseo-font-mono); font-size: 0.8rem; color: var(--wpseo-text-body); }
.wpseo-tool-sublist { margin: 0.25rem 0 0 0; padding: 0 0 0 1.25rem; list-style: disc; font-size: 0.8rem; }
.wpseo-tool-footer { text-align: center; color: var(--wpseo-text-muted); margin: 0.75rem 0 0 0; }
.wpseo-placeholder-notice { background: #fef3c7; border-left: 3px solid #f59e0b; padding: 1rem; border-radius: 4px; }
.wpseo-placeholder-notice h4 { margin: 0 0 0.5rem 0; color: #92400e; }
.wpseo-placeholder-notice p { margin: 0; color: #92400e; }
.wpseo-ssl-status { padding: 0.15rem 0.5rem; border-radius: 4px; font-weight: 600; font-size: 0.75rem; }
.wpseo-ssl-ok { background: #d1fae5; color: #065f46; }
.wpseo-ssl-warn { background: #fef3c7; color: #92400e; }
.wpseo-ssl-expired { background: #fee2e2; color: #991b1b; }
.wpseo-tool-hop-list { list-style: none; padding: 0; }
.wpseo-tool-hop-list li { padding: 0.5rem; border-bottom: 1px solid var(--wpseo-bg-subtle); display: flex; gap: 0.5rem; align-items: center; }
.wpseo-hop-status { padding: 0.15rem 0.5rem; border-radius: 4px; color: #fff; font-size: 0.75rem; }
.wpseo-hop-2xx, .wpseo-hop-3xx { background: var(--wpseo-sev-pass); }
.wpseo-hop-4xx { background: var(--wpseo-sev-medium); }
.wpseo-hop-5xx { background: var(--wpseo-sev-high); }

/* ========== Print ========== */
@media print {
    .wpseo-sticky-nav, .wpseo-actions, .wpseo-asset-button, .wpseo-asset-popout { display: none !important; }
    .wpseo-card { box-shadow: none; border: 1px solid #ddd; }
    .wpseo-check-guides { display: block !important; }
}
