/**
 * AI Product Wizard — Styles
 * Charte Effi-Market : #1b1a41
 *
 * @package DokanIntegration
 * @since 1.4.0
 */

/* =========================================
   Trigger Button (above product form)
   ========================================= */

.dokan-ai-wizard-trigger-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 20px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f0eef8 0%, #e8e5f5 100%);
    border: 1px solid #c9c4e0;
    border-radius: 8px;
}

.dokan-ai-wizard-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    white-space: nowrap;
    border-radius: 6px !important;
    background: #1b1a41 !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(27, 26, 65, 0.3);
}

.dokan-ai-wizard-btn:hover {
    background: #2d2b5e !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 26, 65, 0.4);
}

.dokan-ai-wizard-btn svg {
    flex-shrink: 0;
}

.dokan-ai-wizard-subtitle {
    font-size: 13px;
    color: #5a5680;
    line-height: 1.4;
}

/* =========================================
   Modal Overlay
   ========================================= */

.dokan-ai-wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(27, 26, 65, 0.6);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

body.dokan-ai-wizard-open {
    overflow: hidden;
}

.dokan-ai-wizard-modal {
    position: relative;
    width: 95%;
    max-width: 640px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(27, 26, 65, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =========================================
   Header
   ========================================= */

.dokan-ai-wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e8e5f5;
    background: #1b1a41;
    color: #fff;
}

.dokan-ai-wizard-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dokan-ai-wizard-header-left svg {
    color: #f0c866;
    stroke: #f0c866;
}

.dokan-ai-wizard-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.dokan-ai-wizard-close {
    background: none;
    border: none;
    font-size: 26px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.dokan-ai-wizard-close:hover {
    color: #fff;
}

/* =========================================
   Progress Bar
   ========================================= */

.dokan-ai-wizard-progress {
    height: 3px;
    background: #e2e0ef;
    overflow: hidden;
}

.dokan-ai-wizard-progress-bar {
    height: 100%;
    background: #1b1a41;
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

.dokan-ai-wizard-step-indicator {
    padding: 10px 24px;
    font-size: 12px;
    color: #6b6593;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #faf9fe;
    border-bottom: 1px solid #f0eef8;
}

/* =========================================
   Form Fields
   ========================================= */

.dokan-ai-wizard-form {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.dokan-ai-wizard-field {
    margin-bottom: 16px;
}

.dokan-ai-wizard-field:last-child {
    margin-bottom: 0;
}

.dokan-ai-wizard-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #1b1a41;
}

.dokan-ai-wizard-field label .required {
    color: #e74c3c;
}

.dokan-ai-wizard-field input[type="text"],
.dokan-ai-wizard-field textarea,
.dokan-ai-wizard-field select {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border: 1.5px solid #d1cee3;
    border-radius: 6px;
    background: #fff;
    color: #1b1a41;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.dokan-ai-wizard-field input:focus,
.dokan-ai-wizard-field textarea:focus,
.dokan-ai-wizard-field select:focus {
    border-color: #1b1a41;
    box-shadow: 0 0 0 3px rgba(27, 26, 65, 0.1);
    outline: none;
}

.dokan-ai-wizard-field textarea {
    resize: vertical;
    min-height: 56px;
}

.dokan-ai-wizard-hint {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #9994b3;
    line-height: 1.4;
}

.dokan-ai-wizard-field-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

/* Row layout */
.dokan-ai-wizard-row {
    display: flex;
    gap: 12px;
}

.dokan-ai-wizard-half {
    flex: 1;
}

/* Select2 category in wizard */
.dokan-ai-wizard-field .select2-container--default .select2-selection--single {
    height: 38px;
    padding: 4px 12px;
    font-size: 13px;
    border: 1.5px solid #d1cee3;
    border-radius: 6px;
    background: #fff;
    color: #1b1a41;
}

.dokan-ai-wizard-field .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    color: #1b1a41;
    padding-left: 0;
}

.dokan-ai-wizard-field .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.dokan-ai-wizard-field .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9994b3;
}

.dokan-ai-wizard-field .select2-container--default.select2-container--open .select2-selection--single {
    border-color: #1b1a41;
    box-shadow: 0 0 0 3px rgba(27, 26, 65, 0.1);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #1b1a41 !important;
}

/* Step intro */
.dokan-ai-wizard-step-intro {
    margin: 0 0 14px;
    padding: 9px 12px;
    font-size: 12px;
    color: #6b6593;
    background: #faf9fe;
    border-radius: 6px;
    border-left: 3px solid #1b1a41;
}

/* Prompt preview (step 2) */
.dokan-ai-wizard-prompt-intro {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 14px;
    font-size: 12px;
    color: #6b6593;
    background: #faf9fe;
    border-radius: 6px;
    border-left: 3px solid #1b1a41;
    line-height: 1.5;
}

.dokan-ai-wizard-prompt-intro svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #1b1a41;
    stroke: #1b1a41;
}

.dokan-ai-wizard-prompt-textarea {
    width: 100%;
    min-height: 300px;
    padding: 14px 16px;
    font-size: 12.5px;
    font-family: 'Courier New', Consolas, monospace;
    line-height: 1.6;
    border: 1.5px solid #d1cee3;
    border-radius: 6px;
    background: #fff;
    color: #1b1a41;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dokan-ai-wizard-prompt-textarea:focus {
    border-color: #1b1a41;
    box-shadow: 0 0 0 3px rgba(27, 26, 65, 0.1);
    outline: none;
}

/* =========================================
   Loading State
   ========================================= */

.dokan-ai-wizard-loading {
    padding: 50px 24px;
    text-align: center;
    flex: 1;
}

.dokan-ai-wizard-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e0ef;
    border-top-color: #1b1a41;
    border-radius: 50%;
    margin: 0 auto 18px;
    animation: ai-wizard-spin 0.8s linear infinite;
}

