/* Wear It — Modal CSS v4.0.1 */

/* ─── Reset & Font ─── */
.wearit-modal, .wearit-modal * {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* ─── Modal Overlay — hidden by default, shown with .wearit-open ─── */
.wearit-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
}
.wearit-modal.wearit-open {
    display: flex !important;
}
.wearit-backdrop {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    cursor: pointer !important;
    z-index: 1 !important;
}

/* ─── Container ─── */
.wearit-container {
    position: relative !important;
    z-index: 2 !important;
    width: 95vw !important;
    max-width: 1100px !important;
    height: 90vh !important;
    max-height: 800px !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

/* ─── Header ─── */
.wearit-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 24px !important;
    background: #fafafa !important;
    border-bottom: 1px solid #e5e7eb !important;
    flex-shrink: 0 !important;
}
.wearit-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}
.wearit-logo {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #7c3aed !important;
    letter-spacing: 0.5px !important;
}
.wearit-product-name {
    font-size: 13px !important;
    color: #6b7280 !important;
    font-weight: 500 !important;
}
.wearit-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: 1px solid #e5e7eb !important;
    background: #ffffff !important;
    color: #6b7280 !important;
    font-size: 20px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s !important;
    line-height: 1 !important;
    z-index: 10 !important;
}
.wearit-close:hover {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
}

/* ─── Body Layout ─── */
.wearit-body {
    display: flex !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* ─── Preview Area (Left) ─── */
.wearit-preview {
    flex: 1 !important;
    background: #f1f5f9 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* ─── Steps — ALL hidden by default, shown with .active ─── */
.wearit-step {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
.wearit-step.active {
    display: flex !important;
}

/* ─── Dropzone (Upload Step) ─── */
.wearit-dropzone {
    width: 80% !important;
    max-width: 420px !important;
    padding: 48px 32px !important;
    border: 2px dashed #c4b5fd !important;
    border-radius: 16px !important;
    background: #faf5ff !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}
.wearit-dropzone.dragover {
    border-color: #7c3aed !important;
    background: #ede9fe !important;
    transform: scale(1.02) !important;
}
.wearit-dropzone-icon {
    font-size: 48px !important;
    margin-bottom: 12px !important;
}
.wearit-dropzone h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin-bottom: 6px !important;
}
.wearit-dropzone p {
    font-size: 13px !important;
    color: #6b7280 !important;
    margin-bottom: 4px !important;
}
.wearit-hint {
    font-size: 12px !important;
    color: #9ca3af !important;
    font-style: italic !important;
}
.wearit-upload-actions {
    display: flex !important;
    gap: 10px !important;
    justify-content: center !important;
    margin-top: 20px !important;
}
.wearit-upload-btn,
.wearit-camera-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    border: none !important;
}
.wearit-upload-btn {
    background: #7c3aed !important;
    color: #ffffff !important;
}
.wearit-upload-btn:hover {
    background: #6d28d9 !important;
}
.wearit-camera-btn {
    background: #ffffff !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}
.wearit-camera-btn:hover {
    background: #f3f4f6 !important;
}

/* ─── Selfie Camera ─── */
#wearit-selfie-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transform: scaleX(-1) !important;
}
.wearit-selfie-controls {
    position: absolute !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 12px !important;
    z-index: 5 !important;
}
.wearit-selfie-capture {
    padding: 12px 28px !important;
    background: #7c3aed !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 25px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}
.wearit-selfie-cancel {
    padding: 12px 20px !important;
    background: rgba(255,255,255,0.9) !important;
    color: #374151 !important;
    border: none !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

/* ─── Loading Step ─── */
.wearit-loading-content {
    text-align: center !important;
    padding: 40px !important;
}
.wearit-spinner {
    width: 48px !important;
    height: 48px !important;
    border: 4px solid #e5e7eb !important;
    border-top-color: #7c3aed !important;
    border-radius: 50% !important;
    margin: 0 auto 20px auto !important;
    animation: wearit-spin 0.8s linear infinite !important;
}
@keyframes wearit-spin {
    to { transform: rotate(360deg); }
}
.wearit-loading-content h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin-bottom: 8px !important;
}
.wearit-loading-content p {
    font-size: 13px !important;
    color: #6b7280 !important;
    margin-bottom: 20px !important;
}
.wearit-progress-bar {
    width: 260px !important;
    height: 6px !important;
    background: #e5e7eb !important;
    border-radius: 3px !important;
    margin: 0 auto !important;
    overflow: hidden !important;
}
.wearit-progress-fill {
    height: 100% !important;
    width: 0% !important;
    background: linear-gradient(90deg, #7c3aed, #a855f7) !important;
    border-radius: 3px !important;
    transition: width 0.5s ease !important;
}

/* ─── Result Step ─── */
.wearit-result-img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* ─── Right Panel ─── */
.wearit-panel {
    width: 320px !important;
    flex-shrink: 0 !important;
    background: #ffffff !important;
    border-left: 1px solid #e5e7eb !important;
    padding: 20px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}
.wearit-panel-section {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}
.wearit-panel-section.wearit-hidden {
    display: none !important;
}
.wearit-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    color: #9ca3af !important;
}

/* ─── Photo Preview ─── */
.wearit-photo-preview {
    position: relative !important;
    width: 100% !important;
    height: 100px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    border: 1px solid #e5e7eb !important;
}
.wearit-photo-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.wearit-change-photo {
    position: absolute !important;
    bottom: 6px !important;
    right: 6px !important;
    padding: 4px 12px !important;
    background: rgba(255,255,255,0.95) !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

/* ─── Color Swatches ─── */
.wearit-colors {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}
.wearit-swatch {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 3px solid transparent !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    position: relative !important;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1) !important;
}
.wearit-swatch:hover {
    transform: scale(1.1) !important;
}
.wearit-swatch.active {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px #c4b5fd, inset 0 0 0 1px rgba(0,0,0,0.1) !important;
}
.wearit-color-name {
    font-size: 12px !important;
    color: #6b7280 !important;
    font-weight: 500 !important;
    min-height: 18px !important;
}

/* ─── Garment Preview ─── */
.wearit-garment-preview {
    width: 100% !important;
    height: 140px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.wearit-garment-preview img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* ─── Buttons ─── */
.wearit-generate-btn {
    width: 100% !important;
    padding: 14px 20px !important;
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3) !important;
}
.wearit-generate-btn:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4) !important;
}
.wearit-generate-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}
.wearit-action-btn {
    width: 100% !important;
    padding: 11px 16px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    text-align: center !important;
    border: none !important;
}
.wearit-download-btn {
    background: #7c3aed !important;
    color: #ffffff !important;
}
.wearit-download-btn:hover {
    background: #6d28d9 !important;
}
.wearit-share-btn {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}
.wearit-share-btn:hover {
    background: #e5e7eb !important;
}
.wearit-retry-btn {
    background: transparent !important;
    color: #7c3aed !important;
    border: 1px solid #c4b5fd !important;
}
.wearit-retry-btn:hover {
    background: #faf5ff !important;
}

