@use '../globals' as *;

// Onboarding Wizard Styles

.mpz-onboarding-wrapper {
    display: flex;
    background: #fff;
    min-height: 600px;
    max-width: 900px;
    margin: 40px auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

// Sidebar
.mpz-sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #eee;
    padding: 30px;
    flex-shrink: 0;

    .mpz-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 40px;

        .dashicons {
            font-size: 24px;
            color: #2271b1;
            width: 24px;
            height: 24px;
        }

        h1 {
            font-size: 16px;
            font-weight: 600;
            color: #1d2327;
            margin: 0;
            line-height: 1.2;
        }
    }
}

.mpz-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mpz-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: #646970;

    .step-number {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 2px solid #c3c4c7;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 600;
        transition: all 0.2s;
    }

    .step-title {
        font-size: 14px;
        font-weight: 500;
    }

    &.active {
        color: #1d2327;

        .step-number {
            border-color: #2271b1;
            background: #2271b1;
            color: #fff;
        }
    }

    &.completed {
        color: #2271b1;

        .step-number {
            border-color: #2271b1;
            background: #fff;
            color: #2271b1;
        }
    }
}

// Content Area
.mpz-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
}

.mpz-content-header {
    margin-bottom: 30px;

    h2 {
        margin: 0;
        font-size: 24px;
        color: #1d2327;
    }
}

.mpz-content-body {
    flex-grow: 1;
}

.step-container {
    max-width: 480px;

    &.center-align {
        text-align: center;
        margin-top: 60px;
    }

    .step-description {
        font-size: 15px;
        color: #50575e;
        line-height: 1.5;
        margin-bottom: 25px;
    }
}

// Option Cards (Step 3)
.option-card {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
        border-color: #2271b1;
    }

    &.selected {
        border-color: #2271b1;
        background: #f0f6fc;

        .option-radio {
            color: #2271b1;
        }
    }

    .option-radio {
        font-size: 18px;
        color: #c3c4c7;
        margin-top: 2px;
    }

    .option-content {
        strong {
            display: block;
            margin-bottom: 4px;
            color: #1d2327;
        }

        span {
            font-size: 13px;
            color: #646970;
        }
    }
}

// API Verification
.api-verify-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.api-status-message {
    font-size: 13px;
    font-weight: 500;

    &.success {
        color: #00a32a;
    }

    &.error {
        color: #d63638;
    }
}

// Success Step
.success-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

// Footer buttons
.mpz-content-footer {
    border-top: 1px solid #eee;
    padding-top: 20px;
    display: flex;
    justify-content: flex-end; // Push Next button to right
    gap: 15px;
    margin-top: 20px;

    /* If there's a back button, push it to the left */
    /* We achieve this by targeting the buttons directly if needed, or relying on flex layout order */
    /* Assuming Back is added first, then Next */
}

/* Button override for Back to push it left, assuming only 2 buttons max */
.mpz-content-footer>button:first-child:nth-last-child(2) {
    margin-right: auto;
}

// ─── Loading state ───────────────────────────────────────────────
.tpz-onboarding-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    color: #646970;
    font-size: 14px;
}

// ─── Tier Cards Grid ─────────────────────────────────────────────
.tpz-tier-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.tpz-tier-card {
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;

    &:hover {
        border-color: #2271b1;
        box-shadow: 0 2px 8px rgba(34, 113, 177, 0.1);
    }

    &--selected {
        border-color: #2271b1;
        background: #f0f6fc;
        box-shadow: 0 2px 8px rgba(34, 113, 177, 0.15);
    }

    &__name {
        font-size: 16px;
        font-weight: 600;
        color: #1d2327;
        margin-bottom: 8px;
        text-transform: capitalize;
    }

    &__price {
        font-size: 14px;
        color: #50575e;
        margin-bottom: 12px;

        strong {
            font-size: 24px;
            color: #1d2327;
        }
    }

    &__credits {
        font-size: 13px;
        color: #646970;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #eee;
    }

    &__features {
        list-style: none;
        padding: 0;
        margin: 0;

        li {
            font-size: 13px;
            color: #50575e;
            padding: 4px 0;
            padding-left: 18px;
            position: relative;

            &::before {
                content: '\2713';
                position: absolute;
                left: 0;
                color: #00a32a;
                font-weight: 600;
            }
        }
    }
}

// ─── Billing Toggle ──────────────────────────────────────────────
.tpz-billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;

    &__option {
        font-size: 14px;
        color: #646970;
        cursor: pointer;
        transition: color 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;

        &--active {
            color: #1d2327;
            font-weight: 600;
        }
    }

    &__badge {
        font-size: 11px;
        background: #00a32a;
        color: #fff;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 500;
    }

    &__switch {
        width: 40px;
        height: 22px;
        border-radius: 11px;
        background: #c3c4c7;
        border: none;
        cursor: pointer;
        position: relative;
        padding: 0;
        transition: background 0.2s;

        &:hover {
            background: #a7aaad;
        }
    }

    &__knob {
        display: block;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        position: absolute;
        top: 3px;
        left: 3px;
        transition: left 0.2s;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

        &--annual {
            left: 21px;
        }
    }
}

