/* ==========================================================================
   Social Preview tool — anteprime social per qualunque URL
   ========================================================================== */

.sp-hero { padding-bottom: 0; }

.sp-form {
    max-width: 720px;
    margin: 32px auto 0;
    text-align: left;
}
.sp-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.sp-form-input {
    flex: 1;
    background: var(--color-bg-dark);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 16px;
    font-family: var(--font-family);
    min-height: 52px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.sp-form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #000;
}
.sp-form-btn { flex-shrink: 0; min-height: 52px; }
.sp-form-hint {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}
.sp-error {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: var(--radius-md);
    font-size: 14px;
}

/* ============ Tabs ============ */
.sp-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 32px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sp-tab {
    background: none;
    border: none;
    color: var(--color-text-light);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.sp-tab:hover { color: var(--color-text); }
.sp-tab.is-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.sp-tab-count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
}
.sp-tab-panel { display: none; }
.sp-tab-panel.is-active { display: block; }

/* ============ Card generica ============ */
.sp-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}
.sp-card-platform {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

/* ============ Google SERP ============ */
.sp-google {
    font-family: arial, sans-serif;
    background: #fff;
    color: #202124;
    border-radius: 8px;
    padding: 14px 18px;
}
.sp-google-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.sp-google-favicon {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #f1f3f4;
    object-fit: contain;
    padding: 1px;
    flex-shrink: 0;
}
.sp-google-sitename { font-size: 14px; color: #202124; line-height: 1.3; }
.sp-google-url { font-size: 12px; color: #4d5156; line-height: 1.3; }
.sp-google-title {
    color: #1a0dab;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
    margin: 4px 0 4px;
    text-decoration: none;
}
.sp-google-desc {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* ============ Facebook ============ */
.sp-fb {
    background: #f0f2f5;
    border: 1px solid #ced0d4;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1c1e21;
}
.sp-fb-image {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    background: #e4e6eb center/cover no-repeat;
}
.sp-fb-image.is-empty::after {
    content: "Nessuna og:image";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #8d8d8d;
    font-size: 14px;
}
.sp-fb-meta { padding: 12px 14px; background: #f0f2f5; }
.sp-fb-domain { font-size: 12px; color: #65676b; text-transform: uppercase; margin-bottom: 3px; }
.sp-fb-title { font-size: 17px; font-weight: 600; color: #1c1e21; line-height: 1.3; margin-bottom: 4px; }
.sp-fb-desc { font-size: 14px; color: #606770; line-height: 1.3; }

/* ============ X / Twitter ============ */
.sp-x {
    background: #fff;
    border: 1px solid #cfd9de;
    border-radius: 16px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f1419;
}
.sp-x-image {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    background: #eff3f4 center/cover no-repeat;
    border-bottom: 1px solid #cfd9de;
}
.sp-x-image.is-empty::after {
    content: "—";
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #536471; font-size: 24px;
}
.sp-x-meta { padding: 10px 14px; }
.sp-x-domain { color: #536471; font-size: 13px; margin-top: 4px; }
.sp-x-title { font-size: 14px; font-weight: 500; color: #0f1419; line-height: 1.3; }
.sp-x-desc { font-size: 14px; color: #536471; line-height: 1.3; margin-top: 2px; }

/* ============ LinkedIn ============ */
.sp-li {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #000;
}
.sp-li-image {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    background: #f3f2ef center/cover no-repeat;
}
.sp-li-image.is-empty::after {
    content: "—";
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #666; font-size: 20px;
}
.sp-li-meta { padding: 8px 12px; background: #edf3f8; }
.sp-li-title { font-size: 14px; font-weight: 600; color: #000; line-height: 1.4; }
.sp-li-domain { font-size: 12px; color: #00000099; margin-top: 4px; }

/* ============ WhatsApp / Telegram ============ */
.sp-wa {
    background: #dcf8c6;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #111b21;
    border: 1px solid #c5e0b1;
}
.sp-wa-image {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    background: #c5e0b1 center/cover no-repeat;
}
.sp-wa-image.is-empty { display: none; }
.sp-wa-meta { padding: 10px 12px; }
.sp-wa-title { font-size: 14px; font-weight: 600; color: #111b21; line-height: 1.3; }
.sp-wa-desc { font-size: 13px; color: #3b4a54; line-height: 1.3; margin-top: 2px; }
.sp-wa-domain { font-size: 11px; color: #667781; margin-top: 6px; text-transform: lowercase; }

/* ============ Slack ============ */
.sp-slack {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d1c1d;
    border: 1px solid #ddd;
}
.sp-slack-bar {
    width: 4px;
    background: #1264a3;
    flex-shrink: 0;
}
.sp-slack-body { padding: 8px 14px; flex: 1; }
.sp-slack-domain { font-size: 13px; color: #1d1c1d; font-weight: 600; }
.sp-slack-title { font-size: 15px; font-weight: 700; color: #1264a3; margin-top: 2px; line-height: 1.3; }
.sp-slack-desc { font-size: 14px; color: #1d1c1d; margin-top: 4px; line-height: 1.4; }
.sp-slack-image {
    margin-top: 8px;
    max-width: 360px;
    aspect-ratio: 1.91 / 1;
    background: #f4f4f4 center/cover no-repeat;
    border-radius: 4px;
}
.sp-slack-image.is-empty { display: none; }

/* ============ Discord ============ */
.sp-discord {
    background: #2b2d31;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    font-family: gg sans, "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #dbdee1;
    border: 1px solid #1e1f22;
}
.sp-discord-bar { width: 4px; background: #4e5058; flex-shrink: 0; }
.sp-discord-body { padding: 8px 12px; flex: 1; }
.sp-discord-sitename { font-size: 12px; color: #b5bac1; }
.sp-discord-title {
    font-size: 16px;
    font-weight: 600;
    color: #00a8fc;
    line-height: 1.3;
    margin-top: 2px;
}
.sp-discord-desc {
    font-size: 14px;
    color: #dbdee1;
    line-height: 1.4;
    margin-top: 4px;
}
.sp-discord-image {
    margin-top: 8px;
    max-width: 400px;
    aspect-ratio: 1.91 / 1;
    background: #1e1f22 center/cover no-repeat;
    border-radius: 4px;
}
.sp-discord-image.is-empty { display: none; }

/* ============ Meta tag tables ============ */
.sp-meta-section { margin-bottom: 32px; }
.sp-meta-h {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
}
.sp-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.sp-meta-table tr {
    border-bottom: 1px solid var(--color-border);
}
.sp-meta-table th,
.sp-meta-table td {
    text-align: left;
    padding: 10px 12px;
    vertical-align: top;
    word-break: break-word;
}
.sp-meta-table th {
    color: var(--color-text-light);
    font-weight: 600;
    width: 32%;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}
.sp-meta-table td {
    color: var(--color-text);
}
.sp-meta-table td .sp-meta-empty {
    color: #ef4444;
    font-style: italic;
}
.sp-meta-table img.sp-meta-thumb {
    max-width: 200px;
    height: auto;
    border-radius: 4px;
    margin-top: 4px;
    display: block;
}
#sp-meta-jsonld {
    background: var(--color-bg-dark);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--color-text);
}
#sp-meta-jsonld .sp-jsonld-type {
    display: inline-block;
    padding: 3px 9px;
    background: rgba(212, 255, 0, 0.12);
    color: var(--color-primary);
    border-radius: 4px;
    margin: 0 6px 6px 0;
    font-weight: 600;
}

/* ============ Issues ============ */
.sp-issues {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sp-issue {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    font-size: 14px;
    color: var(--color-text);
}
.sp-issue-icon {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 12px;
}
.sp-issue.is-error { border-color: rgba(239, 68, 68, 0.4); }
.sp-issue.is-error .sp-issue-icon { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.sp-issue.is-warn { border-color: rgba(245, 158, 11, 0.4); }
.sp-issue.is-warn .sp-issue-icon { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.sp-issue.is-info { border-color: rgba(96, 165, 250, 0.4); }
.sp-issue.is-info .sp-issue-icon { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.sp-issues-empty {
    padding: 20px;
    text-align: center;
    color: var(--color-text-muted);
}

/* ============ Mobile ============ */
@media (max-width: 700px) {
    .sp-form-row { flex-direction: column; }
    .sp-form-btn { width: 100%; justify-content: center; }
    .sp-card { padding: 16px; }
    .sp-meta-table th { width: 38%; }
}

/* ============ Light theme ============ */
[data-theme="light"] .sp-form-input { background: var(--color-bg); }
[data-theme="light"] .sp-form-input:focus { background: var(--color-bg); border-color: var(--color-primary-dark); }
