/* AI Trial Room — page layout & components */
.ai-trial-page {
    background: var(--theme-bg, #faf8f6);
    min-height: 60vh;
}

.ai-trial-hero {
    background: linear-gradient(135deg, #570210 0%, #8b2942 50%, #a83256 100%);
    color: #fff;
    padding: 2rem 0 2.5rem;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.ai-trial-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.ai-trial-hero .container {
    position: relative;
    z-index: 1;
}

.ai-trial-hero h1 {
    font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 0.5rem;
}

.ai-trial-hero-lead {
    opacity: 0.92;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    max-width: 540px;
}

.ai-trial-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Step progress */
.ai-trial-steps-bar {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 1.25rem 1rem;
    background: var(--theme-card, #fff);
    border-bottom: 1px solid rgba(87, 2, 16, 0.08);
    margin-bottom: 1.5rem;
}

.ai-trial-step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted, #9ca3af);
    font-size: 0.8rem;
    font-weight: 600;
    flex: 1;
    justify-content: center;
    max-width: 140px;
}

.ai-trial-step-item .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.ai-trial-step-item.active .step-num {
    background: linear-gradient(135deg, #570210, #8b2942);
    color: #fff;
    box-shadow: 0 2px 8px rgba(87, 2, 16, 0.35);
}

.ai-trial-step-item.active {
    color: #570210;
}

.ai-trial-step-item.done .step-num {
    background: #10b981;
    color: #fff;
}

.ai-trial-step-item.done {
    color: #059669;
}

.ai-trial-step-connector {
    width: 24px;
    height: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .ai-trial-step-item span.step-label {
        display: none;
    }
    .ai-trial-step-connector {
        width: 12px;
    }
}

/* Main card */
.ai-trial-card {
    background: var(--theme-card, #fff);
    border: 1px solid rgba(87, 2, 16, 0.08);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(87, 2, 16, 0.08);
    overflow: hidden;
}

/* Product panel */
.ai-trial-product-panel {
    padding: 1.5rem;
    background: linear-gradient(180deg, rgba(87, 2, 16, 0.03) 0%, transparent 100%);
    border-right: 1px solid rgba(87, 2, 16, 0.08);
}

.ai-trial-product-chip {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #570210;
    background: rgba(87, 2, 16, 0.08);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.ai-trial-product-image-wrap {
    background: #fff;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    text-align: center;
}

.ai-trial-product-image {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 8px;
}

.ai-trial-product-name {
    font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--theme-text, #1f2937);
    margin-bottom: 0.35rem;
}

.ai-trial-variant-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #570210;
    background: rgba(87, 2, 16, 0.06);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.ai-trial-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #570210;
    margin-bottom: 1rem;
}

.ai-trial-product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-trial-product-actions .btn {
    flex: 1;
    min-width: 120px;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* Workspace */
.ai-trial-workspace {
    padding: 1.5rem;
}

.ai-trial-step {
    display: none;
    animation: trialFadeIn 0.35s ease;
}

.ai-trial-step.active {
    display: block;
}

@keyframes trialFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-trial-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--theme-text, #1f2937);
    margin-bottom: 0.35rem;
}

.ai-trial-section-hint {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 1.25rem;
}

/* Mobile source tabs */
.ai-trial-source-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: #f3f4f6;
    padding: 0.35rem;
    border-radius: 12px;
}

.ai-trial-source-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.65rem 0.5rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-trial-source-tab.active {
    background: #fff;
    color: #570210;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-trial-source-panel {
    display: none;
}

.ai-trial-source-panel.active {
    display: block;
}

.ai-trial-upload-zone {
    border: 2px dashed rgba(87, 2, 16, 0.35);
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: linear-gradient(135deg, rgba(87, 2, 16, 0.02) 0%, rgba(139, 41, 66, 0.04) 100%);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ai-trial-upload-zone:hover,
.ai-trial-upload-zone.dragover {
    border-color: #570210;
    background: rgba(87, 2, 16, 0.06);
    transform: scale(1.01);
}

.ai-trial-upload-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #570210, #8b2942);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(87, 2, 16, 0.25);
}

.ai-trial-camera-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #111;
    aspect-ratio: 3/4;
    max-height: 360px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.ai-trial-camera-wrap video,
.ai-trial-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ai-trial-camera-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ai-trial-preview-box {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
}

.ai-trial-preview-box h6 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.ai-trial-preview-box .ai-trial-camera-wrap {
    max-height: 280px;
}

/* CTA area */
.ai-trial-cta-bar {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.ai-trial-cta-bar .btn-try-submit {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #570210 0%, #8b2942 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(87, 2, 16, 0.3);
    transition: all 0.2s ease;
}

.ai-trial-cta-bar .btn-try-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(87, 2, 16, 0.4);
    color: #fff;
}

.ai-trial-cta-bar .btn-try-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-trial-cta-bar .btn-try-submit.is-loading {
    pointer-events: none;
}

/* Loading */
.ai-trial-loading {
    text-align: center;
    padding: 3rem 1.5rem;
}

.ai-trial-loading-ring {
    width: 72px;
    height: 72px;
    border: 4px solid rgba(87, 2, 16, 0.1);
    border-top-color: #570210;
    border-radius: 50%;
    animation: trialSpin 0.9s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes trialSpin {
    to { transform: rotate(360deg); }
}

.ai-trial-loading h5 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ai-trial-loading-steps {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.ai-trial-loading-step {
    font-size: 0.8rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ai-trial-loading-step.active {
    color: #570210;
    font-weight: 600;
}

/* Result */
.ai-trial-result-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.ai-trial-result-header h5 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ai-trial-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.ai-trial-compare-item {
    text-align: center;
    background: #fafafa;
    border: 1px solid rgba(87, 2, 16, 0.08);
    border-radius: 16px;
    padding: 0.5rem 0.5rem 0.65rem;
    overflow: hidden;
    min-width: 0;
}

.ai-trial-compare-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.ai-trial-compare-item img {
    width: 100%;
    height: auto;
    max-height: min(46vh, 400px);
    aspect-ratio: unset;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
    box-shadow: none;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.ai-trial-compare-item img.ai-trial-ai-result {
    max-height: min(68vh, 520px);
}

.ai-trial-compare-item img.ai-trial-product-shot {
    object-fit: contain;
    background: #fff;
}

.ai-trial-lookboard-wrap {
    text-align: center;
    background: #fafafa;
    border: 1px solid rgba(87, 2, 16, 0.08);
    border-radius: 16px;
    padding: 0.5rem;
    overflow: hidden;
}

.ai-trial-lookboard-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    box-shadow: none;
    max-height: min(62vh, 520px);
}

.ai-trial-single-result {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(68vh, 520px);
    border-radius: 12px;
    box-shadow: none;
    object-fit: contain;
    object-position: center;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.ai-trial-ai-note {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(87, 2, 16, 0.05);
    border: 1px solid rgba(87, 2, 16, 0.12);
    border-radius: 12px;
    font-size: 0.82rem;
    color: #4b5563;
}

.ai-trial-result-full {
    margin-bottom: 1rem;
}

.ai-trial-result-img {
    width: 100%;
    height: auto;
    max-height: min(68vh, 520px);
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
    box-shadow: none;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.ai-trial-mode-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ai-trial-mode-badge.preview {
    background: #fef3c7;
    color: #92400e;
}

.ai-trial-mode-badge.ai {
    background: #dbeafe;
    color: #1e40af;
}

.ai-trial-mode-badge.compare {
    background: #dcfce7;
    color: #166534;
}

.ai-trial-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ai-trial-actions .btn {
    flex: 1;
    min-width: 140px;
    border-radius: 10px;
    font-weight: 600;
}

/* Product picker grid */
.ai-trial-picker-card {
    background: var(--theme-card, #fff);
    border: 1px solid rgba(87, 2, 16, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.25s ease;
    height: 100%;
}

.ai-trial-picker-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(87, 2, 16, 0.12);
}

.ai-trial-picker-card a {
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
}

.ai-trial-picker-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    background: #f9fafb;
}

.ai-trial-picker-card h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Try On buttons (product pages) */
.btn-try-on,
.btn-try-on-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: linear-gradient(135deg, var(--primary-color, #570210) 0%, #7a0a1a 100%);
    color: #fff !important;
}

.btn-try-on:hover,
.btn-try-on-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(87, 2, 16, 0.35);
    color: #fff !important;
    filter: brightness(1.06);
}

.modern-btn-try {
    flex: 1;
    padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
    border: none;
    background: linear-gradient(135deg, var(--primary-color, #570210) 0%, #7a0a1a 100%);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.modern-btn-try:hover {
    color: #fff;
    box-shadow: 0 4px 12px rgba(87, 2, 16, 0.3);
    transform: translateY(-1px);
}

/* Mobile sticky CTA */
.ai-trial-mobile-cta {
    display: none;
}

@media (max-width: 991px) {
    .ai-trial-page .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ai-trial-hero {
        padding: 1.5rem 0;
    }

    .ai-trial-product-panel {
        border-right: none;
        border-bottom: 1px solid rgba(87, 2, 16, 0.08);
        padding: 1rem;
    }

    .ai-trial-product-panel .ai-trial-product-image-wrap {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        text-align: left;
    }

    .ai-trial-product-panel .ai-trial-product-image {
        max-height: 100px;
        max-width: 90px;
        flex-shrink: 0;
    }

    .ai-trial-product-panel .ai-trial-product-meta {
        flex: 1;
        min-width: 0;
    }

    .ai-trial-product-panel .ai-trial-product-name {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ai-trial-product-panel .ai-trial-price {
        font-size: 1rem;
        margin-bottom: 0;
    }

    .ai-trial-product-panel .ai-trial-product-actions {
        display: none;
    }

    .ai-trial-workspace {
        padding: 1rem;
    }

    .ai-trial-compare {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .ai-trial-compare-item img {
        max-height: min(36vh, 300px);
    }

    .ai-trial-compare-item img.ai-trial-ai-result,
    .ai-trial-single-result,
    .ai-trial-lookboard-img {
        max-height: min(54vh, 440px);
    }

    .ai-trial-lookboard-wrap,
    .ai-trial-compare-item {
        border-radius: 14px;
        padding: 0.4rem;
    }

    .ai-trial-result-header {
        margin-bottom: 1rem;
    }

    .ai-trial-mobile-cta {
        display: block;
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        padding: 0.75rem 1rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid #e5e7eb;
        z-index: 1020;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    .ai-trial-mobile-cta .btn-try-submit {
        width: 100%;
    }

    .ai-trial-page.has-mobile-cta {
        padding-bottom: 130px;
    }

    .ai-trial-cta-bar .btn-try-submit {
        display: none;
    }
}

@media (min-width: 992px) {
    .ai-trial-source-tabs {
        display: none;
    }

    .ai-trial-source-panel {
        display: block !important;
    }

    .ai-trial-desktop-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

[data-theme="dark"] .ai-trial-card,
[data-theme="dark"] .ai-trial-picker-card {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ai-trial-steps-bar {
    background: var(--theme-card);
}

[data-theme="dark"] .ai-trial-upload-zone {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .ai-trial-mobile-cta {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn-try-on,
[data-theme="dark"] .btn-try-on-link,
[data-theme="dark"] .modern-btn-try {
    background: linear-gradient(135deg, #8b2942 0%, #570210 100%);
    color: #fff !important;
}
