/**
 * Inqyra Setup Wizard Styles
 *
 * @package Inqyra
 */

/* Hide WP sidebar and admin bar padding on wizard page */
body.admin_page_inqyra-wizard #adminmenumain,
body.admin_page_inqyra-wizard #adminmenuback,
body.admin_page_inqyra-wizard #adminmenuwrap {
    display: none;
}

body.admin_page_inqyra-wizard #wpcontent {
    margin-left: 0;
}

body.admin_page_inqyra-wizard .notice,
body.admin_page_inqyra-wizard .updated,
body.admin_page_inqyra-wizard .update-nag,
body.admin_page_inqyra-wizard .error:not(.inqyra-wizard-validation) {
    display: none !important;
}

/* Wizard Wrapper */
.inqyra-wizard-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header */
.inqyra-wizard-header {
    text-align: center;
    padding: 30px 0 20px;
    position: relative;
}

.inqyra-wizard-close {
    position: absolute;
    top: 30px;
    right: 0;
    text-decoration: none;
    color: #646970;
    transition: color 0.15s;
}

.inqyra-wizard-close:hover {
    color: #d63638;
}

.inqyra-wizard-close .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.inqyra-wizard-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.inqyra-wizard-logo .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #5B7FFF;
}

.inqyra-wizard-logo h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
}

/* Step Indicator */
.inqyra-wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
    max-width: 600px;
}

.inqyra-wizard-step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.inqyra-wizard-step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f1;
    border: 2px solid #c3c4c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #646970;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.inqyra-wizard-step-dot.active {
    background: #5B7FFF;
    border-color: #5B7FFF;
    color: #fff;
    box-shadow: 0 2px 8px rgba(91, 127, 255, 0.4);
}

.inqyra-wizard-step-dot.completed {
    background: #00a32a;
    border-color: #00a32a;
    color: #fff;
}

.inqyra-wizard-step-dot.completed::after {
    content: '\2713';
    font-size: 16px;
}

.inqyra-wizard-step-dot.completed span {
    display: none;
}

.inqyra-wizard-step-line {
    width: 50px;
    height: 2px;
    background: #c3c4c7;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.inqyra-wizard-step-line.completed {
    background: #00a32a;
}

/* Content Area */
.inqyra-wizard-content {
    min-height: 400px;
    margin-bottom: 20px;
}

.inqyra-wizard-step {
    display: none;
    animation: wizardFadeIn 0.3s ease;
}

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

@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.inqyra-wizard-step-title {
    font-size: 22px;
    font-weight: 600;
    color: #1d2327;
    margin: 25px 0 8px;
}

.inqyra-wizard-step-description {
    color: #646970;
    font-size: 14px;
    margin-bottom: 25px;
    line-height: 1.6;
}

/* Wizard Cards */
.inqyra-wizard-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.inqyra-wizard-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Provider Cards */
.inqyra-provider-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.inqyra-provider-card {
    border: 2px solid #c3c4c7;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    position: relative;
}

.inqyra-provider-card:hover {
    border-color: #5B7FFF;
    background: #f8f9ff;
}

.inqyra-provider-card.selected {
    border-color: #5B7FFF;
    background: #f0f3ff;
    box-shadow: 0 0 0 1px #5B7FFF;
}

.inqyra-provider-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.inqyra-provider-card.locked::after {
    content: '\f160';
    font-family: dashicons;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #646970;
    font-size: 16px;
}

.inqyra-provider-card .provider-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.inqyra-provider-card .provider-desc {
    font-size: 12px;
    color: #646970;
}

.inqyra-provider-card .provider-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #5B7FFF;
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

/* Form Elements */
.inqyra-wizard-field {
    margin-bottom: 20px;
}

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

.inqyra-wizard-field .description {
    color: #646970;
    font-size: 12px;
    margin-top: 4px;
}

.inqyra-wizard-field input[type="text"],
.inqyra-wizard-field input[type="password"],
.inqyra-wizard-field input[type="number"],
.inqyra-wizard-field textarea,
.inqyra-wizard-field select {
    width: 100%;
    max-width: 100%;
}

.inqyra-wizard-field .regular-text {
    width: 100%;
}

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

.inqyra-wizard-api-key-wrap input {
    flex: 1;
}

.inqyra-wizard-api-key-wrap .inqyra-toggle-visibility {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px !important;
    min-width: 36px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #f0f0f1;
    cursor: pointer;
    color: #50575e;
    margin-left: 0 !important;
}

.inqyra-wizard-api-key-wrap .inqyra-toggle-visibility:hover {
    background: #e0e0e0;
    color: #1d2327;
}

.inqyra-wizard-api-key-wrap .inqyra-toggle-visibility .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Validation Status */
.inqyra-wizard-validation {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 13px;
}

.inqyra-wizard-validation.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.inqyra-wizard-validation.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.inqyra-wizard-validation .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* License Features */
.inqyra-wizard-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.inqyra-wizard-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.inqyra-wizard-feature .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.inqyra-wizard-feature .dashicons-yes-alt {
    color: #00a32a;
}

