// Affiliate widget portal page (/my/widget) — hero-focused redesign.
// Every rule is scoped under .kj-widget-page so it cannot leak to other
// portal pages sharing portal_common.scss.

.kj-widget-page {

    // --- Empty state (no widget configured) ---
    .kj-w-empty {
        background: #fff;
        border: 1px dashed #e5e7eb;
        border-radius: 16px;
        padding: 48px 24px;

        > .fa { font-size: 40px; color: #c7ccd1; }
    }

    // --- Performance strip ---
    .kj-w-stats {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-wrap: wrap;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 16px 24px;
    }

    .kj-w-stat {
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 1 1 160px;
    }

    .kj-w-stat-ic {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .kj-w-stat-label {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #9aa0a6;
    }

    .kj-w-stat-val {
        font-size: 22px;
        font-weight: 700;
        line-height: 1.1;
        color: #1f2328;
    }

    .kj-w-stat-sep {
        width: 1px;
        height: 32px;
        background: #e5e7eb;

        @media (max-width: 768px) { display: none; }
    }

    // --- Hero embed card ---
    .kj-w-hero {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 20px;
        padding: 32px;
        box-shadow: 0 10px 30px rgba(206, 0, 0, 0.06);
    }

    .kj-w-hero-head {
        max-width: 520px;
        margin: 0 auto 24px;
        text-align: center;

        h4 { font-size: 22px; }

        code {
            background: #f1f3f5;
            color: #1f2328;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 13px;
        }
    }

    .kj-w-modes {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-bottom: 16px;
    }

    .kj-w-mode {
        font-size: 13px;
        font-weight: 600;
        padding: 6px 16px;
        border-radius: 999px;
        text-decoration: none;
        color: #6c757d;
        background: #fff;
        border: 1px solid #e5e7eb;

        &.active {
            background: #ce0000;
            border-color: #ce0000;
            color: #fff;
        }

        &:hover:not(.active) {
            border-color: #c7ccd1;
            color: #1f2328;
        }
    }

    .kj-w-snippet {
        position: relative;
        background: #16181d;
        border-radius: 14px;
        padding: 28px 20px 20px;
        margin-bottom: 24px;

        pre {
            margin: 0;
            background: none;
            color: #e8e8e8;
            font-size: 13px;
            line-height: 1.6;
            white-space: pre-wrap;
            word-break: break-all;
        }
    }

    .kj-w-snippet-tag {
        position: absolute;
        top: 0;
        left: 20px;
        transform: translateY(-50%);
        background: #2a2d35;
        color: #9aa0a6;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        padding: 4px 10px;
        border-radius: 6px;
    }

    .kj-w-hero-actions {
        display: flex;
        justify-content: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .kj-w-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        font-size: 15px;
        padding: 12px 28px;
        border-radius: 12px;
        text-decoration: none;
        cursor: pointer;
        border: 2px solid transparent;
        transition: all 0.15s ease;
    }

    .kj-w-btn-primary {
        background: #ce0000;
        border-color: #ce0000;
        color: #fff;

        &:hover { background: #b00000; border-color: #b00000; color: #fff; }
    }

    .kj-w-btn-ghost {
        background: #fff;
        border-color: #e5e7eb;
        color: #1f2328;

        &:hover { border-color: #1f2328; color: #1f2328; }
    }

    .kj-w-hero-foot {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 28px;
        padding-top: 20px;
        border-top: 1px solid #f1f3f5;
        font-size: 13px;
        color: #6c757d;
        text-align: center;

        .fa-info-circle { color: #3b82f6; }
    }

    .kj-w-key {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: #f8f9fa;
        border-radius: 6px;
        padding: 4px 10px;
    }

    .kj-w-key-label {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        color: #9aa0a6;
    }

    .kj-w-key code {
        background: none;
        color: #1f2328;
        font-size: 13px;
    }

    // --- Advanced configuration (collapsed <details>) ---
    .kj-w-advanced {
        summary { list-style: none; }
        summary::-webkit-details-marker { display: none; }

        &[open] .kj-w-chevron { transform: rotate(180deg); }
    }

    .kj-w-advanced-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        padding: 16px 4px;
        border-top: 1px solid #e5e7eb;
        font-weight: 600;
        color: #6c757d;

        &:hover { color: #1f2328; }
    }

    .kj-w-chevron { transition: transform 0.25s ease; }

    // The config form is the existing form, relocated here. Give its
    // cards a clear border + soft shadow so they read as proper cards
    // (not floating text) and feel cohesive with the hero above.
    .kj-w-advanced-body {
        padding-top: 8px;

        .kj-detail-card {
            border: 1px solid #dde1e6;
            border-radius: 12px;
            box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
        }

        .kj-card-header { padding: 14px 20px; }
    }
}
