/**
 * Authyo ChatLead Setup Wizard Styles
 *
 * Clean, modern 5-step onboarding wizard.
 *
 * @since 1.2.0
 */

/* ---------------------------------------------------------------
   Reset / Base
--------------------------------------------------------------- */
.authyo-wizard-body {
    background: #f0f0f1;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Hide default WP admin chrome on wizard page */
.authyo-wizard-body #adminmenuwrap,
.authyo-wizard-body #adminmenuback,
.authyo-wizard-body #wpadminbar,
.authyo-wizard-body #wpfooter {
    display: none !important;
}

/* ---------------------------------------------------------------
   Outer Wrap
--------------------------------------------------------------- */
.authyo-wizard-wrap {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 16px 60px;
}

/* ---------------------------------------------------------------
   Header Bar
--------------------------------------------------------------- */
.authyo-wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 0 4px;
}

.authyo-wizard-logo strong {
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
    letter-spacing: -0.3px;
}

.authyo-wizard-header-title {
    font-size: 14px;
    color: #646970;
}

.authyo-wizard-skip {
    font-size: 13px;
    color: #646970;
    text-decoration: none;
}

.authyo-wizard-skip:hover {
    color: #2271b1;
    text-decoration: underline;
}

/* ---------------------------------------------------------------
   Progress Bar
--------------------------------------------------------------- */
.authyo-wizard-progress {
    margin-bottom: 28px;
}

.authyo-wizard-progress-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.authyo-wizard-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.authyo-wizard-progress-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #c3c4c7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    position: relative;
    z-index: 1;
}

.authyo-wizard-progress-num {
    font-size: 13px;
    font-weight: 600;
    color: #8c8f94;
    line-height: 1;
    transition: color 0.25s ease;
}

.authyo-wizard-progress-label {
    font-size: 11px;
    color: #8c8f94;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.25s ease;
}

/* Active step */
.authyo-wizard-progress-step.active .authyo-wizard-progress-dot {
    background: #2271b1;
    border-color: #2271b1;
    box-shadow: 0 0 0 4px rgba(34, 113, 177, 0.15);
}

.authyo-wizard-progress-step.active .authyo-wizard-progress-num {
    color: #fff;
}

.authyo-wizard-progress-step.active .authyo-wizard-progress-label {
    color: #2271b1;
    font-weight: 700;
}

/* Completed step */
.authyo-wizard-progress-step.completed .authyo-wizard-progress-dot {
    background: #00a32a;
    border-color: #00a32a;
}

.authyo-wizard-progress-step.completed .authyo-wizard-progress-num::before {
    content: "✓";
    color: #fff;
}

.authyo-wizard-progress-step.completed .authyo-wizard-progress-num {
    font-size: 0; /* hide number, show checkmark via ::before */
}

.authyo-wizard-progress-step.completed .authyo-wizard-progress-label {
    color: #00a32a;
}

/* Connector lines */
.authyo-wizard-progress-line {
    flex: 1;
    height: 2px;
    background: #c3c4c7;
    margin: 0 4px;
    margin-bottom: 22px; /* align with dot center */
    transition: background 0.25s ease;
}

.authyo-wizard-progress-line.completed {
    background: #00a32a;
}

/* ---------------------------------------------------------------
   Wizard Card
--------------------------------------------------------------- */
.authyo-wizard-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* ---------------------------------------------------------------
   Step Content
--------------------------------------------------------------- */
.authyo-wizard-step {
    display: none;
    padding: 36px 40px;
    animation: authyoWizardFadeIn 0.25s ease;
}

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

.authyo-wizard-step.leaving {
    animation: authyoWizardFadeOut 0.2s ease forwards;
}

.authyo-wizard-step.entering {
    animation: authyoWizardFadeIn 0.25s ease;
}

@keyframes authyoWizardFadeIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes authyoWizardFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-18px); }
}

.authyo-wizard-step-header {
    margin-bottom: 24px;
}

.authyo-wizard-step-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 8px;
    line-height: 1.3;
}

.authyo-wizard-step-header p {
    font-size: 14px;
    color: #646970;
    margin: 0;
    line-height: 1.6;
}

/* ---------------------------------------------------------------
   Provider Cards (Step 1)
--------------------------------------------------------------- */
.authyo-wizard-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.authyo-wizard-provider-card {
    cursor: pointer;
    display: block;
}

.authyo-wizard-provider-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.authyo-wizard-provider-inner {
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    padding: 16px 14px;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
}

.authyo-wizard-provider-card:hover .authyo-wizard-provider-inner {
    border-color: #2271b1;
    background: #f0f6fc;
}

.authyo-wizard-provider-card input[type="radio"]:checked + .authyo-wizard-provider-inner {
    border-color: #2271b1;
    background: #f0f6fc;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.authyo-wizard-provider-icon {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: #2271b1;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    letter-spacing: 0;
}

.authyo-wizard-provider-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
    line-height: 1.3;
}

.authyo-wizard-provider-desc {
    font-size: 11px;
    color: #646970;
    line-height: 1.4;
}

/* Model select (appears when provider selected) */
.authyo-wizard-model-row {
    margin-top: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.authyo-wizard-model-row label {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    white-space: nowrap;
}

.authyo-wizard-model-row select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    color: #1d2327;
}

/* ---------------------------------------------------------------
   Form Fields
--------------------------------------------------------------- */
.authyo-wizard-field {
    margin-bottom: 20px;
}

.authyo-wizard-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 6px;
}

.authyo-wizard-input,
.authyo-wizard-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.authyo-wizard-input:focus,
.authyo-wizard-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.authyo-wizard-textarea {
    resize: vertical;
    line-height: 1.6;
}

