/* ── Expand WooCommerce containers so our wizard uses the full width ── */
body.paynecta-wizard-active .wrap.woocommerce,
body.paynecta-wizard-active #mainform,
body.paynecta-wizard-active .woocommerce-layout__body,
body.paynecta-wizard-active .woocommerce-layout__primary,
body.paynecta-wizard-active .woocommerce-settings-content,
body.paynecta-wizard-active .woocommerce-settings-layout__main,
body.paynecta-wizard-active .components-panel {
    max-width: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Paynecta Setup Wizard */
.paynecta-setup-wrap {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.paynecta-wizard-step {
    display: none;
}

.paynecta-wizard-step.active {
    display: block;
}

/* ── Step 1: Hero / Welcome ── */
.paynecta-hero {
    text-align: center;
    padding: 60px 48px 48px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0;
}

.paynecta-setup-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 24px;
}

.paynecta-hero h1 {
    font-size: 28px;
    color: #1a1a1a;
    margin: 0 0 16px;
    font-weight: 700;
    line-height: 1.3;
}

.paynecta-hero .subtitle {
    font-size: 15px;
    color: #555;
    margin: 0 auto 32px;
    max-width: 500px;
    line-height: 1.6;
}

.paynecta-features-row {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 auto 32px;
    max-width: 700px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.paynecta-feature-item {
    flex: 1;
    text-align: center;
    padding: 18px 16px;
    border-right: 1px solid #eee;
}

.paynecta-feature-item:last-child {
    border-right: none;
}

.paynecta-feature-item .feature-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.paynecta-feature-item .feature-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.paynecta-payment-icons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 28px;
    flex-wrap: wrap;
}

.paynecta-payment-icon {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.paynecta-payment-icon.mpesa {
    background: #00A651;
    color: #fff;
    border-color: #00A651;
}

.paynecta-hero .description {
    font-size: 14px;
    color: #666;
    margin: 0 0 28px;
}

.paynecta-btn-primary {
    display: inline-block;
    background: #0e443f;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.2s;
    line-height: 1;
}

.paynecta-btn-primary:hover {
    background: #0a332e;
    color: #fff !important;
}

.paynecta-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── Info section below hero ── */
.paynecta-info-section {
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
}

.paynecta-info-section h2 {
    font-size: 18px;
    color: #1a1a1a;
    padding: 36px 40px 0;
    margin: 0 0 24px;
    text-align: center;
    font-weight: 600;
}

.paynecta-info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 40px 40px;
    gap: 0;
}

.paynecta-info-card {
    padding: 24px;
    border-right: 1px solid #f0f0f0;
}

.paynecta-info-card:last-child {
    border-right: none;
}

.paynecta-info-card .card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.paynecta-info-card h3 {
    font-size: 14px;
    color: #1a1a1a;
    margin: 0 0 8px;
    font-weight: 600;
}

.paynecta-info-card p {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* ── Steps 2 & 3: Step Card ── */
.paynecta-step-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 48px 56px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.paynecta-back-link {
    display: inline-flex;
    align-items: center;
    color: #0e443f;
    text-decoration: none !important;
    font-size: 13px;
    margin-bottom: 28px;
    cursor: pointer;
    font-weight: 500;
}

.paynecta-back-link:hover {
    color: #0a332e;
}

.paynecta-step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.paynecta-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.paynecta-step-dot.active {
    background: #0e443f;
    color: #fff;
}

.paynecta-step-dot.done {
    background: #27ae60;
    color: #fff;
}

.paynecta-step-dot.inactive {
    background: #e8e8e8;
    color: #aaa;
}

.paynecta-step-line {
    flex: 1;
    height: 2px;
    background: #e8e8e8;
    margin: 0 10px;
}

.paynecta-step-line.done {
    background: #27ae60;
}

.paynecta-step-card h2 {
    font-size: 22px;
    color: #1a1a1a;
    margin: 0 0 8px;
    font-weight: 700;
}

.paynecta-step-card .step-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 32px;
    line-height: 1.6;
}

.paynecta-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.paynecta-field-group {
    margin-bottom: 22px;
}

.paynecta-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 7px;
}

.paynecta-field-group input[type="password"],
.paynecta-field-group input[type="email"],
.paynecta-field-group input[type="text"],
.paynecta-field-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    color: #333;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.paynecta-field-group input:focus,
.paynecta-field-group select:focus {
    border-color: #0e443f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 68, 63, 0.15);
}

.paynecta-field-group .field-hint {
    font-size: 12px;
    color: #888;
    margin: 6px 0 0;
    line-height: 1.5;
}

.paynecta-error-msg {
    background: #fef8f8;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    padding: 12px 16px;
    color: #c0392b;
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
}

.paynecta-step-actions {
    margin-top: 32px;
}

/* Callback URL display in step 3 */
.paynecta-callback-box {
    background: #f4faf9;
    border: 1px solid #b2d8d4;
    border-radius: 4px;
    padding: 16px 18px;
    margin-top: 8px;
    margin-bottom: 24px;
}

.paynecta-callback-box h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #0e443f;
}

