/* Sales Page Analyzer — Frontend Overlay */

#spa-overlay {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

/* ── Toggle Bubble ── */
.spa-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #6366f1;
    box-shadow: 0 4px 16px rgba(99,102,241,.5);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform .2s, box-shadow .2s;
    user-select: none;
}
.spa-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 22px rgba(99,102,241,.6);
}
.spa-toggle-icon { font-size: 22px; line-height: 1; }
.spa-toggle-score {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    margin-top: 2px;
    letter-spacing: .5px;
}

/* ── Panel ── */
.spa-panel {
    position: absolute;
    bottom: 66px;
    right: 0;
    width: 340px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    overflow: hidden;
    display: none;
}
.spa-overlay:not(.spa-collapsed) .spa-panel {
    display: block;
    animation: spa-slide-up .22s ease;
}
@keyframes spa-slide-up {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ── Panel Header ── */
.spa-panel-header {
    background: #6366f1;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}
.spa-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: .8;
}
.spa-close:hover { opacity: 1; }

/* ── Panel Body ── */
.spa-panel-body {
    max-height: 520px;
    overflow-y: auto;
    padding: 16px;
}

/* ── Loading ── */
.spa-loading {
    text-align: center;
    padding: 20px 0;
    color: #6b7280;
}
.spa-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spa-spin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spa-spin { to { transform:rotate(360deg); } }

/* ── Score Hero ── */
.spa-score-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}
.spa-grade-circle {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.spa-score-text .spa-total {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}
.spa-score-text .spa-label {
    color: #6b7280;
    font-size: 13px;
}

/* ── Category Bars ── */
.spa-category {
    margin-bottom: 14px;
}
.spa-cat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 13px;
}
.spa-cat-name { font-weight: 600; color: #374151; }
.spa-cat-pts  { color: #6b7280; }
.spa-bar-bg {
    background: #e5e7eb;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.spa-bar-fill {
    height: 8px;
    border-radius: 4px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
}
.spa-cat-feedback {
    margin-top: 5px;
}
.spa-feedback-item {
    font-size: 12px;
    color: #dc2626;
    margin-top: 3px;
    padding-left: 14px;
    position: relative;
}
.spa-feedback-item::before {
    content: '⚠';
    position: absolute;
    left: 0;
}

/* ── AI Block ── */
.spa-ai-block {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px;
    margin-top: 14px;
    font-size: 13px;
}
.spa-ai-block h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #0369a1;
}
.spa-ai-summary { color: #374151; margin-bottom: 8px; line-height: 1.5; }
.spa-ai-strength { color: #15803d; margin: 4px 0; }
.spa-ai-weakness { color: #b91c1c; margin: 4px 0; }
.spa-ai-tip { color: #374151; margin: 4px 0; padding-left: 14px; position: relative; }
.spa-ai-tip::before { content:'💡'; position:absolute;left:0; }

/* ── No AI notice ── */
.spa-no-ai {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

/* ── Responsive ── */
@media (max-width: 420px) {
    .spa-panel { width: calc(100vw - 32px); right: 0; }
    #spa-overlay { right: 12px; bottom: 12px; }
}