.authyo-wizard-hint {
    font-size: 12px;
    color: #646970;
    margin: 6px 0 0;
    line-height: 1.5;
}

.authyo-wizard-hint a {
    color: #2271b1;
}

/* API Key row */
.authyo-wizard-api-key-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.authyo-wizard-api-key-row .authyo-wizard-input {
    flex: 1;
}

.authyo-wizard-key-set {
    font-size: 12px;
    color: #00a32a;
    margin: 6px 0 0;
    font-weight: 500;
}

/* Test connection */
.authyo-wizard-test-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.authyo-wizard-test-result {
    font-size: 13px;
    font-weight: 500;
}

.authyo-wizard-test-result.success {
    color: #00a32a;
}

.authyo-wizard-test-result.error {
    color: #d63638;
}

/* ---------------------------------------------------------------
   KB Tabs (Step 3)
--------------------------------------------------------------- */
.authyo-wizard-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.authyo-wizard-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #646970;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.authyo-wizard-tab:hover {
    color: #2271b1;
}

.authyo-wizard-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.authyo-wizard-tab-panel {
    display: none;
}

.authyo-wizard-tab-panel.active {
    display: block;
}

.authyo-wizard-optional-note {
    font-size: 13px;
    color: #646970;
    font-style: italic;
    margin-bottom: 16px;
}

/* ---------------------------------------------------------------
   Widget Toggle (Step 5)
--------------------------------------------------------------- */
.authyo-wizard-enable-row {
    background: #f6f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 24px;
}

.authyo-wizard-toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
}

.authyo-wizard-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom toggle switch */
.authyo-wizard-toggle-switch {
    width: 44px;
    height: 24px;
    background: #c3c4c7;
    border-radius: 12px;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s ease;
    margin-top: 2px;
}

.authyo-wizard-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.authyo-wizard-toggle-label input[type="checkbox"]:checked ~ .authyo-wizard-toggle-switch {
    background: #2271b1;
}

.authyo-wizard-toggle-label input[type="checkbox"]:checked ~ .authyo-wizard-toggle-switch::after {
    transform: translateX(20px);
}

.authyo-wizard-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.authyo-wizard-toggle-text strong {
    font-size: 14px;
    color: #1d2327;
}

.authyo-wizard-toggle-text span {
    font-size: 13px;
    color: #646970;
}

/* ---------------------------------------------------------------
   Summary (Step 5)
--------------------------------------------------------------- */
.authyo-wizard-summary {
    background: #f0f6fc;
    border: 1px solid #c3d5e8;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.authyo-wizard-summary h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.authyo-wizard-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.authyo-wizard-summary-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
}

.authyo-wizard-summary-label {
    font-weight: 600;
    color: #1d2327;
    white-space: nowrap;
    min-width: 140px;
    flex-shrink: 0;
}

.authyo-wizard-summary-label::after {
    content: ':';
}

.authyo-wizard-summary-value {
    color: #646970;
    word-break: break-all;
}

/* ---------------------------------------------------------------
   Validation Error
--------------------------------------------------------------- */
.authyo-wizard-validation {
    background: #fcf0f1;
    border: 1px solid #d63638;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    color: #d63638;
    margin-bottom: 16px;
    font-weight: 500;
}

/* ---------------------------------------------------------------
   Navigation Actions
--------------------------------------------------------------- */
.authyo-wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f1;
}

/* Override WP default button styles */
.authyo-wizard-actions .button {
    height: 38px;
    line-height: 36px;
    padding: 0 20px;
    font-size: 14px;
    border-radius: 4px;
}

.authyo-wizard-actions .button-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    font-weight: 600;
}

.authyo-wizard-actions .button-primary:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

/* Finish Setup = green */
.authyo-wizard-finish-btn {
    background: #00a32a !important;
    border-color: #00a32a !important;
    color: #fff !important;
    font-weight: 600 !important;
    height: 38px;
    line-height: 36px;
    padding: 0 24px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.authyo-wizard-finish-btn:hover:not(:disabled) {
    background: #008a20 !important;
    border-color: #008a20 !important;
}

.authyo-wizard-finish-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------
   Admin Notice Banner
--------------------------------------------------------------- */
.authyo-wizard-notice p {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
    font-size: 14px;
}

/* ---------------------------------------------------------------
   Responsive
--------------------------------------------------------------- */
@media screen and (max-width: 640px) {
    .authyo-wizard-wrap {
        margin: 16px auto;
        padding: 0 8px 40px;
    }

    .authyo-wizard-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .authyo-wizard-step {
        padding: 24px 20px;
    }

    .authyo-wizard-provider-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .authyo-wizard-provider-inner {
        padding: 12px 10px;
    }

    .authyo-wizard-provider-icon {
        width: 36px;
        height: 36px;
        font-size: 10px;
    }

    .authyo-wizard-progress-label {
        display: none;
    }

    .authyo-wizard-progress-dot {
        width: 30px;
        height: 30px;
    }

    .authyo-wizard-actions .button {
        padding: 0 14px;
        font-size: 13px;
    }

    .authyo-wizard-summary-label {
        min-width: 100px;
    }

    .authyo-wizard-summary-list li {
        flex-direction: column;
        gap: 2px;
    }

    .authyo-wizard-model-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .authyo-wizard-model-row select {
        width: 100%;
    }

    .authyo-wizard-test-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media screen and (max-width: 400px) {
    .authyo-wizard-provider-grid {
        grid-template-columns: 1fr 1fr;
    }
}