.inqyra-wizard-feature .dashicons-dismiss {
    color: #c3c4c7;
}

/* Prompt Builder */
.inqyra-prompt-builder { margin-bottom: 12px; }
.inqyra-prompt-builder-toggle { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.inqyra-prompt-builder-toggle .dashicons { margin-right: 4px; vertical-align: text-bottom; }

.inqyra-prompt-builder-cta {
    align-items: flex-start;
    padding: 12px 16px;
    background: #f0f3ff;
    border: 1px solid #c7d4ff;
    border-radius: 6px;
}

.inqyra-prompt-builder-cta div {
    font-size: 13px;
    color: #1d2327;
    line-height: 1.5;
}

.inqyra-prompt-builder-cta button {
    flex-shrink: 0;
}

.inqyra-prompt-builder-chat {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    margin-bottom: 12px;
    overflow: hidden;
}

.inqyra-prompt-builder-messages {
    max-height: 350px;
    overflow-y: auto;
    padding: 16px;
}

.inqyra-pb-message { margin-bottom: 12px; display: flex; }
.inqyra-pb-message-user { justify-content: flex-end; }
.inqyra-pb-message-assistant { justify-content: flex-start; }

.inqyra-pb-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 13px;
    white-space: pre-wrap;
}
.inqyra-pb-message-user .inqyra-pb-bubble {
    background: #5B7FFF;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.inqyra-pb-message-assistant .inqyra-pb-bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.inqyra-prompt-builder-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #ddd;
    background: #fff;
    align-items: flex-end;
}
.inqyra-prompt-builder-input textarea {
    flex: 1;
    resize: none;
    overflow: hidden;
    min-height: 36px;
    max-height: 150px;
    line-height: 1.5;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
}

.inqyra-prompt-builder-actions {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

@keyframes inqyra-highlight {
    0% { box-shadow: 0 0 0 3px rgba(91, 127, 255, 0.5); }
    100% { box-shadow: none; }
}
.inqyra-prompt-highlight {
    animation: inqyra-highlight 1.5s ease-out;
}

/* Advanced Settings Toggle */
.inqyra-wizard-advanced-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #5B7FFF;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 15px;
    border: none;
    background: none;
    padding: 0;
}