@keyframes ai-wizard-spin {
    to { transform: rotate(360deg); }
}

.dokan-ai-wizard-loading p {
    font-size: 15px;
    font-weight: 600;
    color: #1b1a41;
    margin: 0 0 6px;
}

.dokan-ai-wizard-loading-sub {
    font-size: 12px;
    color: #9994b3;
}

/* =========================================
   Results Preview
   ========================================= */

.dokan-ai-wizard-result {
    padding: 18px 24px;
    overflow-y: auto;
    flex: 1;
    max-height: 60vh;
}

.dokan-ai-wizard-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dokan-ai-wizard-result-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1b1a41;
}

.dokan-ai-wizard-result-badge {
    font-size: 10px;
    font-weight: 700;
    color: #1b1a41;
    background: #f0eef8;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dokan-ai-wizard-result-field {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0eef8;
}

.dokan-ai-wizard-result-field:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dokan-ai-wizard-result-field > label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #6b6593;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.ai-result-value {
    font-size: 13px;
    color: #1b1a41;
    line-height: 1.6;
    background: #faf9fe;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e8e5f5;
}

.ai-result-value p {
    margin: 0 0 6px;
}

.ai-result-value p:last-child {
    margin-bottom: 0;
}

.ai-result-long {
    max-height: 180px;
    overflow-y: auto;
}

.ai-result-value h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1b1a41;
    margin: 10px 0 4px;
}

.ai-result-value h3:first-child {
    margin-top: 0;
}

.ai-result-value ul {
    margin: 4px 0;
    padding-left: 18px;
}

.ai-result-value li {
    margin-bottom: 2px;
}

/* =========================================
   Footer Buttons
   ========================================= */

.dokan-ai-wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid #e8e5f5;
    background: #faf9fe;
}

.dokan-ai-wizard-footer-right {
    display: flex;
    gap: 8px;
}

.dokan-ai-wizard-btn-prev {
    padding: 8px 18px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    background: #fff !important;
    border: 1.5px solid #d1cee3 !important;
    color: #1b1a41 !important;
}

.dokan-ai-wizard-btn-prev:hover {
    background: #faf9fe !important;
    border-color: #1b1a41 !important;
}

.dokan-ai-wizard-btn-next {
    padding: 8px 18px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    background: #1b1a41 !important;
    border: none !important;
    color: #fff !important;
}

.dokan-ai-wizard-btn-next:hover {
    background: #2d2b5e !important;
}

.dokan-ai-wizard-btn-generate {
    padding: 9px 22px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    background: #1b1a41 !important;
    border: none !important;
    color: #fff !important;
}

.dokan-ai-wizard-btn-generate:hover {
    background: #2d2b5e !important;
}

.dokan-ai-wizard-btn-apply {
    padding: 9px 22px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    background: #1b1a41 !important;
    border: none !important;
    color: #fff !important;
}

.dokan-ai-wizard-btn-apply:hover {
    background: #2d2b5e !important;
}

.dokan-ai-wizard-btn-regenerate {
    padding: 8px 14px !important;
    font-size: 12px !important;
    background: #fff !important;
    border: 1.5px solid #d1cee3 !important;
    color: #1b1a41 !important;
    border-radius: 6px !important;
}

.dokan-ai-wizard-btn-regenerate:hover {
    background: #faf9fe !important;
    border-color: #1b1a41 !important;
}

/* =========================================
   Notices
   ========================================= */

.dokan-ai-wizard-notice {
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.dokan-ai-wizard-notice-success {
    background: #ecfdf5;
    color: #065f46;
    border-bottom: 1px solid #a7f3d0;
}

.dokan-ai-wizard-notice-error {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fecaca;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 768px) {
    .dokan-ai-wizard-modal {
        width: 98%;
        max-height: 95vh;
        border-radius: 8px;
    }

    .dokan-ai-wizard-trigger-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .dokan-ai-wizard-subtitle {
        font-size: 12px;
    }

    .dokan-ai-wizard-form {
        padding: 14px;
    }

    .dokan-ai-wizard-row {
        flex-direction: column;
        gap: 0;
    }

    .dokan-ai-wizard-footer {
        flex-direction: column;
        gap: 10px;
    }

    .dokan-ai-wizard-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
}