.paynecta-callback-box .callback-url {
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    word-break: break-all;
    color: #333;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 3px;
    padding: 8px 10px;
}

.paynecta-callback-box p {
    font-size: 12px;
    color: #666;
    margin: 8px 0 0;
    line-height: 1.5;
}

/* ════════════════════════════════════════════════════
   Modern Connected Settings Page
   ════════════════════════════════════════════════════ */

.paynecta-settings-wrap {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Account header card */
.paynecta-account-card {
    background: linear-gradient(135deg, #0e443f 0%, #1a6b5f 100%);
    border-radius: 10px;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(14, 68, 63, 0.25);
}

.paynecta-account-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.paynecta-account-avatar {
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.paynecta-account-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.paynecta-badge-connected {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(46, 204, 113, 0.25);
    border: 1px solid rgba(46, 204, 113, 0.5);
    color: #a8f5c8;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    width: fit-content;
}

.paynecta-badge-connected::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 6px #2ecc71;
}

.paynecta-account-email {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.paynecta-reconnect-link {
    background: #c0392b;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    letter-spacing: 0.02em;
}

.paynecta-reconnect-link:hover {
    background: #a93226;
    color: #fff !important;
}

/* Settings cards */
.paynecta-settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.paynecta-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
    letter-spacing: 0.01em;
}

/* Enable toggle row */
.paynecta-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.paynecta-toggle-row-info h3 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #111;
    font-weight: 600;
}

.paynecta-toggle-row-info p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

/* Toggle switch */
.paynecta-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.paynecta-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.paynecta-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 28px;
    transition: background 0.25s;
    cursor: pointer;
}

.paynecta-toggle-slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.paynecta-toggle-switch input:checked + .paynecta-toggle-slider {
    background: #0e443f;
}

.paynecta-toggle-switch input:checked + .paynecta-toggle-slider::before {
    transform: translateX(22px);
}

/* 2-column grid */
.paynecta-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.paynecta-settings-grid .paynecta-settings-card {
    margin-bottom: 0;
}

/* Textarea in connected settings */
.paynecta-settings-wrap textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    color: #333;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.paynecta-settings-wrap textarea:focus {
    border-color: #0e443f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 68, 63, 0.15);
}

/* Callback URL display */
.paynecta-callback-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 18px;
}

.paynecta-callback-display code {
    flex: 1;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    color: #374151;
    word-break: break-all;
    background: none;
    padding: 0;
    line-height: 1.5;
}

.paynecta-copy-btn {
    background: #0e443f;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    letter-spacing: 0.02em;
}

.paynecta-copy-btn:hover {
    background: #0a332e;
}

.paynecta-copy-btn.copied {
    background: #27ae60;
}

/* Save row */
.paynecta-settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* Remove WC's default "Save changes" button since we have our own */
body.paynecta-wizard-active .woocommerce-save-button,
body.paynecta-wizard-active p.submit {
    display: none !important;
}

/* ── Reconfigure modal ── */
.paynecta-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paynecta-modal {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: paynecta-modal-in 0.18s ease;
}

@keyframes paynecta-modal-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.paynecta-modal-icon {
    font-size: 36px;
    color: #e67e22;
    margin-bottom: 14px;
    line-height: 1;
}

.paynecta-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0 0 12px;
}

.paynecta-modal-body {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 24px;
}

.paynecta-modal-body strong {
    color: #222;
}

.paynecta-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.paynecta-modal-cancel {
    flex: 1;
    padding: 10px 0;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.paynecta-modal-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.paynecta-modal-confirm {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: #c0392b;
    color: #fff;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.paynecta-modal-confirm:hover {
    background: #a93226;
}

.paynecta-modal-confirm:disabled {
    background: #e0998f;
    cursor: not-allowed;
}

/* ── Connected banner (shown when already set up) ── */
.paynecta-connected-banner {
    background: #f0fff4;
    border: 1px solid #a3d9b5;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.paynecta-connected-icon {
    width: 34px;
    height: 34px;
    background: #27ae60;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

.paynecta-connected-banner h3 {
    margin: 0 0 2px;
    font-size: 14px;
    color: #1a5c35;
    font-weight: 600;
}

.paynecta-connected-banner p {
    margin: 0;
    font-size: 13px;
    color: #2d7a50;
}

/* ── Eye toggle inside API Key input ── */
.paynecta-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.paynecta-input-wrap input {
    padding-right: 40px !important;
    flex: 1;
}

.paynecta-toggle-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paynecta-toggle-eye:hover {
    color: #0e443f;
}

.paynecta-toggle-eye .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ── Auth success banner in step 3 ── */
.paynecta-auth-success {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0fff4;
    border: 1px solid #a3d9b5;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 24px;
    font-size: 13px;
    color: #1a5c35;
    font-weight: 500;
}

.paynecta-auth-success::before {
    content: "✓";
    width: 20px;
    height: 20px;
    background: #27ae60;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 20px;
    text-align: center;
}

/* ── Spinner ── */
.paynecta-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: paynecta-spin 0.65s linear infinite;
    margin-right: 7px;
    vertical-align: middle;
}

@keyframes paynecta-spin {
    to { transform: rotate(360deg); }
}