.inqyra-wizard-advanced-toggle .dashicons {
    transition: transform 0.2s;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.inqyra-wizard-advanced-toggle.open .dashicons {
    transform: rotate(90deg);
}

.inqyra-wizard-advanced-content {
    display: none;
    padding: 15px;
    background: #f6f7f7;
    border-radius: 6px;
    margin-bottom: 15px;
}

.inqyra-wizard-advanced-content.visible {
    display: block;
}

/* Widget Preview */
.inqyra-wizard-preview-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.inqyra-wizard-preview-container {
    background: #f5f5f5;
    border-radius: 8px;
    min-height: 450px;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
}

.inqyra-wizard-preview-widget {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
}

/* Widget CSS overrides for wizard preview context */
.inqyra-wizard-preview-widget .inqyra-widget {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: auto !important;
}

.inqyra-wizard-preview-widget .inqyra-container {
    position: absolute !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    box-shadow: none !important;
    animation: none !important;
    border-radius: 12px !important;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-bottom-right .inqyra-container,
.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-bottom-left .inqyra-container {
    bottom: 65px;
    top: 10px;
    right: 10px;
    left: 10px;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-top-right .inqyra-container,
.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-top-left .inqyra-container {
    top: 65px;
    bottom: 10px;
    right: 10px;
    left: 10px;
}

.inqyra-wizard-preview-widget .inqyra-toggle {
    position: absolute !important;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-bottom-right .inqyra-toggle {
    bottom: 12px;
    right: 12px;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-bottom-left .inqyra-toggle {
    bottom: 12px;
    left: 12px;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-top-right .inqyra-toggle {
    top: 12px;
    right: 12px;
}

.inqyra-wizard-preview-widget .inqyra-widget.inqyra-position-top-left .inqyra-toggle {
    top: 12px;
    left: 12px;
}

.inqyra-wizard-preview-widget .inqyra-messages {
    min-height: 80px;
}

.inqyra-wizard-preview-widget .inqyra-message {
    animation: none !important;
}

/* Color Picker in Wizard */
.inqyra-wizard-color-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inqyra-wizard-color-field input[type="color"] {
    width: 40px;
    height: 32px;
    padding: 2px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    cursor: pointer;
}

.inqyra-wizard-color-field input[type="text"] {
    width: 80px !important;
    font-family: monospace;
}

/* Position Selector */
.inqyra-wizard-position-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 250px;
}

.inqyra-wizard-position-option {
    border: 2px solid #c3c4c7;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    background: #fff;
}

.inqyra-wizard-position-option:hover {
    border-color: #5B7FFF;
}

.inqyra-wizard-position-option.selected {
    border-color: #5B7FFF;
    background: #f0f3ff;
}

/* Crawl Config */
.inqyra-wizard-checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.inqyra-wizard-checkbox-grid label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

/* Crawl Progress */
.inqyra-wizard-progress {
    margin-top: 20px;
}

.inqyra-wizard-progress-bar {
    height: 12px;
    background: #f0f0f1;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.inqyra-wizard-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5B7FFF 0%, #7b9bff 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.inqyra-wizard-progress-text {
    font-size: 13px;
    color: #646970;
}

/* Crawl/Embedding Summary */
.inqyra-wizard-summary {
    display: flex;
    gap: 20px;
    padding: 16px;
    background: #d4edda;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin-top: 15px;
}

.inqyra-wizard-summary-item {
    text-align: center;
}

.inqyra-wizard-summary-item .value {
    font-size: 24px;
    font-weight: 700;
    color: #155724;
}

.inqyra-wizard-summary-item .label {
    font-size: 12px;
    color: #155724;
}

/* Checklist */
.inqyra-wizard-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.inqyra-wizard-checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
    font-size: 14px;
}

.inqyra-wizard-checklist li:last-child {
    border-bottom: none;
}

.inqyra-wizard-checklist .dashicons-yes-alt {
    color: #00a32a;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.inqyra-wizard-checklist .dashicons-clock {
    color: #dba617;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.inqyra-wizard-checklist .check-label {
    font-weight: 500;
    min-width: 100px;
}

.inqyra-wizard-checklist .check-value {
    color: #646970;
}

/* Test Chat Container - uses shared widget CSS classes */
.inqyra-wizard-test-chat {
    margin-top: 20px;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    overflow: hidden;
    height: 450px;
}

.inqyra-wizard-test-chat .inqyra-widget {
    position: relative !important;
    z-index: auto !important;
    height: 100%;
}

.inqyra-wizard-test-chat .inqyra-container {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    display: flex !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    animation: none !important;
}

/* Footer */
.inqyra-wizard-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #c3c4c7;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    border-radius: 0 0 8px 8px;
    margin: 0 -20px;
    margin-top: auto;
}

.inqyra-wizard-footer-left {
    display: flex;
    gap: 8px;
}

.inqyra-wizard-footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inqyra-wizard-footer .spinner {
    float: none;
    margin: 0;
}

/* Button Styles */
.inqyra-wizard-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.inqyra-wizard-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.inqyra-wizard-btn-primary {
    background: #5B7FFF;
    color: #fff;
    border-color: #5B7FFF;
}

.inqyra-wizard-btn-primary:hover:not(:disabled) {
    background: #4a6ee0;
    border-color: #4a6ee0;
    color: #fff;
}

.inqyra-wizard-btn-secondary {
    background: #f0f0f1;
    color: #1d2327;
    border-color: #c3c4c7;
}

.inqyra-wizard-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.inqyra-wizard-btn-text {
    background: none;
    color: #646970;
    border: none;
    padding: 8px 12px;
}

.inqyra-wizard-btn-text:hover:not(:disabled) {
    color: #1d2327;
}

.inqyra-wizard-btn-success {
    background: #00a32a;
    color: #fff;
    border-color: #00a32a;
}

.inqyra-wizard-btn-success:hover:not(:disabled) {
    background: #008a20;
    border-color: #008a20;
    color: #fff;
}

/* Inline spinner */
.inqyra-wizard-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #c3c4c7;
    border-top-color: #5B7FFF;
    border-radius: 50%;
    animation: wizardSpin 0.8s linear infinite;
}

.inqyra-wizard-spinner.active {
    display: inline-block;
}

@keyframes wizardSpin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media screen and (max-width: 782px) {
    .inqyra-wizard-wrap {
        padding: 10px;
    }

    .inqyra-wizard-steps {
        max-width: 100%;
    }

    .inqyra-wizard-step-line {
        width: 24px;
    }

    .inqyra-wizard-step-dot {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .inqyra-provider-cards {
        grid-template-columns: 1fr;
    }

    .inqyra-wizard-preview-layout {
        grid-template-columns: 1fr;
    }

    .inqyra-wizard-preview-container {
        min-height: 350px;
    }

    .inqyra-wizard-features {
        grid-template-columns: 1fr;
    }

    .inqyra-wizard-footer {
        flex-direction: column;
        gap: 10px;
    }

    .inqyra-wizard-footer-left,
    .inqyra-wizard-footer-right {
        width: 100%;
        justify-content: center;
    }

    .inqyra-wizard-summary {
        flex-wrap: wrap;
    }

    .inqyra-wizard-position-grid {
        max-width: 100%;
    }
}

/* Refresh models link */
.inqyra-refresh-models-link {
    text-decoration: none;
    font-size: 13px;
}

.inqyra-refresh-models-link .dashicons {
    transition: transform 0.3s;
}

.inqyra-refresh-models-link .dashicons.spin {
    animation: inqyra-spin 1s linear infinite;
}

@keyframes inqyra-spin {
    100% { transform: rotate(360deg); }
}