// ─── Onboarding Form ─────────────────────────────────────────────
.tpz-onboarding-form {
    display: flex;
    flex-direction: column;
    gap: 16px;

    &__field {
        display: flex;
        flex-direction: column;
        gap: 6px;

        label {
            font-size: 13px;
            font-weight: 600;
            color: #1d2327;
        }
    }

    &__input {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #c3c4c7;
        border-radius: 4px;
        font-size: 14px;
        line-height: 1.5;
        background: #fff;
        color: #1d2327;
        transition: border-color 0.2s;
        box-sizing: border-box;

        &:focus {
            border-color: #2271b1;
            box-shadow: 0 0 0 1px #2271b1;
            outline: none;
        }
    }

    &__submit {
        align-self: flex-start;
        min-width: 140px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;

        .spinner {
            margin: 0;
        }
    }

    &__error {
        background: #fcf0f1;
        border: 1px solid #d63638;
        border-left-width: 4px;
        color: #d63638;
        padding: 10px 14px;
        border-radius: 4px;
        font-size: 13px;
        margin-bottom: 8px;
    }

    &__link {
        font-size: 13px;
        color: #646970;
        margin-top: 8px;

        a {
            color: #2271b1;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }
}

// ─── Checkout Summary ────────────────────────────────────────────
.tpz-checkout-summary {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 24px;

    h3 {
        margin: 0 0 16px;
        font-size: 18px;
        color: #1d2327;
        text-transform: capitalize;
    }

    &__detail {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #eee;
        font-size: 14px;

        span {
            color: #646970;
        }

        strong {
            color: #1d2327;
        }

        &:last-child {
            border-bottom: none;
        }
    }
}

// ─── Complete Screen ─────────────────────────────────────────────
.tpz-complete-screen {
    &__detail {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        font-size: 14px;

        span {
            color: #646970;
        }

        strong {
            color: #1d2327;
        }

        code {
            background: #f0f0f1;
            padding: 4px 8px;
            border-radius: 3px;
            font-size: 12px;
            color: #50575e;
            letter-spacing: 0.5px;
        }
    }
}

// ─── Dark Mode ───────────────────────────────────────────────────
.dark-mode {
    .mpz-onboarding-wrapper {
        background: #1e1e1e;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    }

    .mpz-sidebar {
        background: #2c2c2c;
        border-right-color: #3c3c3c;

        .mpz-logo h1 {
            color: #e4e4e4;
        }
    }

    .mpz-step {
        color: #a7aaad;

        .step-number {
            border-color: #555;
        }

        &.active {
            color: #e4e4e4;

            .step-number {
                border-color: #2271b1;
                background: #2271b1;
            }
        }

        &.completed {
            color: #5b9dd9;

            .step-number {
                border-color: #5b9dd9;
                background: #2c2c2c;
                color: #5b9dd9;
            }
        }
    }

    .mpz-content {
        background: #1e1e1e;
    }

    .mpz-content-header h2 {
        color: #e4e4e4;
    }

    .mpz-content-footer {
        border-top-color: #3c3c3c;
    }

    .step-container .step-description {
        color: #a7aaad;
    }

    .tpz-tier-card {
        border-color: #3c3c3c;
        background: #2c2c2c;

        &:hover {
            border-color: #5b9dd9;
            box-shadow: 0 2px 8px rgba(91, 157, 217, 0.15);
        }

        &--selected {
            border-color: #2271b1;
            background: #1a3a5c;
        }

        &__name {
            color: #e4e4e4;
        }

        &__price {
            color: #a7aaad;

            strong {
                color: #e4e4e4;
            }
        }

        &__credits {
            color: #a7aaad;
            border-bottom-color: #3c3c3c;
        }

        &__features li {
            color: #a7aaad;

            &::before {
                color: #46b450;
            }
        }
    }

    .tpz-billing-toggle {
        &__option {
            color: #a7aaad;

            &--active {
                color: #e4e4e4;
            }
        }

        &__switch {
            background: #555;

            &:hover {
                background: #666;
            }
        }
    }

    .tpz-onboarding-form {
        &__field label {
            color: #e4e4e4;
        }

        &__input {
            background: #2c2c2c;
            border-color: #3c3c3c;
            color: #e4e4e4;

            &:focus {
                border-color: #5b9dd9;
                box-shadow: 0 0 0 1px #5b9dd9;
            }
        }

        &__error {
            background: #3c1a1a;
            border-color: #d63638;
        }

        &__link {
            color: #a7aaad;

            a {
                color: #5b9dd9;
            }
        }
    }

    .tpz-checkout-summary {
        background: #2c2c2c;
        border-color: #3c3c3c;

        h3 {
            color: #e4e4e4;
        }

        &__detail {
            border-bottom-color: #3c3c3c;

            span {
                color: #a7aaad;
            }

            strong {
                color: #e4e4e4;
            }
        }
    }

    .tpz-complete-screen__detail {
        span {
            color: #a7aaad;
        }

        strong {
            color: #e4e4e4;
        }

        code {
            background: #2c2c2c;
            color: #a7aaad;
        }
    }
}

// ─── Responsive ──────────────────────────────────────────────────
@media (max-width: 768px) {
    .mpz-onboarding-wrapper {
        flex-direction: column;
        max-width: 100%;
        margin: 20px;
    }

    .mpz-sidebar {
        width: auto;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 20px;
    }

    .mpz-steps {
        display: flex;
        gap: 4px;

        .mpz-step {
            padding: 8px;

            .step-title {
                font-size: 12px;
            }
        }
    }

    .mpz-content {
        padding: 24px;
    }

    .tpz-tier-cards {
        grid-template-columns: 1fr;
    }

    .step-container {
        max-width: 100%;
    }
}
