/**
 * Setup wizard (admin/modules/setup-wizard).
 * Colors follow the WordPress admin palette used across the plugin's screens.
 */

.wrap.wtofe-setup {
    max-width: 760px;
    margin: 24px auto 48px;
    padding: 0 16px;
    box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.wtofe-setup__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.wtofe-setup .wtofe-setup__title {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
}

.wtofe-setup__skip {
    color: #646970;
    font-size: 13px;
}

/* ── Stepper ─────────────────────────────────────────────────────────────── */

.wtofe-setup__steps {
    display: flex;
    gap: 8px;
    margin: 16px 0 20px;
    padding: 0;
    list-style: none;
}

.wtofe-setup__steps li {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #646970;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.wtofe-setup__steps li:not(:last-child)::after {
    content: '';
    flex: 1 1 auto;
    min-width: 12px;
    height: 1px;
    background: #c3c4c7;
}

.wtofe-setup__step-num {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid #c3c4c7;
    border-radius: 50%;
    background: #fff;
    font-size: 12px;
    line-height: 1;
}

.wtofe-setup__steps li.is-current {
    color: #1d2327;
}

.wtofe-setup__steps li.is-current .wtofe-setup__step-num {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.wtofe-setup__steps li.is-done .wtofe-setup__step-num {
    background: #00a32a;
    border-color: #00a32a;
    color: #fff;
    font-size: 0;
}

.wtofe-setup__steps li.is-done .wtofe-setup__step-num::before {
    content: "\f147"; /* dashicons-yes */
    font: normal 18px/1 dashicons;
}

/* ── Panel ───────────────────────────────────────────────────────────────── */

.wtofe-setup__panel {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 28px 32px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.wtofe-setup__panel h2 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
    color: #1d2327;
}

.wtofe-setup__panel h2:focus {
    outline: none;
}

.wtofe-setup__lead {
    margin: 0 0 20px;
    max-width: 62ch;
    font-size: 14px;
    line-height: 1.6;
    color: #50575e;
}

.wtofe-setup__subhead {
    margin: 28px 0 12px;
    font-size: 14px;
    color: #1d2327;
}

.wtofe-setup__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f1;
}

.wtofe-setup__actions-end {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wtofe-setup__hint {
    font-size: 13px;
    color: #646970;
}

/* ── Step 1: welcome ─────────────────────────────────────────────────────── */

.wtofe-setup__features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.wtofe-setup__features li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid #f0f0f1;
    border-radius: 6px;
    background: #fcfcfc;
    font-size: 13px;
    line-height: 1.5;
    color: #646970;
}

.wtofe-setup__features .dashicons {
    margin-bottom: 4px;
    color: #2271b1;
}

.wtofe-setup__features strong {
    color: #1d2327;
}

.wtofe-setup__note {
    padding: 12px 16px;
    border-radius: 6px;
    background: #f0f6fc;
    font-size: 13px;
    color: #1d2327;
}

.wtofe-setup__note p {
    margin: 2px 0 0;
    font-size: 13px;
}

/* ── Step 2: provider cards ──────────────────────────────────────────────── */

.wtofe-setup__providers {
    display: grid;
    gap: 12px;
}

.wtofe-setup-provider {
    padding: 16px 18px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #fff;
}

.wtofe-setup-provider[data-state="connected"] {
    border-color: #b8e6bf;
}

.wtofe-setup-provider__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wtofe-setup-provider__logo {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #f6f7f7;
    font-size: 15px;
    font-weight: 600;
    color: #50575e;
}

.wtofe-setup-provider__logo img {
    width: 22px;
    height: 22px;
}

.wtofe-setup-provider__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wtofe-setup-provider__name {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.wtofe-setup-provider__use {
    font-size: 12px;
    color: #646970;
}

.wtofe-setup-badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}

.wtofe-setup-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.wtofe-setup-badge--connected {
    display: none;
    background: #edf7ed;
    color: #1e7a1e;
}

.wtofe-setup-badge--idle {
    background: #f0f0f1;
    color: #646970;
}

.wtofe-setup-provider[data-state="connected"] .wtofe-setup-badge--connected {
    display: inline-flex;
}

.wtofe-setup-provider[data-state="connected"] .wtofe-setup-badge--idle {
    display: none;
}

/* One body per state; data-state picks which one shows. */
.wtofe-setup-provider__body {
    display: none;
    margin: 12px 0 0 48px;
}

.wtofe-setup-provider[data-state="not_installed"] [data-for="not_installed"],
.wtofe-setup-provider[data-state="inactive"] [data-for="inactive"],
.wtofe-setup-provider[data-state="needs_key"] [data-for="needs_key"],
.wtofe-setup-provider[data-state="connected"] [data-for="connected"],
.wtofe-setup-provider.is-replacing [data-for="needs_key"] {
    display: block;
}

.wtofe-setup-provider.is-replacing [data-for="connected"] {
    display: none;
}

.wtofe-setup-provider__body p {
    margin: 0 0 8px;
    font-size: 13px;
    color: #50575e;
}

.wtofe-setup-provider__keyrow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.wtofe-setup-provider__keyrow input {
    flex: 1 1 260px;
    max-width: 420px;
    margin: 0;
}

.wtofe-setup-provider__cancel {
    display: none;
}

.wtofe-setup-provider.is-replacing .wtofe-setup-provider__cancel {
    display: inline-block;
}

.wtofe-setup-provider .wtofe-setup-provider__help {
    margin: 8px 0 0;
    font-size: 12px;
}

.wtofe-setup-provider .wtofe-setup-provider__connected {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.wtofe-setup-provider__masked {
    font-family: Consolas, Menlo, monospace;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #8c8f94;
}

.wtofe-setup-provider__msg {
    margin: 10px 0 0 48px;
    font-size: 13px;
    color: #d63638;
}

.wtofe-setup-provider[aria-busy="true"] .wtofe-setup-provider__key-input {
    opacity: 0.6;
}

.wtofe-setup__alt {
    margin-top: 20px;
}

.wtofe-setup__alt summary {
    cursor: pointer;
    color: #2271b1;
    font-size: 13px;
}

.wtofe-setup__alt .description {
    margin: 8px 0 12px;
}

/* ── Step 3: test and next steps ─────────────────────────────────────────── */

.wtofe-setup__test .wtofe-ripple-btn {
    position: relative;
    overflow: hidden;
}

.wtofe-setup__test .wtofe-ripple-btn.wtofe-btn-pending::before,
.wtofe-setup__test .wtofe-ripple-btn.wtofe-btn-pending::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: rgba(34, 113, 177, 0.45);
    pointer-events: none;
    animation: wtofe-setup-ripple 1.2s ease-out infinite;
}

.wtofe-setup__test .wtofe-ripple-btn.wtofe-btn-pending::after {
    animation-delay: 0.6s;
}

@keyframes wtofe-setup-ripple {
    to { transform: scale(18); opacity: 0; }
}

.wtofe-setup__next {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.wtofe-setup__tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #646970;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.wtofe-setup__tile:hover,
.wtofe-setup__tile:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    color: #646970;
}

.wtofe-setup__tile .dashicons {
    margin-bottom: 4px;
    color: #2271b1;
}

.wtofe-setup__tile strong {
    color: #1d2327;
}

/* ── Small screens ───────────────────────────────────────────────────────── */

@media screen and (max-width: 782px) {
    .wrap.wtofe-setup {
        margin-top: 16px;
        padding: 0;
    }

    .wtofe-setup__panel {
        padding: 20px 16px;
    }

    .wtofe-setup__steps li {
        font-size: 0; /* numbers only */
    }

    .wtofe-setup__steps li.is-current {
        font-size: 13px;
    }

    .wtofe-setup__features,
    .wtofe-setup__next {
        grid-template-columns: 1fr;
    }

    .wtofe-setup-provider__body,
    .wtofe-setup-provider__msg {
        margin-left: 0;
    }

    .wtofe-setup__actions-end {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 6px;
    }
}