/* ─── Powered By ─── */
.wearit-powered {
    font-size: 11px !important;
    color: #9ca3af !important;
    text-align: center !important;
    margin-top: auto !important;
    padding-top: 12px !important;
}
.wearit-powered a {
    color: #7c3aed !important;
    text-decoration: none !important;
}

/* ─── Error Toast ─── */
.wearit-toast {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 12px 24px !important;
    background: #1f2937 !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    z-index: 9999999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    animation: wearit-toast-in 0.3s ease !important;
    max-width: 90vw !important;
}
.wearit-toast.error { background: #dc2626 !important; }
@keyframes wearit-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    .wearit-container {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    .wearit-body {
        flex-direction: column !important;
    }
    .wearit-preview {
        flex: 1 !important;
        min-height: 45vh !important;
    }
    .wearit-panel {
        width: 100% !important;
        border-left: none !important;
        border-top: 1px solid #e5e7eb !important;
        max-height: 50vh !important;
        padding: 16px !important;
        gap: 12px !important;
    }
    .wearit-dropzone {
        width: 90% !important;
        padding: 32px 20px !important;
    }
    .wearit-upload-actions {
        flex-direction: column !important;
        align-items: center !important;
    }
    .wearit-garment-preview {
        height: 100px !important;
    }
    .wearit-photo-preview {
        height: 80px !important;
    }
    .wearit-header {
        padding: 12px 16px !important;
    }
}
