/* ============================================================================
   WooAI Elementor Widgets — Premium Design System
   ============================================================================
   Matches the chat.css design language: clean, modern, micro-animations.
   Uses BEM naming: .wooai-{widget}__{element}--{modifier}
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;500;600;700&display=swap');

/* ── Shared Variables ── */
.wooai-search,
.wooai-qa,
.wooai-tryon {
    --w-primary: #2563eb;
    --w-primary-hover: #1d4ed8;
    --w-primary-light: rgba(37, 99, 235, 0.08);
    --w-bg: #ffffff;
    --w-bg-alt: #f8fafc;
    --w-text: #1e293b;
    --w-text-secondary: #64748b;
    --w-text-muted: #94a3b8;
    --w-border: #e2e8f0;
    --w-border-light: #f1f5f9;
    --w-radius-sm: 8px;
    --w-radius: 12px;
    --w-radius-lg: 16px;
    --w-radius-xl: 20px;
    --w-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --w-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --w-shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    --w-shadow-xl: 0 20px 40px -8px rgba(0,0,0,0.12);
    --w-transition: 0.2s ease;
    --w-transition-slow: 0.3s ease;
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================================
   SMART SEARCH WIDGET
   ============================================================================ */
.wooai-search {
    position: relative;
    width: 100%;
}

.wooai-search__wrap {
    position: relative;
    display: flex;
    align-items: center;
    transition: box-shadow var(--w-transition);
    border-radius: var(--w-radius);
}

.wooai-search__wrap:focus-within {
    box-shadow: var(--w-shadow);
}

.wooai-search__icon {
    position: absolute;
    left: 16px;
    color: var(--w-text-muted);
    pointer-events: none;
    z-index: 1;
    display: flex;
    transition: color var(--w-transition);
}

.wooai-search__wrap:focus-within .wooai-search__icon {
    color: var(--w-primary);
}

.wooai-search__input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 48px;
    border: 1.5px solid var(--w-border);
    border-radius: var(--w-radius);
    font-size: 15px;
    font-weight: 500;
    color: var(--w-text);
    background: var(--w-bg);
    outline: none;
    transition: all var(--w-transition);
    font-family: inherit;
}

.wooai-search__input::placeholder {
    color: var(--w-text-muted);
    font-weight: 400;
}

.wooai-search__input:focus {
    border-color: var(--w-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wooai-search__shortcut {
    position: absolute;
    right: 16px;
    pointer-events: none;
}

.wooai-search__shortcut kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: var(--w-bg-alt);
    border: 1px solid var(--w-border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--w-text-muted);
    font-family: inherit;
}

/* Results Dropdown */
.wooai-search__results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--w-bg);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-lg);
    box-shadow: var(--w-shadow-xl);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
    animation: wooai-dropdown-in 0.2s ease;
}

@keyframes wooai-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.wooai-search__results::-webkit-scrollbar { width: 6px; }
.wooai-search__results::-webkit-scrollbar-track { background: transparent; }
.wooai-search__results::-webkit-scrollbar-thumb { background: var(--w-border); border-radius: 99px; }

.wooai-search__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    text-decoration: none;
    border-bottom: 1px solid var(--w-border-light);
    cursor: pointer;
    transition: background var(--w-transition);
}

.wooai-search__item:last-child { border-bottom: none; }
.wooai-search__item:hover { background: var(--w-bg-alt); }

.wooai-search__item-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--w-radius-sm);
    flex-shrink: 0;
    border: 1px solid var(--w-border-light);
}

.wooai-search__item-info { flex: 1; min-width: 0; }

.wooai-search__item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--w-text);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wooai-search__item-price {
    font-weight: 600;
    font-size: 14px;
    color: var(--w-primary);
}

.wooai-search__item-rating {
    font-size: 12px;
    color: #f59e0b;
    margin-top: 2px;
}

.wooai-search__loading,
.wooai-search__empty {
    padding: 24px;
    text-align: center;
    color: var(--w-text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================================
   PRODUCT Q&A WIDGET
   ============================================================================ */
.wooai-qa {
    width: 100%;
    background: var(--w-bg);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-lg);
    padding: 24px;
    transition: box-shadow var(--w-transition-slow);
}

.wooai-qa:hover {
    box-shadow: var(--w-shadow);
}

/* Card layout */
.wooai-qa--card { /* default */ }

/* Inline layout */
.wooai-qa--inline {
    border: none;
    padding: 0;
    background: transparent;
}

.wooai-qa--inline:hover { box-shadow: none; }

/* Minimal layout */
.wooai-qa--minimal {
    border: none;
    padding: 0;
    background: transparent;
}

.wooai-qa--minimal:hover { box-shadow: none; }

/* Header */
.wooai-qa__header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.wooai-qa__icon {
    width: 40px;
    height: 40px;
    background: var(--w-primary-light);
    border-radius: var(--w-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--w-primary);
    flex-shrink: 0;
}

.wooai-qa__header-text { flex: 1; }

.wooai-qa__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--w-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.wooai-qa__subtitle {
    font-size: 13px;
    color: var(--w-text-secondary);
    margin: 0;
    font-weight: 500;
    line-height: 1.4;
}

/* Form */
.wooai-qa__form { margin-bottom: 16px; }

.wooai-qa__input-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.wooai-qa__input {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid var(--w-border);
    border-radius: var(--w-radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--w-text);
    background: var(--w-bg-alt);
    outline: none;
    transition: all var(--w-transition);
    font-family: inherit;
}

.wooai-qa__input::placeholder {
    color: var(--w-text-muted);
    font-weight: 400;
}

.wooai-qa__input:focus {
    border-color: var(--w-primary);
    background: var(--w-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wooai-qa__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    height: 48px;
    background: var(--w-primary);
    color: #fff;
    border: none;
    border-radius: var(--w-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--w-transition);
    white-space: nowrap;
    font-family: inherit;
}

.wooai-qa__btn:hover {
    background: var(--w-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--w-shadow);
}

.wooai-qa__btn:active { transform: translateY(0); }

.wooai-qa__btn-icon { flex-shrink: 0; }

/* Suggestion Chips */
.wooai-qa__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.wooai-qa__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--w-bg-alt);
    border: 1px solid var(--w-border);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 500;
    color: var(--w-text-secondary);
    cursor: pointer;
    transition: all var(--w-transition);
    font-family: inherit;
    white-space: nowrap;
}

.wooai-qa__chip:hover {
    background: var(--w-primary-light);
    border-color: var(--w-primary);
    color: var(--w-primary);
    transform: translateY(-1px);
}

.wooai-qa__chip:active { transform: translateY(0); }

.wooai-qa__chip svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* Powered by badge */
.wooai-qa__badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--w-text-muted);
    margin-top: 4px;
}

/* ============================================================================
   VIRTUAL TRY-ON WIDGET
   ============================================================================ */
.wooai-tryon { width: 100%; }

/* Trigger Button */
.wooai-tryon__trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--w-primary);
    color: #fff;
    border: none;
    border-radius: var(--w-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--w-transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.wooai-tryon__trigger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.wooai-tryon__trigger:hover {
    background: var(--w-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--w-shadow-lg);
}

.wooai-tryon__trigger:active { transform: translateY(0); }

.wooai-tryon__trigger svg { flex-shrink: 0; }

/* Modal Overlay */
.wooai-tryon__overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 24px;
    animation: wooai-fade-in 0.25s ease;
}

@keyframes wooai-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Panel */
.wooai-tryon__panel {
    background: var(--w-bg);
    border-radius: var(--w-radius-xl);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--w-shadow-xl);
    animation: wooai-panel-in 0.3s ease;
}

@keyframes wooai-panel-in {
    from { opacity: 0; transform: scale(0.95) translateY(16px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.wooai-tryon__panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 24px 0;
    gap: 16px;
}

.wooai-tryon__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--w-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.wooai-tryon__desc {
    font-size: 14px;
    color: var(--w-text-secondary);
    margin: 0;
    font-weight: 500;
    line-height: 1.5;
}

.wooai-tryon__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--w-radius-sm);
    color: var(--w-text-muted);
    cursor: pointer;
    transition: all var(--w-transition);
    flex-shrink: 0;
}

.wooai-tryon__close:hover {
    background: var(--w-bg-alt);
    color: var(--w-text);
}

/* Body */
.wooai-tryon__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Dropzone */
.wooai-tryon__drop {
    border: 2px dashed var(--w-border);
    border-radius: var(--w-radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--w-transition);
    background: var(--w-bg-alt);
    position: relative;
}

.wooai-tryon__drop:hover,
.wooai-tryon__drop.dragover {
    border-color: var(--w-primary);
    background: rgba(37, 99, 235, 0.04);
}

.wooai-tryon__drop-icon {
    color: var(--w-text-muted);
    margin-bottom: 16px;
    transition: color var(--w-transition);
}

.wooai-tryon__drop:hover .wooai-tryon__drop-icon {
    color: var(--w-primary);
}

.wooai-tryon__drop-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--w-text);
    margin: 0 0 6px;
}

.wooai-tryon__drop-hint {
    font-size: 13px;
    color: var(--w-text-muted);
    margin: 0;
    font-weight: 500;
}

.wooai-tryon__file {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Result */
.wooai-tryon__result {
    min-height: 200px;
}

.wooai-tryon__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.wooai-tryon__loading p {
    font-size: 14px;
    color: var(--w-text-secondary);
    font-weight: 500;
    margin: 0;
}

.wooai-tryon__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--w-border);
    border-top-color: var(--w-primary);
    border-radius: 50%;
    animation: wooai-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.wooai-tryon__result-content img {
    max-width: 100%;
    border-radius: var(--w-radius);
}

.wooai-tryon__result-desc {
    font-size: 14px;
    line-height: 1.7;
    color: var(--w-text-secondary);
    margin-top: 16px;
    font-weight: 500;
}

/* Action Buttons */
.wooai-tryon__actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--w-border-light);
}

.wooai-tryon__action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--w-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--w-transition);
    font-family: inherit;
    border: none;
}

.wooai-tryon__action--primary {
    background: var(--w-primary);
    color: #fff;
}

.wooai-tryon__action--primary:hover {
    background: var(--w-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--w-shadow);
}

.wooai-tryon__action--secondary {
    background: var(--w-bg-alt);
    color: var(--w-text);
    border: 1px solid var(--w-border);
}

.wooai-tryon__action--secondary:hover {
    background: var(--w-border-light);
}

.wooai-tryon__action:active { transform: translateY(0); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 640px) {
    .wooai-qa__input-wrap { flex-direction: column; }
    .wooai-qa__btn { width: 100%; justify-content: center; }
    .wooai-qa__chips { gap: 6px; }
    .wooai-qa__chip { font-size: 12px; padding: 6px 12px; }

    .wooai-tryon__panel {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .wooai-tryon__overlay { padding: 0; }
    .wooai-tryon__actions { flex-direction: column; }
}
